Skip to content

Commit c8840d7

Browse files
committed
ghactions include determine image tag
ai-assisted=yes TNZ-37899
1 parent e785346 commit c8840d7

2 files changed

Lines changed: 142 additions & 134 deletions

File tree

.github/gh-config-template/gh_template.yml

Lines changed: 85 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,32 @@
33
name: unit-integration-tests
44

55
on:
6-
pull_request_target:
7-
types:
8-
- labeled
6+
pull_request:
7+
types: [opened, synchronize, reopened, labeled]
8+
branches:
9+
- develop
10+
paths:
11+
- 'src/**'
12+
- 'packages/**'
13+
- 'jobs/**'
14+
- 'config/**'
15+
- 'scripts/**'
16+
- '.github/workflows/**'
17+
- '.github/helpers/**'
918

1019
env:
1120
MAPPING: |
12-
build_nats_server=src/code.cloudfoundry.org/vendor/github.com/nats-io/nats-server/v2
21+
build_nats_server=src/code.cloudfoundry.org/vendor/github.com/nats-io/nats-server/v2
1322
FLAGS: |
14-
--keep-going
15-
--trace
16-
-r
17-
--fail-on-pending
18-
--randomize-all
19-
--nodes=7
20-
--race
21-
--timeout 30m
22-
--flake-attempts 2
23+
--keep-going
24+
--trace
25+
-r
26+
--fail-on-pending
27+
--randomize-all
28+
--nodes=7
29+
--race
30+
--timeout 30m
31+
--flake-attempts 2
2332
RUN_AS: root
2433
VERIFICATIONS: |
2534
verify_go repo/$DIR
@@ -28,22 +37,21 @@ env:
2837
verify_govet repo/$DIR
2938
verify_staticcheck repo/$DIR
3039
FUNCTIONS: ""
31-
DB: ""
40+
DB: ""
3241

3342
jobs:
3443
repo-clone:
35-
if: github.event.label.name == 'ready-to-run'
3644
runs-on: ubuntu-latest
3745
steps:
3846
- name: cf-networking-release-repo
39-
uses: actions/checkout@v4
47+
uses: actions/checkout@v4.3.1
4048
with:
4149
repository: ${{ github.event.pull_request.head.repo.full_name }}
4250
ref: ${{ github.event.pull_request.head.ref }}
4351
submodules: recursive
4452
path: repo
4553
- name: Check out wg-appruntime code
46-
uses: actions/checkout@v4
54+
uses: actions/checkout@v4.3.1
4755
with:
4856
repository: cloudfoundry/wg-app-platform-runtime-ci
4957
path: ci
@@ -55,47 +63,57 @@ jobs:
5563
uses: actions/upload-artifact@v4
5664
with:
5765
name: repo
58-
path: |
59-
repo-artifact.tar.gz
60-
ci-artifact.tar.gz
66+
path: |
67+
repo-artifact.tar.gz
68+
ci-artifact.tar.gz
69+
determine-image-tag:
70+
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
71+
runs-on: ubuntu-latest
72+
outputs:
73+
go_version: ${{ steps.get-version.outputs.go_version }}
74+
steps:
75+
- name: checkout ci repo
76+
uses: actions/checkout@v4.3.1
77+
with:
78+
repository: cloudfoundry/wg-app-platform-runtime-ci
79+
sparse-checkout: go-version.json
80+
sparse-checkout-cone-mode: false
81+
- name: get-version
82+
id: get-version
83+
run: |
84+
version=$(jq -r '.releases["cf-networking"] // .default' go-version.json)
85+
echo "go_version=${version}" >> "$GITHUB_OUTPUT"
6186
template-tests:
6287
runs-on: ubuntu-latest
63-
needs: repo-clone
64-
container:
65-
image: us-central1-docker.pkg.dev/app-runtime-platform-wg/dockerhub-mirror/cloudfoundry/tas-runtime-build
66-
credentials:
67-
username: _json_key
68-
password: ${{ secrets.GCP_SERVICE_ACCOUNT_TAS_RUNTIME_BUILD_IMAGE_READER }}
88+
needs: [repo-clone]
89+
container: cloudfoundry/tas-runtime-build:latest
6990
steps:
7091
- name: Download artifact
7192
uses: actions/download-artifact@v4
7293
with:
7394
name: repo
74-
- run: "tar -xzvf repo-artifact.tar.gz\ntar -xzvf ci-artifact.tar.gz\n"
95+
- run: |
96+
tar -xzvf repo-artifact.tar.gz
97+
tar -xzvf ci-artifact.tar.gz
7598
- name: template-tests
7699
run: |
77100
"${GITHUB_WORKSPACE}"/ci/shared/tasks/run-tests-templates/task.bash
78101
test-on-mysql-5-7:
102+
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
79103
runs-on: ubuntu-latest
104+
needs: [repo-clone, determine-image-tag]
80105
env:
81-
BUILD_IMAGE: us-central1-docker.pkg.dev/app-runtime-platform-wg/dockerhub-mirror/cloudfoundry/tas-runtime-mysql-5.7
82-
needs: repo-clone
106+
BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-5.7:${{ needs.determine-image-tag.outputs.go_version }}
83107
steps:
84108
- name: Download artifact
85109
uses: actions/download-artifact@v4
86110
with:
87-
name: repo
88-
- name: Authenticate with GCP
89-
uses: google-github-actions/auth@v2
90-
with:
91-
credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT_TAS_RUNTIME_BUILD_IMAGE_READER }}'
92-
- name: Configure Docker to use gcloud
93-
run: |
94-
gcloud auth configure-docker us-central1-docker.pkg.dev
95-
docker pull "$BUILD_IMAGE"
111+
name: repo
96112
- run: |
97-
tar -xzvf repo-artifact.tar.gz
98-
tar -xzvf ci-artifact.tar.gz
113+
tar -xzvf repo-artifact.tar.gz
114+
tar -xzvf ci-artifact.tar.gz
115+
- name: pull image
116+
run: docker pull "$BUILD_IMAGE"
99117
#@ for package in helpers.packages_with_configure_db(data.values.internal_repos):
100118
- name: #@ "{}-mysql".format(package.name)
101119
env:
@@ -105,27 +123,21 @@ jobs:
105123
./repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
106124
#@ end
107125
test-repos-withoutdb:
126+
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
108127
runs-on: ubuntu-latest
109-
needs: repo-clone
128+
needs: [repo-clone, determine-image-tag]
110129
env:
111-
BUILD_IMAGE: us-central1-docker.pkg.dev/app-runtime-platform-wg/dockerhub-mirror/cloudfoundry/tas-runtime-build
130+
BUILD_IMAGE: cloudfoundry/tas-runtime-build:${{ needs.determine-image-tag.outputs.go_version }}
112131
steps:
113132
- name: Download artifact
114133
uses: actions/download-artifact@v4
115134
with:
116-
name: repo
117-
- name: Authenticate with GCP
118-
uses: google-github-actions/auth@v2
119-
with:
120-
credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT_TAS_RUNTIME_BUILD_IMAGE_READER }}'
121-
- name: Configure Docker to use gcloud
122-
run: |
123-
gcloud auth configure-docker us-central1-docker.pkg.dev
124-
docker pull "$BUILD_IMAGE"
125-
135+
name: repo
126136
- run: |
127-
tar -xzvf repo-artifact.tar.gz
128-
tar -xzvf ci-artifact.tar.gz
137+
tar -xzvf repo-artifact.tar.gz
138+
tar -xzvf ci-artifact.tar.gz
139+
- name: pull image
140+
run: docker pull "$BUILD_IMAGE"
129141
#@ for package in helpers.packages_without_configure_db(data.values.internal_repos):
130142
- name: #@ package.name
131143
env:
@@ -135,60 +147,50 @@ jobs:
135147
./repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
136148
#@ end
137149
test-on-postgres:
150+
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
138151
runs-on: ubuntu-latest
139-
needs: repo-clone
152+
needs: [repo-clone, determine-image-tag]
140153
env:
141-
BUILD_IMAGE: us-central1-docker.pkg.dev/app-runtime-platform-wg/dockerhub-mirror/cloudfoundry/tas-runtime-postgres
154+
BUILD_IMAGE: cloudfoundry/tas-runtime-postgres:${{ needs.determine-image-tag.outputs.go_version }}
142155
steps:
143156
- name: Download artifact
144157
uses: actions/download-artifact@v4
145158
with:
146-
name: repo
147-
- name: Authenticate with GCP
148-
uses: google-github-actions/auth@v2
149-
with:
150-
credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT_TAS_RUNTIME_BUILD_IMAGE_READER }}'
151-
- name: Configure Docker to use gcloud
152-
run: |
153-
gcloud auth configure-docker us-central1-docker.pkg.dev
154-
docker pull "$BUILD_IMAGE"
159+
name: repo
155160
- run: |
156-
tar -xzvf repo-artifact.tar.gz
157-
tar -xzvf ci-artifact.tar.gz
161+
tar -xzvf repo-artifact.tar.gz
162+
tar -xzvf ci-artifact.tar.gz
163+
- name: pull image
164+
run: docker pull "$BUILD_IMAGE"
158165
#@ for package in helpers.packages_with_configure_db(data.values.internal_repos):
159-
- name: #@ "{}-mysql".format(package.name)
166+
- name: #@ "{}-postgres".format(package.name)
160167
env:
161168
DIR: #@ "src/code.cloudfoundry.org/{}".format(package.name)
162169
DB: postgres
163170
run: |
164171
./repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
165-
#@ end
172+
#@ end
166173
test-on-mysql-8-0:
174+
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
167175
runs-on: ubuntu-latest
168-
needs: repo-clone
176+
needs: [repo-clone, determine-image-tag]
169177
env:
170-
BUILD_IMAGE: us-central1-docker.pkg.dev/app-runtime-platform-wg/dockerhub-mirror/cloudfoundry/tas-runtime-mysql-8.0
178+
BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-8.0:${{ needs.determine-image-tag.outputs.go_version }}
171179
steps:
172180
- name: Download artifact
173181
uses: actions/download-artifact@v4
174182
with:
175-
name: repo
176-
- name: Authenticate with GCP
177-
uses: google-github-actions/auth@v2
178-
with:
179-
credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT_TAS_RUNTIME_BUILD_IMAGE_READER }}'
180-
- name: Configure Docker to use gcloud
181-
run: |
182-
gcloud auth configure-docker us-central1-docker.pkg.dev
183-
docker pull "$BUILD_IMAGE"
183+
name: repo
184184
- run: |
185-
tar -xzvf repo-artifact.tar.gz
186-
tar -xzvf ci-artifact.tar.gz
185+
tar -xzvf repo-artifact.tar.gz
186+
tar -xzvf ci-artifact.tar.gz
187+
- name: pull image
188+
run: docker pull "$BUILD_IMAGE"
187189
#@ for package in helpers.packages_with_configure_db(data.values.internal_repos):
188190
- name: #@ "{}-mysql".format(package.name)
189191
env:
190192
DIR: #@ "src/code.cloudfoundry.org/{}".format(package.name)
191193
DB: mysql
192194
run: |
193195
./repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
194-
#@ end
196+
#@ end

0 commit comments

Comments
 (0)