Skip to content

Commit

Permalink
chore: Change release process (#67)
Browse files Browse the repository at this point in the history
Co-authored-by: Nina Hingerl <[email protected]>
  • Loading branch information
k15r and NHingerl authored Jul 9, 2024
1 parent 79b4b23 commit 91c348d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 116 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/pr-build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ on:
- "main"
- "release-*"

env:
# Build mode can be either PR or release. PR uses the code from the current branch using `replace` directive in the builder-config.yaml
# Release uses the code from the specified tag

# BUILD_MODE is used to select the correct builder-config-{BUILD_MODE}.yaml in the dockerfile

BUILD_MODE: PR

jobs:

envs:
Expand Down Expand Up @@ -47,7 +39,6 @@ jobs:
run: |
{
echo 'build-args<<BUILD_ARGS'
echo "BUILD_MODE=${{ env.BUILD_MODE }}"
cat otel-collector/envs
echo BUILD_ARGS
} >> "$GITHUB_OUTPUT"
Expand Down
21 changes: 5 additions & 16 deletions .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@ name: Tag Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+'
env:

# BUILD_MODE can be either `PR` or `release`. `PR` uses the code from the current branch using `replace` directive in the builder-config.yaml
# `release` uses the code from the specified tag
# BUILD_MODE is used to select the correct builder-config-{BUILD_MODE}.yaml in the dockerfile

BUILD_MODE: release

jobs:

envs:
Expand All @@ -23,7 +17,6 @@ jobs:
otel-contrib-version: ${{ steps.load-envs.outputs.OTEL_CONTRIB_VERSION }}
current-tag: ${{ steps.create-tags.outputs.CURRENT_TAG }}
previous-tag: ${{ steps.create-tags.outputs.PREVIOUS_TAG }}
semver: ${{ steps.prepare-envs.outputs.SEMVER }}

steps:
- name: Checkout code
Expand All @@ -41,12 +34,8 @@ jobs:
# this creates a multiline string with the envs.
# Everything between `build-args<<BUILD_ARGS` and BUILD_ARGS will be content of the build-args variable.
echo 'build-args<<BUILD_ARGS'
echo "BUILD_MODE=${{ env.BUILD_MODE }}"
echo "KYMA_OCC_VERSION=$SEMVER"
cat otel-collector/envs
echo BUILD_ARGS
echo "SEMVER=$SEMVER"
} >> "$GITHUB_OUTPUT"
- name: load envs into output
Expand All @@ -58,16 +47,16 @@ jobs:
id: create-tags
run: |
# the tag will look similar to: 0.102.1-0.1.0
echo 'TAGS=${{ steps.load-envs.outputs.OTEL_VERSION }}-${{ steps.prepare-envs.outputs.SEMVER }}' >> "$GITHUB_OUTPUT"
echo 'TAGS=${{ steps.load-envs.outputs.OTEL_VERSION }}-${{ github.ref_name }}' >> "$GITHUB_OUTPUT"
echo 'CURRENT_TAG=${{ github.ref_name }}' >> "$GITHUB_OUTPUT"
# join all tags with the new tag in one list. Inject our new version in the list. Sort the list and get the line prior to the new tag
PREFIX=v
previous_version=$((git for-each-ref --sort=creatordate --format '%(refname)' refs/tags && echo refs/tags/v${{ steps.prepare-envs.outputs.SEMVER }}) \
PREFIX=
previous_version=$(git for-each-ref --sort=creatordate --format '%(refname)' refs/tags \
| grep -E "^refs/tags/${PREFIX}[0-9]+\.[0-9]+\.[0-9]+$" \
| grep -E "[0-9]+\.[0-9]+\.[0-9]+" -o \
| sort -t "." -k1,1n -k2,2n -k3,3n \
| grep -B 1 ${{ steps.prepare-envs.outputs.SEMVER }} | head -1)
| grep -B 1 ${{ github.ref_name }} | head -1)
echo "PREVIOUS_TAG=v${previous_version}" >> "$GITHUB_OUTPUT"
Expand Down
58 changes: 19 additions & 39 deletions docs/contributor/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,51 @@
This release process covers the steps to release new major and minor versions for the `opentelemetry-collector` with Kyma-specific customizations.

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

2. Close the milestone.

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

4. In the `opentelemetry-collector-components` repository, create a release branch.
The name of this branch must follow the `release-x.y` pattern, such as `release-1.0`.
The name of this branch must follow the `release-x.y` pattern, such as `release-1.0`. As opentelemetry-collector follows the release schedule of the `telemetry-manager` component, the release branch should also have the same name as the `telemetry-manager` release branch.

```bash
git fetch upstream
git checkout --no-track -b {RELEASE_BRANCH} upstream/main
git push upstream {RELEASE_BRANCH}
```

5. Bump the `opentelemetry-collector-components/{RELEASE_BRANCH}` branch with the new versions for the dependent images.
Create a PR to `opentelemetry-collector-components/{RELEASE_BRANCH}` with the following changes:
- `sec-scanners-config.yaml`:
Update the tag of the `kyma-otel-collector` image with the new module version following the `OTEL_VERSION-OCC_VERSION` pattern. For example, `europe-docker.pkg.dev/kyma-project/prod/kyma-otel-collector:0.102.1-0.0.1`.

6. Merge the PR.

5. Update `otel-collector/builder-config.yaml` to include all components required in the release and commit the changes.

7. To make sure that the release tags point to the HEAD commit of the `opentelemetry-collector-components/{RELEASE_BRANCH}` branch, rebase the upstream branch into the local branch after the merge was successful.
6. To make sure that the release tags point to the HEAD commit of the `opentelemetry-collector-components/{RELEASE_BRANCH}` branch, rebase the upstream branch into the local branch after the merge was successful.

```bash
git rebase upstream/{RELEASE_BRANCH} {RELEASE_BRANCH}
```

7. Create tags for every Go module in this repository.
For every module in receiver, processor, exporter, and extension directories, create a tag with the new version.

```bash
git tag {RELATIVE_MODULE_PATH}/v{RELEASE_VERSION}
# eg. git tag receiver/dummyreceiver/v1.0.0
```

The create-and-push-tags target in the Makefile helps to create and push tags for all modules.
```bash
OCC_VERSION={RELEASE_VERSION} REMOTE={REPOSITORY_REMOTE} make create-and-push-tags
# eg. OCC_VERSION=1.0.0 REMOTE=upstream make create-and-push-tags
```

8. In the `opentelemetry-collector-components/{RELEASE_BRANCH}` branch, create release tags for the HEAD commit.
7. In the `opentelemetry-collector-components/{RELEASE_BRANCH}` branch, create release tags for the HEAD commit.

```bash
git tag v{RELEASE_VERSION}
git tag {RELEASE_VERSION}
```

9. Push the tag to the upstream repository.
8. Push the tag to the upstream repository.

```bash
git push {REPOSITORY_REMOTE} v{RELEASE_VERSION}
git push {REPOSITORY_REMOTE} {RELEASE_VERSION}
```

The {RELEASE_VERSION} tag triggers a GitHub action (`GitHub Release`).
The {RELEASE_VERSION} tag triggers a GitHub action (`GitHub Release`).

10. Verify the [status](https://github.com/kyma-project/opentelemetry-collector-components/actions) of the GitHub action (`GitHub Release`).
- After the GitHub action succeeded, the new GitHub release is available under [releases](https://github.com/kyma-project/opentelemetry-collector-components/releases).
- If the GitHub action fails, re-trigger it by removing the {RELEASE_VERSION} tag from upstream and pushing it again:
9. Verify the [status](https://github.com/kyma-project/opentelemetry-collector-components/actions) of the GitHub action (`GitHub Release`).
- After the GitHub action succeeded, the new GitHub release is available under [releases](https://github.com/kyma-project/opentelemetry-collector-components/releases).
- If the GitHub action fails, re-trigger it by removing the {RELEASE_VERSION} tag from upstream and pushing it again:

```bash
git push --delete upstream v{RELEASE_VERSION}
git push upstream v{RELEASE_VERSION}
```
```bash
git push --delete upstream v{RELEASE_VERSION}
git push upstream v{RELEASE_VERSION}
```

11. If the previous release was a bugfix version (patch release) that contains cherry-picked changes, these changes might appear again in the generated change log. If there are redundant entries, edit the release description and remove them.
10. If the previous release was a bugfix version (patch release) that contains cherry-picked changes, these changes might appear again in the generated change log. If there are redundant entries, edit the release description and remove them.

## Changelog

Expand Down Expand Up @@ -102,6 +81,7 @@ Note that PRs of type `chore` do not appear in the change log for the release. T

The subject must describe the change and follow the recommendations:

- Describe a change using the [imperative mood](https://en.wikipedia.org/wiki/Imperative_mood). It must start with a present-tense verb, for example (but not limited to) Add, Document, Fix, Deprecate.
- Describe a change using the [imperative mood](https://en.wikipedia.org/wiki/Imperative_mood).
It must start with a present-tense verb, for example (but not limited to) Add, Document, Fix, Deprecate.
- Start with an uppercase, and not finish with a full stop.
- Kyma [capitalization](https://github.com/kyma-project/community/blob/main/docs/guidelines/content-guidelines/02-style-and-terminology.md#capitalization) and [terminology](https://github.com/kyma-project/community/blob/main/docs/guidelines/content-guidelines/02-style-and-terminology.md#terminology) guides.
- Kyma [capitalization](https://github.com/kyma-project/community/blob/main/docs/guidelines/content-guidelines/02-style-and-terminology.md#capitalization) and [terminology](https://github.com/kyma-project/community/blob/main/docs/guidelines/content-guidelines/02-style-and-terminology.md#terminology) guides.
6 changes: 1 addition & 5 deletions otel-collector/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@ ARG GOLANG_VERSION

FROM golang:${GOLANG_VERSION}-alpine as build
ARG OTEL_VERSION
ARG KYMA_OCC_VERSION=0.0.1
ARG OTEL_CONTRIB_VERSION=${OTEL_VERSION}

ARG BUILD_MODE="PR"

RUN apk --update add ca-certificates git

ADD receiver /receiver/
ADD internal /internal/
WORKDIR /app
COPY otel-collector/builder-config-${BUILD_MODE}.yaml builder-config.yaml
COPY otel-collector/builder-config.yaml builder-config.yaml

ENV OTEL_VERSION ${OTEL_VERSION}
ENV OTEL_CONTRIB_VERSION ${OTEL_CONTRIB_VERSION}
RUN sed -i s/OTEL_VERSION/${OTEL_VERSION}/g builder-config.yaml
RUN sed -i s/OTEL_CONTRIB_VERSION/${OTEL_CONTRIB_VERSION}/g builder-config.yaml
RUN sed -i s/KYMA_OCC_VERSION/${KYMA_OCC_VERSION}/g builder-config.yaml

RUN go install go.opentelemetry.io/collector/cmd/builder@v${OTEL_VERSION}

Expand Down
44 changes: 0 additions & 44 deletions otel-collector/builder-config-release.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ receivers:
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/fluentforwardreceiver vOTEL_CONTRIB_VERSION
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/httpcheckreceiver vOTEL_CONTRIB_VERSION
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver vOTEL_CONTRIB_VERSION
- gomod: github.com/kyma-project/opentelemetry-collector-components/receiver/dummyreceiver vKYMA_OCC_VERSION
- gomod: github.com/kyma-project/opentelemetry-collector-components/receiver/singletonreceivercreator vKYMA_OCC_VERSION
- gomod: github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver vKYMA_OCC_VERSION
- gomod: github.com/kyma-project/opentelemetry-collector-components/receiver/dummyreceiver v0.0.1
- gomod: github.com/kyma-project/opentelemetry-collector-components/receiver/singletonreceivercreator v0.0.1
- gomod: github.com/kyma-project/opentelemetry-collector-components/receiver/kymastatsreceiver v0.0.1

processors:
- gomod: go.opentelemetry.io/collector/processor/batchprocessor vOTEL_VERSION
Expand Down

0 comments on commit 91c348d

Please sign in to comment.