Skip to content

Commit 4cbf57b

Browse files
Merge pull request #356 from propeller-heads/cluster-test/dc/separate-build-workflow
fix: Separate build + push integration test workflow from main workflow
2 parents 4a93034 + 7d02cd8 commit 4cbf57b

File tree

2 files changed

+85
-6
lines changed

2 files changed

+85
-6
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build and Push Integration Test
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag_suffix:
7+
description: 'Optional tag suffix (defaults to commit hash)'
8+
required: false
9+
type: string
10+
base_tag:
11+
description: 'Base tag to use (defaults to latest release tag)'
12+
required: false
13+
type: string
14+
workflow_call:
15+
inputs:
16+
tag_suffix:
17+
description: 'Optional tag suffix (defaults to commit hash)'
18+
required: false
19+
type: string
20+
base_tag:
21+
description: 'Base tag to use (defaults to latest release tag)'
22+
required: false
23+
type: string
24+
secrets:
25+
app_id:
26+
required: true
27+
app_private_key:
28+
required: true
29+
role_to_assume:
30+
required: true
31+
aws_region:
32+
required: true
33+
repository_url:
34+
required: true
35+
domain_owner:
36+
required: true
37+
38+
jobs:
39+
generate-tag:
40+
runs-on: ubuntu-latest
41+
outputs:
42+
image_tag: ${{ steps.tag.outputs.image_tag }}
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
with:
47+
fetch-depth: 0
48+
49+
- name: Get commit hash
50+
id: commit
51+
run: echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
52+
53+
- name: Get latest release tag
54+
id: latest_tag
55+
run: |
56+
# Get the latest release tag, fallback to 'latest' if none found
57+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "latest")
58+
echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
59+
60+
- name: Generate image tag
61+
id: tag
62+
run: |
63+
BASE_TAG="${{ inputs.base_tag || steps.latest_tag.outputs.tag }}"
64+
TAG_SUFFIX="${{ inputs.tag_suffix || steps.commit.outputs.hash }}"
65+
IMAGE_TAG="${BASE_TAG}-${TAG_SUFFIX}"
66+
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
67+
68+
build-and-push-integration-test:
69+
needs: generate-tag
70+
uses: propeller-heads/ci-cd-templates/.github/workflows/build-and-push-docker-image.yaml@main
71+
permissions:
72+
id-token: write
73+
contents: read
74+
with:
75+
image_tag: ${{ needs.generate-tag.outputs.image_tag }}
76+
image_name: tycho-integration-test
77+
secrets:
78+
app_id: ${{ secrets.app_id }}
79+
app_private_key: ${{ secrets.app_private_key }}
80+
role_to_assume: ${{ secrets.role_to_assume }}
81+
aws_region: ${{ secrets.aws_region }}
82+
repository_url: ${{ secrets.repository_url }}
83+
domain_owner: ${{ secrets.domain_owner }}

.github/workflows/v2-main-workflow.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,9 @@ jobs:
4444
build-and-push-integration-test:
4545
needs:
4646
- release
47-
uses: propeller-heads/ci-cd-templates/.github/workflows/build-and-push-docker-image.yaml@main
48-
permissions:
49-
id-token: write
50-
contents: read
47+
uses: ./.github/workflows/build-and-push-integration-test.yaml
5148
with:
52-
image_tag: ${{ needs.release.outputs.next_release_version }}
53-
image_name: tycho-integration-test
49+
base_tag: ${{ needs.release.outputs.next_release_version }}
5450
secrets:
5551
app_id: ${{ secrets.APP_ID }}
5652
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}

0 commit comments

Comments
 (0)