Skip to content

Commit

Permalink
chore: Backport new release process (#640)
Browse files Browse the repository at this point in the history
Co-authored-by: Mostafa Shorim <[email protected]>
Co-authored-by: Iwona Langer <[email protected]>
  • Loading branch information
3 people authored Dec 14, 2023
1 parent 4240cc7 commit 148a095
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 182 deletions.
4 changes: 2 additions & 2 deletions .github/template/prepare-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ runs:
GITHUB_OWNER: "${{ github.repository_owner }}"
GITHUB_REPO: "telemetry-manager"

- name: Deploy module experimental
- name: Deploy module release
if: ${{ inputs.release }}
shell: bash
run: make deploy

- name: Deploy module release
- name: Deploy module experimental
if: ${{ !inputs.release }}
shell: bash
run: make deploy-dev
Expand Down
93 changes: 0 additions & 93 deletions .github/workflows/pull-module.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/push-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: GitHub Release

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

# wait for the build to succeed so that the manager image is available
- name: Wait for the 'post-telemetry-manager-build-release' job to succeed
uses: kyma-project/wait-for-commit-status-action@2b3ffe09af8b6f40e1213d5fb7f91a7bd41ffb20
with:
context: "post-telemetry-manager-build-release"
commit_ref: "${{ github.ref_name }}" # 'github.ref_name' is the release tag which triggered the Github action
timeout: 600000 # 10 minutes in milliseconds
# The check interval is kept long otherwise it will exhaust the GitHub rate limit (More info: https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limiting)
check_interval: 60000 # 1 minute in milliseconds
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_OWNER: "${{ github.repository_owner }}"
GITHUB_REPO: "telemetry-manager"

- name: Release
run: make release
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ tls.key
## Files which are auto-generated when creating a module
# ModuleTemplate which is generated by kyma alpha create module command
moduletemplate.yaml
# ModuleTemplate for experimental channel which is generated by kyma alpha create module command
moduletemplate-dev.yaml
# Generated manifests
telemetry-manager.yaml
# Generated manifests for experimental channel
Expand Down
2 changes: 0 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ changelog:
- '^(B|b)ump'
release:
extra_files:
- glob: moduletemplate.yaml
- glob: moduletemplate-dev.yaml
- glob: telemetry-manager.yaml
- glob: telemetry-manager-dev.yaml
- glob: telemetry-default-cr.yaml
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ undeploy-dev: ## Undeploy resources based on the development variant from the K8
##@ Release Module

.PHONY: release
release: kyma kustomize ## Create module with its image pushed to prod registry and create a github release entry
KYMA=${KYMA} KUSTOMIZE=${KUSTOMIZE} IMG=${IMG} GORELEASER_VERSION=${GORELEASER_VERSION} ./hack/release.sh
release: kustomize ## Prepare release artefacts and create a GitHub release
KUSTOMIZE=${KUSTOMIZE} IMG=${IMG} GORELEASER_VERSION=${GORELEASER_VERSION} ./hack/release.sh

##@ Build Dependencies

Expand Down
18 changes: 0 additions & 18 deletions docs/contributor/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,3 @@ make deploy-dev
kubectl create ns kyma-system
kubectl apply -f https://github.com/kyma-project/telemetry-manager/releases/latest/download/telemetry-manager.yaml
```

## Install Telemetry Manager in your cluster from latest release using the Lifecycle manager

1. Ensure that you have the [Kyma CLI](https://kyma-project.io/#/04-operation-guides/operations/01-install-kyma-CLI) installed.

2. Install the Lifecycle manager:

```shell
kyma alpha deploy
```

3. Install the ModuleTemplate and activate the component:
```shell
kubectl apply -f https://github.com/kyma-project/telemetry-manager/releases/latest/download/moduletemplate.yaml
kyma alpha enable module telemetry --channel fast
```

4. Verify that a `telemetry-operator` Pod starts up in the `kyma-system` Namespace.
30 changes: 14 additions & 16 deletions docs/contributor/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,22 @@

This release process covers the steps to release new major and minor versions for the Kyma Telemetry module.

1. Verify that all issues in the [Github milestone](https://github.com/kyma-project/telemetry-manager/milestones) related to the version are closed.
1. Verify that all issues in the [GitHub milestone](https://github.com/kyma-project/telemetry-manager/milestones) related to the version are closed.

2. Close the milestone.

3. Create a new [Github milestone](https://github.com/kyma-project/telemetry-manager/milestones) for the next version.
3. Create a new [GitHub milestone](https://github.com/kyma-project/telemetry-manager/milestones) for the next version.

4. Bump the `telemetry-manager/main` branch with the new versions for the dependent images.
Create a PR to `telemetry-manager/main` with the following changes:
- `Makefile`:
- Ensure the `IMG` variable reflects the latest `telemetry-manager` version.
- For the `IMG` variable, update the tag of the `telemetry-manager` image with the new module version following the `x.y.z` pattern. For example, `IMG ?= europe-docker.pkg.dev/kyma-project/prod/telemetry-manager:1.0.0`.
- `config/manager/kustomization.yaml`:
- Ensure the `newTag` field for the `telemetry-manager` image reflects the latest version.
- `module-config.yaml`:
- Update the `version` field to the value of the new module version following the `x.y.z` pattern, such as `1.0.0`.
- `module-config-dev.yaml`:
- Update the `version` field to the value of the new development module version following the `x.y.z-dev` pattern, such as `1.0.0-dev`.
- Update the `newTag` field for the `telemetry-manager` image with the new module version following the `x.y.z` pattern, such as `1.0.0`.
- `sec-scanners-config.yaml`:
- Ensure that all images listed in the `protecode` field have the same versions as those used in the `main.go` file.
- For the images listed in the `protecode` field:
- Update the tag of the `telemetry-manager` image with the new module version following the `x.y.z` pattern. For example, `europe-docker.pkg.dev/kyma-project/prod/telemetry-manager:1.0.0`.
- Ensure that all other images have the same versions as those used in the `main.go` file.

5. Merge the PR.

Expand All @@ -35,8 +33,8 @@ This release process covers the steps to release new major and minor versions fo

7. In the `telemetry-manager/{RELEASE_BRANCH}` branch, create release tags for the head commit.
```bash
git tag -a {RELEASE_VERSION} -m "Release {RELEASE_VERSION}"
git tag -a {RELEASE_DEV_VERSION} -m "Release {RELEASE_DEV_VERSION}"
git tag {RELEASE_VERSION}
git tag {RELEASE_DEV_VERSION}
```
Replace {RELEASE_VERSION} with the new module version, for example, `1.0.0`, and replace {RELEASE_DEV_VERSION} with the new development module version, for example, `1.0.0-dev`. The release tags point to the HEAD commit in `telemetry-manager/main` and `telemetry-manager/{RELEASE_BRANCH}` branches.

Expand All @@ -45,11 +43,11 @@ This release process covers the steps to release new major and minor versions fo
git push upstream {RELEASE_VERSION}
git push upstream {RELEASE_DEV_VERSION}
```
The {RELEASE_VERSION} tag triggers a postsubmit job (`post-telemetry-manager-release-module`) that creates the GitHub release.
The {RELEASE_VERSION} tag triggers a post-submit Prow Job (`post-telemetry-manager-build-release`) and a GitHub action (`GitHub Release`). The `post-telemetry-manager-build-release` job builds the `telemetry-manager` image, tags it with the module version, and pushes it to the production registry. The `GitHub Release` action creates the GitHub release.

9. Verify the [Prow Status](https://status.build.kyma-project.io/) of the postsubmit job (`post-telemetry-manager-release-module`).
- Once the postsubmit job succeeds, the new Github release is available under [releases](https://github.com/kyma-project/telemetry-manager/releases).
- If the postsubmit job fails, retrigger it by removing the {RELEASE_VERSION} tag from upstream and pushing it again:
9. Verify the [status](https://status.build.kyma-project.io/) of the post-submit Prow Job (`post-telemetry-manager-build-release`) and the [status](https://github.com/kyma-project/telemetry-manager/actions) of the GitHub action (`GitHub Release`).
- Once the post-submit Prow Job and the GitHub action succeed, the new GitHub release is available under [releases](https://github.com/kyma-project/telemetry-manager/releases).
- If the post-submit Prow Job or the GitHub action fails, re-trigger them by removing the {RELEASE_VERSION} tag from upstream and pushing it again:
```bash
git push --delete upstream {RELEASE_VERSION}
git push upstream {RELEASE_VERSION}
Expand All @@ -61,7 +59,7 @@ Every PR's title must adhere to the [Conventional Commits](https://www.conventio
### Pull Request Title
Due to the Squash merge Github Workflow, each PR results in a single commit after merging into the main development branch. The PR's title becomes the commit message and must adhere to the template:
Due to the Squash merge GitHub Workflow, each PR results in a single commit after merging into the main development branch. The PR's title becomes the commit message and must adhere to the template:

`type(scope?): subject`

Expand Down
49 changes: 10 additions & 39 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,25 @@ set -o errexit # exit immediately when a command fails.
set -E # needs to be set if we want the ERR trap
set -o pipefail # prevents errors in a pipeline from being masked

readonly MODULE_REGISTRY="europe-docker.pkg.dev/kyma-project/prod/unsigned"
readonly GCP_ACCESS_TOKEN=$(gcloud auth application-default print-access-token)

function create_module() {
echo "Creating the module"
${KUSTOMIZE} build config/default > telemetry-manager.yaml
${KYMA} alpha create module \
--module-config-file=module-config.yaml \
--registry ${MODULE_REGISTRY} \
--credentials oauth2accesstoken:${GCP_ACCESS_TOKEN} \
--output moduletemplate.yaml \
--module-archive-version-overwrite \
--ci
}

function create_dev_module() {
echo "Creating the development module"
${KUSTOMIZE} build config/development > telemetry-manager-dev.yaml
${KYMA} alpha create module \
--module-config-file=module-config-dev.yaml \
--registry ${MODULE_REGISTRY} \
--credentials oauth2accesstoken:${GCP_ACCESS_TOKEN} \
--output moduletemplate-dev.yaml \
--module-archive-version-overwrite \
--ci
function prepare_release_artefacts() {
echo "Preparing release artefacts"
cd config/manager && ${KUSTOMIZE} edit set image controller=${IMG} && cd ../..
# Create the resources file that is used for creating the ModuleTemplate for fast and regular channels
${KUSTOMIZE} build config/default > telemetry-manager.yaml
# Create the resources file that is used for creating the ModuleTemplate for experimental channel
${KUSTOMIZE} build config/development > telemetry-manager-dev.yaml
# Rename the file for Telemetry default CR to have a better naming as a release artefact
cp ./config/samples/operator_v1alpha1_telemetry.yaml telemetry-default-cr.yaml
}

function create_github_release() {
echo "Creating the Github release"
# rename the file for Telemetry default CR to have a better naming as a release artefact
cp ./config/samples/operator_v1alpha1_telemetry.yaml telemetry-default-cr.yaml
git reset --hard
curl -sL https://git.io/goreleaser | VERSION=${GORELEASER_VERSION} bash
}

function main() {
# Adding the remote repo is needed for the kyma alpha create module command and for goreleaser
git remote add origin https://github.com/kyma-project/telemetry-manager

cd config/manager && ${KUSTOMIZE} edit set image controller=${IMG} && cd ../..

# Create the module and push its image to the prod registry defined in MODULE_REGISTRY
create_module

# Create the dev module for the experimental channel and push its image to the prod registry defined in MODULE_REGISTRY
create_dev_module

# Create github release entry using goreleaser
prepare_release_artefacts
create_github_release
}

Expand Down
8 changes: 0 additions & 8 deletions module-config-dev.yaml

This file was deleted.

0 comments on commit 148a095

Please sign in to comment.