Skip to content

Commit 300d8d8

Browse files
authored
Script to auto-upgrade argo-rollouts-manager to latest (#701)
Signed-off-by: Jonathan West <[email protected]>
1 parent 7de6c65 commit 300d8d8

File tree

8 files changed

+462
-0
lines changed

8 files changed

+462
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
settings.env
2+
argo-rollouts-manager
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Update gitops-operator to latest release of argo-rollouts-manager
2+
3+
The Go code and script in this directory will automatically open a pull request to update the gitops-operator to the latest commit of argo-rollouts-manager:
4+
- Update `go.mod` to point to latest module version
5+
- Update CRDs to latest
6+
- Regenerate manifests and bundles
7+
- (Currently disabled): Update target Rollouts version in `hack/run-upstream-argo-rollouts-e2e-tests.sh`
8+
- Open Pull Request using 'gh' CLI
9+
10+
## Instructions
11+
12+
### Prerequisites
13+
- GitHub CLI (_gh_) installed and on PATH
14+
- Go installed and on PATH
15+
- Operator-sdk installed and on PATH
16+
- You must have your own fork of the [argo-rollouts-manager](https://github.com/argoproj-labs/argo-rollouts-manager) repository in GitHub(e.g. `jgwest/argo-rollouts-manager`)
17+
- Your local SSH key registered (e.g. `~/.ssh/id_rsa.pub`) with GitHub to allow git clone via SSH
18+
19+
### Configure and run the tool
20+
21+
```bash
22+
23+
# Set required Environment Variables
24+
export GITHUB_FORK_USERNAME="(your username here)"
25+
export GH_TOKEN="(a GitHub personal access token that can clone/push/open PRs against argo-rollouts-manager repo)"
26+
27+
# or, you can set these values in the settings.env file:
28+
# cp settings_template.env settings.env
29+
# Then set env vars in settings.env (which is excluded in the .gitignore)
30+
31+
./init-repo.sh
32+
./go-run.sh
33+
```
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
4+
5+
cd $SCRIPT_DIR
6+
7+
# Read Github Token and Username from settings.env, if it exists
8+
vars_file="$SCRIPT_DIR/settings.env"
9+
if [[ -f "$vars_file" ]]; then
10+
source "$vars_file"
11+
fi
12+
13+
# Run the upgrade code
14+
go run .
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module github.com/redhat-developepr/gitops-operator/upgrade-rollouts-manager
2+
3+
go 1.20
4+
5+
require github.com/google/go-github/v58 v58.0.0
6+
7+
require github.com/google/go-querystring v1.1.0 // indirect
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
2+
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
3+
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
4+
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
5+
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
6+
github.com/google/go-github/v58 v58.0.0 h1:Una7GGERlF/37XfkPwpzYJe0Vp4dt2k1kCjlxwjIvzw=
7+
github.com/google/go-github/v58 v58.0.0/go.mod h1:k4hxDKEfoWpSqFlc8LTpGd9fu2KrV1YAa6Hi6FmDNY4=
8+
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
9+
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
10+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
4+
5+
cd $SCRIPT_DIR
6+
7+
# Read Github Token and Username from settings.env, if it exists
8+
vars_file="$SCRIPT_DIR/settings.env"
9+
if [[ -f "$vars_file" ]]; then
10+
source "$vars_file"
11+
fi
12+
13+
# Clone fork of gitops-operator repo
14+
15+
rm -rf "$SCRIPT_DIR/gitops-operator" || true
16+
17+
git clone "[email protected]:$GITHUB_FORK_USERNAME/gitops-operator"
18+
cd gitops-operator
19+
20+
# Add a remote back to the original repo
21+
22+
git remote add parent "[email protected]:redhat-developer/gitops-operator"
23+
git fetch parent
24+

0 commit comments

Comments
 (0)