Skip to content

Commit aecee0e

Browse files
feat: refactor and add Triglav as end-to-end test orchestrator (#117)
* feat: add Triglav as end-to-end test orchestrator * fix: update Python command to use python3 in Dockerfile and entrypoint script * feat: add non-git entrypoint test and improve file change detection * feat: add image mode copy test for Terraform variable management --------- Co-authored-by: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com>
1 parent 26f504b commit aecee0e

12 files changed

Lines changed: 373 additions & 94 deletions

.github/workflows/auto-pull-request-create.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ on:
99
- dependabot/**
1010

1111
permissions:
12-
contents: read
12+
contents: write
1313
packages: write
1414
pull-requests: write
15+
issues: write
1516

1617
jobs:
1718
call:

.github/workflows/auto-release-create.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ on:
2121
permissions:
2222
contents: write
2323
packages: write
24-
pull-requests: read
24+
pull-requests: write
25+
issues: write
2526

2627
jobs:
2728
call:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: (Manual) E2E Validate
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
mode:
7+
description: Validation mode
8+
required: false
9+
default: image
10+
type: choice
11+
options:
12+
- image
13+
- ref
14+
image_tag:
15+
description: Image tag used when mode=image (for example v1.2.3-test or v1.2.3-rc)
16+
required: false
17+
default: ""
18+
type: string
19+
20+
permissions:
21+
contents: read
22+
packages: read
23+
24+
jobs:
25+
e2e:
26+
uses: devops-infra/triglav/.github/workflows/e2e-action-terraform-copy-vars.yml@master
27+
with:
28+
mode: ${{ inputs.mode }}
29+
image_tag: ${{ inputs.image_tag }}
30+
secrets: inherit

.github/workflows/manual-release-branch-prepare.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ permissions:
2727
contents: write
2828
packages: write
2929
pull-requests: write
30+
issues: write
3031

3132
jobs:
3233
call:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ RUN chmod +x /entrypoint.sh ;\
2020
rm -rf /var/lib/apt/lists/*
2121

2222
# Finish up
23-
CMD ["python", "--version"]
23+
CMD ["python3", "--version"]
2424
WORKDIR /github/workspace
2525
ENTRYPOINT ["/entrypoint.sh"]

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
runs-on: ubuntu-latest
7777
steps:
7878
- name: Checkout repository
79-
uses: actions/checkout@v5
79+
uses: actions/checkout@v6
8080
8181
- name: Fail on different variables' definitions
8282
uses: devops-infra/action-terraform-copy-vars@v1.0.2
@@ -95,7 +95,7 @@ jobs:
9595
runs-on: ubuntu-latest
9696
steps:
9797
- name: Checkout repository
98-
uses: actions/checkout@v5
98+
uses: actions/checkout@v6
9999
100100
- name: Update Terraform variables
101101
uses: devops-infra/action-terraform-copy-vars@v1.0.2
@@ -125,7 +125,7 @@ jobs:
125125
terraform-copy-vars:
126126
runs-on: ubuntu-latest
127127
steps:
128-
- uses: actions/checkout@v5
128+
- uses: actions/checkout@v6
129129
130130
- uses: devops-infra/action-terraform-copy-vars@v1.0.2
131131
id: pin-patch
@@ -152,6 +152,29 @@ If you have any questions or need help, please:
152152
- 📝 Create an [issue](https://github.com/devops-infra/action-terraform-copy-vars/issues)
153153
- 🌟 Star this repository if you find it useful!
154154

155+
## 🧪 End-to-End Validation
156+
Use the manual workflow `.github/workflows/manual-e2e-validate.yml` to validate this action against the centralized E2E repository.
157+
158+
- `mode=image` validates a published image tag (recommended for `-test` and `-rc` release checks).
159+
- `mode=ref` validates ref-oriented E2E paths against stable pinned action refs.
160+
161+
CI/CD automation also runs these E2E checks automatically:
162+
163+
- Pull requests: E2E validation runs through reusable org workflows.
164+
- Release branch prepare: E2E validation runs against release candidate artifacts (`-rc`).
165+
- Release create: E2E validation runs against production release artifacts.
166+
167+
Example trigger inputs:
168+
169+
```text
170+
mode=ref
171+
```
172+
173+
```text
174+
mode=image
175+
image_tag=v1.2.3-test
176+
```
177+
155178
## Forking
156179
To publish images from a fork, set these variables so Task uses your registry identities:
157180
`DOCKER_USERNAME`, `DOCKER_ORG_NAME`, `GITHUB_USERNAME`, `GITHUB_ORG_NAME`.

Taskfile.cicd.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ tasks:
1010
cmds:
1111
- pre-commit run --all-files
1212

13+
test:
14+
desc: Run repository tests
15+
cmds:
16+
- task: test:entrypoint:non-git
17+
- task: test:image-mode:copy
18+
19+
test:entrypoint:non-git:
20+
desc: Validate entrypoint execution outside git repository
21+
cmds:
22+
- task: scripts:test:entrypoint:non-git
23+
24+
test:image-mode:copy:
25+
desc: Validate image mode appends missing variables
26+
cmds:
27+
- task: scripts:test:image-mode:copy
28+
1329
pre-commit:install:
1430
desc: Install pre-commit hooks
1531
cmds:

Taskfile.scripts.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,38 @@ tasks:
7474
exit $rc
7575
fi
7676
77+
test:entrypoint:non-git:
78+
desc: Validate entrypoint execution outside git repository
79+
cmds:
80+
- |
81+
echo "▶️ Running non-git entrypoint test..."
82+
set +e
83+
./tests/scripts/entrypoint-non-git-test.sh
84+
rc=$?
85+
set -e
86+
if [ "$rc" -eq 0 ]; then
87+
echo "✅ non-git entrypoint test passed"
88+
else
89+
echo "❌ non-git entrypoint test failed"
90+
exit $rc
91+
fi
92+
93+
test:image-mode:copy:
94+
desc: Validate image mode appends missing variables
95+
cmds:
96+
- |
97+
echo "▶️ Running image-mode copy test..."
98+
set +e
99+
./tests/scripts/image-mode-copy-test.sh
100+
rc=$?
101+
set -e
102+
if [ "$rc" -eq 0 ]; then
103+
echo "✅ image-mode copy test passed"
104+
else
105+
echo "❌ image-mode copy test failed"
106+
exit $rc
107+
fi
108+
77109
dependency:update:
78110
desc: 'No-op: no dedicated dependency updater configured for this profile'
79111
cmds:

entrypoint.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ set -e
66
RET_CODE=0
77

88
# Run main action
9-
python /terraform-copy-vars.py
9+
python3 /terraform-copy-vars.py
1010
RET_CODE=$?
1111

1212
# List of changed files
13-
FILES_CHANGED=$(git diff --staged --name-status)
13+
FILES_CHANGED=""
14+
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
15+
FILES_CHANGED=$(git diff --cached --name-status 2>/dev/null || true)
16+
if [[ -z ${FILES_CHANGED} ]]; then
17+
FILES_CHANGED=$(git diff --name-status 2>/dev/null || true)
18+
fi
19+
fi
1420

1521
# Info about changed files
1622
if [[ -n ${FILES_CHANGED} ]]; then

0 commit comments

Comments
 (0)