Skip to content

Commit 027faa9

Browse files
authored
Merge pull request #34 from jgwest/add-rollouts-upgrade-script
Add automatic rollouts upgrade script (#33)
2 parents 2aba8a0 + 260df5e commit 027faa9

File tree

9 files changed

+538
-1
lines changed

9 files changed

+538
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ lint: golangci_lint
283283

284284
.PHONY: gosec
285285
gosec: go_sec
286-
$(GO_SEC) ./...
286+
$(GO_SEC) -exclude-dir=hack ./...
287287

288288
# go-get-tool will 'go install' any package $2 and install it to $1.
289289
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
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 argo-rollouts-manager to latest release of Argo Rollouts
2+
3+
The Go code and script this in this directory will automatically open a pull request to update the argo-rollouts-manager to the latest official argo-rollouts release:
4+
- Update container image version in `default.go`
5+
- Update `go.mod` to point to latest module version
6+
- Update CRDs to latest
7+
- 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 an on PATH
15+
- [Operator-sdk v1.28.0](https://github.com/operator-framework/operator-sdk/releases/tag/v1.28.0) installed (as of January 2024), and on PATH
16+
- You must have your own fork of the [argo-rollouts-manager](https://github.com/argoproj-labs/argo-rollouts-manager) repository (example: `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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module github.com/jgwest/argo-rollouts-release-job
2+
3+
go 1.20
4+
5+
require (
6+
github.com/google/go-github/v58 v58.0.0
7+
github.com/google/go-querystring v1.1.0 // indirect
8+
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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-github/v58 v58.0.0 h1:Una7GGERlF/37XfkPwpzYJe0Vp4dt2k1kCjlxwjIvzw=
4+
github.com/google/go-github/v58 v58.0.0/go.mod h1:k4hxDKEfoWpSqFlc8LTpGd9fu2KrV1YAa6Hi6FmDNY4=
5+
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
6+
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
7+
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 argo-rollouts-manager repo
14+
15+
rm -rf "$SCRIPT_DIR/argo-rollouts-manager" || true
16+
17+
git clone "[email protected]:$GITHUB_FORK_USERNAME/argo-rollouts-manager"
18+
cd argo-rollouts-manager
19+
20+
# Add a remote back to the original repo
21+
22+
git remote add parent "[email protected]:argoproj-labs/argo-rollouts-manager"
23+
git fetch parent
24+

0 commit comments

Comments
 (0)