Skip to content

Commit 3c04aba

Browse files
woscwitsch
andauthored
feat(nightwatch): read image name from project kustomization (#70)
Co-authored-by: Andreas Zeidler <andreas.zeidler@zeit.de>
1 parent dcc81c5 commit 3c04aba

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

.github/workflows/nightwatch-build.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ name: Build nightwatch tests
2020
# secrets: inherit
2121
# with:
2222
# versions: smoketest/k8s/versions
23+
# k8s_base: smoketest/k8s
2324
# project: MYPROJECT
2425
# environment: staging
2526
# gke_cluster: my-cluster
@@ -31,10 +32,11 @@ on:
3132
required: false
3233
type: string
3334
environment:
34-
required: true
35+
required: false
3536
type: string
37+
default : staging
3638
gke_cluster:
37-
required: true
39+
required: false
3840
type: string
3941
args:
4042
required: false
@@ -46,8 +48,14 @@ on:
4648
"secretRef": {"name": "nightwatch-secrets", "optional": true}}]}
4749
]'
4850
versions:
51+
description: directory in which to run `kustomize edit set-image`
52+
required: false
53+
type: string
54+
k8s_base:
55+
description: directory that contains a k8s manifest containing the final image name
4956
required: false
5057
type: string
58+
default: k8s
5159
outputs:
5260
tag:
5361
description: "Tag of built 'nightwatch' image"
@@ -78,7 +86,7 @@ jobs:
7886
default="${repository##*/}"
7987
project="${input:-$default}"
8088
echo "project=$project" >> "$GITHUB_ENV"
81-
echo "image=${{ vars.GAR_DOCKER_REGISTRY }}/$project-nightwatch" >> "$GITHUB_ENV"
89+
echo "image=$( kustomize build ${{inputs.k8s_base}}/${{ inputs.environment }} | awk -F: '/image: .*nightwatch/ { print $2 }' | tr -d ' ' )" >> "$GITHUB_ENV"
8290
echo "tag=${{ steps.tag.outputs.tag }}" >> "$GITHUB_ENV"
8391
- name: Setup auth
8492
uses: ZeitOnline/gh-action-baseproject@v0
@@ -87,7 +95,7 @@ jobs:
8795
project_name: ${{ env.project }}
8896
environment: ${{ inputs.environment }}
8997
gke_auth: true
90-
gke_cluster: ${{ inputs.gke_cluster }}
98+
gke_cluster: ${{ inputs.gke_cluster || inputs.environment }}
9199
google_auth: true
92100
gar_docker_auth: true
93101
vault_export_token: true

0 commit comments

Comments
 (0)