-
Notifications
You must be signed in to change notification settings - Fork 15
91 lines (91 loc) · 3.52 KB
/
release-images.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: release
on:
push:
tags:
- 'v*'
env:
tag: ${GITHUB_REF#refs/tags/v}
prerelease: ${{ contains(github.ref, '-') }}
jobs:
sonobuoy:
name: Run sonobuoy
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.NECO_TEST_SERVICE_ACCOUNT }}
- uses: google-github-actions/setup-gcloud@v1
- name: Set GCP instance name
run: echo "INSTANCE_NAME=cke-${{ matrix.suite }}-${{ github.run_number }}-$(TZ=Asia/Tokyo date +%H%M%S)" >> $GITHUB_ENV
- name: Run sonobuoy
run: |
if [ ${{ github.event_name }} = "pull_request" ]; then
GITHUB_SHA=$(cat ${GITHUB_EVENT_PATH} | jq -r '.pull_request.head.sha')
fi
./bin/run-sonobuoy.sh
timeout-minutes: 240
- name: Check failures
run: |
grep -F 'no tests failed for plugin "e2e" in tarball' /tmp/e2e-check.log
- name: Upload sonobuoy test result
uses: actions/upload-artifact@v3
with:
name: sonobuoy-test
path: /tmp/sonobuoy.tar.gz
retention-days: 1
release-cke-image:
name: Release CKE Image
needs: sonobuoy
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- run: make install GOBIN=$(pwd)/docker
- run: docker build -t quay.io/cybozu/cke:latest ./docker
- name: Push docker image to Quay.io
run: |
echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USER }} --password-stdin quay.io
echo "pushing CKE image ..."
docker tag quay.io/cybozu/cke:latest quay.io/cybozu/cke:${{ env.tag }}
docker push quay.io/cybozu/cke:${{ env.tag }}
if ${{ env.prerelease }} ; then
echo ===== Skip pushing branch tags for pre-release ${{ env.tag }} =====
exit 0
fi
BRANCH=$(echo ${{ env.tag }} | cut -d "." -f 1-2)
docker tag quay.io/cybozu/cke:latest quay.io/cybozu/cke:$BRANCH
docker push quay.io/cybozu/cke:$BRANCH
release-github:
name: Release on GitHub
runs-on: ubuntu-22.04
container:
image: quay.io/cybozu/golang:1.20-jammy
needs: release-cke-image
steps:
- uses: actions/checkout@v3
- name: Download sonobuoy test
uses: actions/download-artifact@v3
with:
name: sonobuoy-test
- name: Prepare files
run: |
mkdir /tmp/upload
cp ./sonobuoy.tar.gz /tmp/upload
tar xzf ./sonobuoy.tar.gz -C /tmp/upload --strip-components=4 plugins/e2e/results/global/e2e.log plugins/e2e/results/global/junit_01.xml
sed "s/vX\.Y\.Z/v${{ env.tag }}/" sonobuoy/README.md > /tmp/upload/README.md
sed "s/vX\.Y\.Z/v${{ env.tag }}/" sonobuoy/PRODUCT.yaml > /tmp/upload/PRODUCT.yaml
GOBIN=/tmp/upload CGO_ENABLED=0 go install -buildvcs=false ./pkg/cke ./pkg/ckecli
- name: Create release
run: |
OWNER=$(echo ${{ github.repository }} | cut -d '/' -f 1)
REPOSITORY=$(echo ${{ github.repository }} | cut -d '/' -f 2)
if ${{ env.prerelease }}; then
PRERELEASE="-prerelease"
fi
ghr -t ${{ secrets.GITHUB_TOKEN }} -u ${OWNER} -r ${REPOSITORY} -n v${{ env.tag }} ${PRERELEASE} -b "See [CHANGELOG.md](./CHANGELOG.md) for details." v${{ env.tag }} /tmp/upload/