Skip to content

Commit 377f71f

Browse files
committed
Be first user of workload image and test workflow changes
1 parent 81aa23a commit 377f71f

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

.github/workflows/main.yaml

+27-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,33 @@ jobs:
1818
id-token: write
1919
steps:
2020
- uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" # ratchet:actions/checkout@v3
21+
- name: Determine what to do
22+
id: changed-files
23+
shell: python
24+
env:
25+
RESOURCES: nais/nais.yaml,nais/topic.yaml
26+
run: |
27+
import os
28+
import glob
29+
from itertools import chain
30+
import subprocess
31+
32+
changed_files=set(subprocess.run(["git", "diff", "--name-only", "${{ github.event.before }}", "${{ github.event.after }}"], capture_output=True, text=True).stdout.splitlines())
33+
resource_files = set(chain(*(glob.glob(f) for f in os.getenv("RESOURCES", "").split(","))))
34+
if changed_files < resource_files:
35+
print("Only resources have been changed")
36+
output = "only-resources"
37+
elif resource_files.isdisjoint(changed_files):
38+
print("No resources have been changed")
39+
output = "non-resources"
40+
else:
41+
output = "all"
42+
43+
with open(os.getenv("GITHUB_OUTPUT"), "a") as f:
44+
f.write(f"changed={output}\n")
2145
- uses: nais/platform-build-push-sign@main
2246
id: build-push-sign
47+
if: steps.changed-files.outputs.changed != 'only-resources'
2348
with:
2449
name: karapace
2550
google_service_account: gh-karapace
@@ -34,9 +59,9 @@ jobs:
3459
needs: build
3560
steps:
3661
- uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" # ratchet:actions/checkout@v2
37-
- uses: nais/deploy/actions/deploy@0bca2c7e607d30fd757a2a23fb7d07b3ff96d540 # ratchet:nais/deploy/actions/deploy@v1
62+
- uses: nais/deploy/actions/deploy@v2
3863
env:
3964
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
4065
CLUSTER: dev-gcp
4166
RESOURCE: nais/nais.yaml,nais/topic.yaml
42-
VAR: image=${{ needs.build.outputs.image }}
67+
WORKLOAD_IMAGE: ${{ needs.build.outputs.image }}

nais/nais.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
name: "karapace-test"
55
namespace: "nais"
66
spec:
7-
image: {{image}}
87
liveness:
98
path: "/"
109
startup:

0 commit comments

Comments
 (0)