Skip to content

Commit 0e5df93

Browse files
authored
Add Github Actions release pipeline (kubernetes#1870)
* add gha * allow alpha tags and remove dist * update process * rename file
1 parent 9910e2c commit 0e5df93

File tree

5 files changed

+57
-30
lines changed

5 files changed

+57
-30
lines changed

.github/workflows/release-cpo.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release CPO
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+.*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- uses: actions/setup-go@v3
17+
with:
18+
go-version: 1.17
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v1
22+
23+
- name: Login to docker hub
24+
uses: docker/login-action@v1
25+
with:
26+
registry: docker.io
27+
username: ${{ secrets.DOCKER_USERNAME }}
28+
password: ${{ secrets.DOCKER_PASSWORD }}
29+
30+
- name: build & publish images
31+
run: |
32+
REGISTRY=docker.io/k8scloudprovider ARCHS='amd64 arm arm64 ppc64le s390x' GOOS=linux VERSION=${{ github.event.release.tag_name }} make upload-images
33+
34+
- name: Create Release
35+
id: create_release
36+
uses: actions/create-release@v1
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
with:
40+
tag_name: ${{ github.ref }}
41+
release_name: Release ${{ github.ref }}
42+
body: |
43+
todo
44+
draft: true
45+
prerelease: false

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ manila-csi-plugin: work $(SOURCES)
122122
# Remove this individual go build target, once we remove
123123
# image-controller-manager below.
124124
openstack-cloud-controller-manager: work $(SOURCES)
125-
CGO_ENABLED=0 GOOS=$(GOOS) go build \
125+
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build \
126126
-ldflags $(LDFLAGS) \
127127
-o openstack-cloud-controller-manager-$(ARCH) \
128128
cmd/openstack-cloud-controller-manager/main.go
@@ -303,7 +303,7 @@ version:
303303
build-cross: work
304304
ifndef HAS_GOX
305305
echo "installing gox"
306-
go get -u github.com/mitchellh/gox
306+
go install github.com/mitchellh/gox
307307
endif
308308
CGO_ENABLED=0 gox -parallel=$(GOX_PARALLEL) -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(GOX_LDFLAGS)' $(GIT_HOST)/$(BASE_DIR)/cmd/openstack-cloud-controller-manager/
309309
CGO_ENABLED=0 gox -parallel=$(GOX_PARALLEL) -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(GOX_LDFLAGS)' $(GIT_HOST)/$(BASE_DIR)/cmd/cinder-csi-plugin/

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ require (
8282
github.com/mailru/easyjson v0.7.6 // indirect
8383
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
8484
github.com/mgutz/str v1.2.0 // indirect
85+
github.com/mitchellh/gox v1.0.1 // indirect
86+
github.com/mitchellh/iochan v1.0.0 // indirect
8587
github.com/moby/spdystream v0.2.0 // indirect
8688
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
8789
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdv
368368
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
369369
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
370370
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
371+
github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
371372
github.com/hashicorp/go-version v1.4.0 h1:aAQzgqIrRKRa7w75CKpbBxYsmUoPjzVm1W59ca1L0J4=
372373
github.com/hashicorp/go-version v1.4.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
373374
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
@@ -466,6 +467,9 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk
466467
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
467468
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
468469
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
470+
github.com/mitchellh/gox v1.0.1 h1:x0jD3dcHk9a9xPSDN6YEL4xL6Qz0dvNYm8yZqui5chI=
471+
github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4=
472+
github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY=
469473
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
470474
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
471475
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=

release-procedure.md

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,15 @@ $ git fetch upstream
1515
$ git checkout -b release-X.Y upstream/release-X.Y
1616
```
1717

18-
2. Sign tag and push to upstream repo. You will need your GPG pass phrase. Check if you have a key using `gpg --list-secret-keys --keyid-format LONG`
18+
2. Make tag and push to upstream repo.
1919

2020
```
21-
$ git tag -s -m "Release for cloud-provider-openstack to support Kubernetes release x" vX.Y.Z
21+
$ git tag -m "Release for cloud-provider-openstack to support Kubernetes release x" vX.Y.Z
2222
$ git push upstream vX.Y.Z
2323
```
24-
3. Build and push images to dockerhub. Provide `ARCHS` if needs to push only for specific types of architecture (for example `ARCHS='arm64 amd64'` or `ARCHS='amd64'`).
25-
Don't need to provide `DOCKER_USERNAME` and `DOCKER_PASSWORD` if you already logged in.
2624

27-
```
28-
GOOS=linux DOCKER_USERNAME=user DOCKER_PASSWORD=my_password REGISTRY=docker.io/k8scloudprovider VERSION=vX.Y.Z make upload-images
29-
```
25+
3. Github Actions will make the new docker images and make new draft release to repository.
3026

3127
4. Update manifests with new release images, create a PR against release branch to update.
3228

33-
5. Create entry in GitHub
34-
```
35-
https://github.com/kubernetes/cloud-provider-openstack/releases
36-
```
37-
Click on "Draft a new release", fill out the tag, title and description field and click on "Publish release"
38-
39-
4. Sign the tarball with your key and upload vX.Y.Z.tar.gz.asc and vX.Y.Z.zip.asc
40-
41-
```
42-
gpg --armor --detach-sign vX.Y.Z.tar.gz
43-
gpg --armor --detach-sign vX.Y.Z.zip
44-
```
45-
46-
6 Make the binaries, sign them and upload them
47-
48-
```
49-
VERSION=vX.Y.Z make dist
50-
cd _dist
51-
find . -name "*.tar.gz" -exec gpg --armor --detach-sign {} \;
52-
find . -name "*.zip" -exec gpg --armor --detach-sign {} \;
53-
```
29+
5. Make release notes and publish the release.

0 commit comments

Comments
 (0)