Skip to content

Commit f69ef2e

Browse files
committed
git: merge rhobs-scripts
1 parent 5cf2f5d commit f69ef2e

31 files changed

Lines changed: 2604 additions & 0 deletions
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# This workflow creates a git tag and publishes container images
2+
name: rhobs release
3+
on:
4+
push:
5+
branches:
6+
- 'rhobs-rel-**'
7+
8+
jobs:
9+
debug:
10+
runs-on: ubuntu-latest
11+
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
12+
steps:
13+
- name: Debug
14+
run: |
15+
echo "Skipping release workflow since commit message does match the convention"
16+
17+
create-release:
18+
runs-on: ubuntu-latest
19+
if: "startsWith(github.event.head_commit.message, 'chore(release):')"
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Import common environment variables
27+
run: cat ".github/env" >> "$GITHUB_ENV"
28+
29+
- name: Install Go
30+
uses: actions/setup-go@v3
31+
with:
32+
go-version: '${{ env.golang-version }}'
33+
34+
- name: login to quay.io
35+
uses: docker/login-action@v2
36+
with:
37+
registry: quay.io
38+
username: ${{ secrets.quay_repo_username }}
39+
password: ${{ secrets.quay_repo_password }}
40+
41+
- name: create git tag
42+
id: git_tag
43+
run: |
44+
version="$(head -1 VERSION)"
45+
git config user.name rhobs-release-bot
46+
git config user.email release-bot@monitoring.rhobs.io
47+
48+
git tag -a "v${version}" -m "v${version}"
49+
git tag -a "pkg/apis/monitoring/v${version}" -m "v${version}"
50+
git tag -a "pkg/client/v${version}" -m "v${version}"
51+
52+
53+
- name: Build RHOBS images and push
54+
env:
55+
IMAGE_ORG: ${{ secrets.IMAGE_ORG }}
56+
run: |
57+
REGISTRIES="quay.io" \
58+
IMAGE_ORG="$IMAGE_ORG" \
59+
CPU_ARCHS="amd64" \
60+
TAG="v$(head -1 VERSION)" \
61+
./rhobs/push-container-images.sh
62+
63+
cd rhobs/olm
64+
make tools
65+
make bundle-image bundle-push IMAGE_REPO=quay.io/"$IMAGE_ORG"
66+
67+
- name: push git tags
68+
run: |
69+
git push --tags
70+
71+
- name: test if rhobs fork can be imported
72+
run: |
73+
[[ "$IMAGE_ORG" != "rhobs" ]] && {
74+
echo "Skipping import tests on forked repos"
75+
exit 0
76+
}
77+
78+
cd rhobs/test/import
79+
go mod tidy
80+
go test ./...

rhobs/README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# RHOBS Scripts
2+
3+
This directory hosts scripts that helps with creation of forked Prometheus
4+
Operator with only differs from the [upstream
5+
repository](https://github.com/prometheus-operator/prometheus-operator) by the
6+
API Group being `monitoring.rhobs` instead of `monitoring.coreos.com`.
7+
8+
## Making a Release
9+
10+
In this example we have our local Git repository setup with 3 remotes. Note
11+
that the `make-release-commit.sh` script assumes the following remote names to
12+
be present.
13+
14+
1. `upstream` -> `github.com/prometheus-operator/prometheus-operator`
15+
2. `downstream` -> `github.com/rhobs/obo-prometheus-operator`
16+
3. `origin `-> `github.com/<your-fork-of>/obo-prometheus-operator`
17+
18+
### Create New Release Branch
19+
20+
We start by pushing an already released version of upstream prometheus-operator
21+
to our `downstream` fork (under the [rhobs](https://github.com/rhobs)
22+
organization). Note that the downstream release branches follow a nomenclature
23+
which is different to upstream so that the upstream github worflows don't
24+
trigger accidently.
25+
26+
The naming convention used is `rhobs-rel-<upstream-release>-rhobs<patch>`
27+
28+
In this example, we are making a downstream release of `v0.60.0`. Start by
29+
creating a release branch as follows:
30+
31+
```bash
32+
export UPSTREAM_VERSION=0.60.0
33+
export CURRENT_DOWNSTREAM_VERSION=0.59.2-rhobs1
34+
git fetch upstream --tags
35+
git push downstream "+v${UPSTREAM_VERSION}^{commit}:refs/heads/rhobs-rel-${UPSTREAM_VERSION}-rhobs1"
36+
```
37+
38+
### Make Release Commit
39+
40+
Start by creating a local branch for the release (e.g. `pr-for-release`) and reseting it to
41+
the upstream release version/tag.
42+
43+
```bash
44+
git checkout -b pr-for-release
45+
git reset --hard "v${UPSTREAM_VERSION}"
46+
```
47+
48+
Merge the `rhobs-scripts` branch, squashing all its commits into one.
49+
50+
```bash
51+
git merge --squash --allow-unrelated-histories downstream/rhobs-scripts
52+
git commit -m "git: merge rhobs-scripts"
53+
```
54+
55+
Run the `make-release-commit.sh` script which creates a Git commit that
56+
contains all changes required to create the forked prometheus operator for
57+
Observabilty Operator (ObO). The `make-release-commit.sh` takes a mandatory
58+
argument `--previous-version` which should point to the last stable release of
59+
the fork. This stable version is used in `e2e` tests that are run in CI which
60+
validates if the newer version is upgradable from the `previous-version`
61+
62+
```bash
63+
./rhobs/make-release-commit.sh --previous-version ${CURRENT_DOWNSTREAM_VERSION}
64+
git push -u origin HEAD
65+
```
66+
67+
### Create Pull Request
68+
69+
Create a pull request against the `rhobs-rel-0.60.0-rhobs1` branch and ensure
70+
that the title says `chore(release): v${UPSTREAM_VERSION}-rhobs1`. This is
71+
important since the rhobs-release (GitHub) workflow makes release if and only
72+
if the commit message starts with `chore(release)`.
73+
74+
### Automatic release once the PR merges
75+
76+
Check `.github/workflows/rhobs-release.yaml` for details of how the release is
77+
made.

0 commit comments

Comments
 (0)