-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (158 loc) · 4.96 KB
/
Copy pathbuild.yml
File metadata and controls
180 lines (158 loc) · 4.96 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Build
permissions: {}
on:
pull_request:
merge_group:
push:
branches:
- develop
tags:
- '*'
jobs:
Bats:
name: Shell library tests (BATS)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build test image
uses: docker/build-push-action@v7
with:
context: .
file: ./tests/Dockerfile
push: false
load: true
tags: wordpress-bats-test:${{ github.run_id }}
- name: Run BATS tests
run: docker run --rm wordpress-bats-test:${{ github.run_id }}
E2E:
name: Legacy upgrade end-to-end test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build image
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
push: false
load: true
platforms: linux/amd64
tags: wordpress-e2e-test:${{ github.run_id }}
- name: Run legacy-install upgrade regression test
run: ./tests/e2e-legacy-upgrade.sh wordpress-e2e-test:${{ github.run_id }}
Chart-Images:
name: Verify chart image references
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Install Helm
uses: azure/setup-helm@v5
- name: Verify all referenced images exist
env:
EXCLUDE_IMAGES: '^docker\.io/cloudtooling/wordpress:'
run: |
./tests/verify-chart-images.sh charts/wordpress \
mariadb.enabled=true \
memcached.enabled=true \
metrics.enabled=true \
volumePermissions.enabled=true
Container:
name: Build Container Image
runs-on: ubuntu-latest
env:
DOCKERFILE: ./Dockerfile
DOCKER_IMAGE_NAME: cloudtooling/wordpress
VERSION_FILE: config.json
steps:
- uses: actions/checkout@v7
- name: Write version vars
id: version-vars
run: |
BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
BRANCH=${GITHUB_REF_NAME#v}
APP_VERSION=$(cat $VERSION_FILE | grep version| head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | sed 's/ //g')
echo Version: $APP_VERSION
/bin/cat <<EOM >>$GITHUB_ENV
VERSION=$APP_VERSION
APP_VERSION=$APP_VERSION
BUILD_DATE=$BUILD_DATE
EOM
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ vars.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build Docker image
id: build-image
uses: docker/build-push-action@v7
with:
context: .
file: ${{env.DOCKERFILE}}
push: false
tags: |
${{env.DOCKER_IMAGE_NAME}}:latest
${{env.DOCKER_IMAGE_NAME}}:next
${{env.DOCKER_IMAGE_NAME}}:${{ github.run_id }}
${{env.DOCKER_IMAGE_NAME}}:${{ env.APP_VERSION }}
build-args: |
BUILD_DATE=${{env.BUILD_DATE}}
APP_VERSION=${{env.APP_VERSION}}
platforms: linux/amd64,linux/arm64
if: github.ref_type != 'tag'
- name: Push To Docker Hub
id: push-to-dockerhub-preview
uses: docker/build-push-action@v7
with:
context: .
file: ${{env.DOCKERFILE}}
push: true
tags: |
${{env.DOCKER_IMAGE_NAME}}:next
${{env.DOCKER_IMAGE_NAME}}:${{ github.run_id }}
build-args: |
BUILD_DATE=${{env.BUILD_DATE}}
APP_VERSION=${{env.APP_VERSION}}
platforms: linux/amd64,linux/arm64
if: github.ref_type != 'tag'
- name: Push To Docker Hub
id: push-to-dockerhub-tagged
uses: docker/build-push-action@v7
with:
context: .
file: ${{env.DOCKERFILE}}
push: true
tags: |
${{env.DOCKER_IMAGE_NAME}}:latest
${{env.DOCKER_IMAGE_NAME}}:${{ github.run_id }}
${{env.DOCKER_IMAGE_NAME}}:${{ env.APP_VERSION }}
build-args: |
BUILD_DATE=${{env.BUILD_DATE}}
APP_VERSION=${{env.BRANCH}}
platforms: linux/amd64,linux/arm64
if: github.ref_type == 'tag' || github.tag != ''
Build-results:
name: Build results
if: ${{ always() }}
runs-on: ubuntu-latest
needs:
- Bats
- E2E
- Chart-Images
- Container
steps:
- run: exit 1
# see https://stackoverflow.com/a/67532120/4907315
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
}}