chore: refactor pipelines (#97)

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #97
This commit is contained in:
Marcel_Henselin 2026-03-27 15:23:30 +00:00
parent 2893a11c0a
commit 7b2dfaea44
Signed by: tf-provider.git.onstackit.cloud
GPG key ID: 6D7E8A1ED8955A9C
5 changed files with 145 additions and 50 deletions

View file

@ -38,14 +38,16 @@ jobs:
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: CLEAN UP pipeline started
title: "[START] CLEAN UP pipeline"
subtitle: "${{ forgejo.repository }}"
event_title: ${{ forgejo.event_name }}
event_author: ${{ forgejo.actor }}
event_body: "Filter: ${{ inputs.res_prefix }}"
event_body: "try to remove all resources with prefix <b>${{ inputs.res_prefix }}</b>"
event_number: ${{ forgejo.run_number }}
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
- name: Clean
id: clean
uses: ./.github/actions/clean_up
with:
project_id: ${{ vars.TF_ACC_PROJECT_ID }}
@ -54,3 +56,17 @@ jobs:
service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}"
list_only: ${{ inputs.list_only }}
log_level: ${{ inputs.log_level }}
- name: Notify
if: always()
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: "[END] CLEAN UP pipeline"
subtitle: "${{ forgejo.repository }}"
event_title: ${{ forgejo.event_name }}
event_author: ${{ forgejo.actor }}
event_body: "count before cleaning: ${{ steps.clean.outputs.pre_count }} <br /> count after cleaning: ${{ steps.clean.outputs.post_count }}"
event_number: ${{ forgejo.run_number }}
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
status: ${{ steps.clean.outcome == 'success' && 'SUCCESS' || 'FAILURE' }}

View file

@ -40,19 +40,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v6
- name: set start time
id: start_time
run: |
echo "time=$(date --rfc-3339=ns)" >> ${GITHUB_ENV}
echo "start=$(date +%s%N)" >> ${GITHUB_ENV}
- name: Notify
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: Terraform Acceptance Tests started
event_title: ${{ github.event_name }}
event_author: ${{ github.actor }}
title: "[START] Terraform Acceptance Tests"
subtitle: "${{ forgejo.event_name }} on branch ${{ forgejo.ref }}"
event_title: "started: ${{ steps.start_time.outputs.time }}"
event_author: ${{ forgejo.actor }}
event_body: ${{ inputs.test_file }}
event_number: ${{ github.run_id }}
event_number: ${{ forgejo.run_number }}
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
- name: Run Test (workflow dispatch)
if: ${{ github.event_name == 'workflow_dispatch' }}
if: ${{ forgejo.event_name == 'workflow_dispatch' }}
id: manual_run
uses: ./.github/actions/acc_test
with:
@ -70,7 +77,7 @@ jobs:
test_file: ${{ inputs.test_file }}
- name: Run Test (automatic)
if: ${{ github.event_name != 'workflow_dispatch' }}
if: ${{ forgejo.event_name != 'workflow_dispatch' }}
id: automatic_run
uses: ./.github/actions/acc_test
with:
@ -84,13 +91,26 @@ jobs:
tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }}
tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
- name: set end time
id: end_time
run: |
echo "time=$(date --rfc-3339=ns)" >> ${GITHUB_ENV}
end=$(date +%s%N)
echo "end=${end}" >> ${GITHUB_ENV}
start=${{ steps.start_time.outputs.start }}
diff=$((end-start))
duration=$(printf "%s.%s" "${diff:0: -9}" "${diff: -9:3}")
echo "duration=${duration}" >> ${GITHUB_ENV}
- name: Notify
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: Terraform Acceptance Tests finished
event_title: ${{ github.event_name }}
event_author: ${{ github.actor }}
event_body: "${{ steps.automatic_run.outputs.result || steps.manual_run.outputs.result }}"
event_number: ${{ github.event.id }}
title: "[END] Terraform Acceptance Tests"
subtitle: "${{ forgejo.event_name }} on branch ${{ forgejo.ref }} with status: ${{ forgejo.event_name == 'workflow_dispatch' && steps.manual_run.outputs.status || steps.automatic_run.outputs.status }}"
event_title: "run ended: ${{ steps.end_time.outputs.time }}, duration: ${{ steps.end_time.outputs.duration }} seconds"
event_author: ${{ forgejo.actor }}
event_body: "${{ forgejo.event_name == 'workflow_dispatch' && steps.manual_run.outputs.result || steps.automatic_run.outputs.result }}"
event_number: ${{ forgejo.event.id }}
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
status: "${{ forgejo.event_name == 'workflow_dispatch' && steps.manual_run.outputs.status || steps.automatic_run.outputs.status }}"