Skip to content

Commit 10a86a0

Browse files
geroplona-agent
andauthored
Convert delete-preview action from Docker to composite (#21183)
* Convert delete-preview action from Docker to composite Fix permission issues on GitHub-hosted runners by converting the delete-preview action from a Docker container action to a composite action. This resolves credential access problems where GOOGLE_APPLICATION_CREDENTIALS set by setup-environment was not accessible inside the Docker container. Changes: - Convert metadata.yml from 'using: docker' to 'using: composite' - Move commands from entrypoint.sh to composite action steps - Remove Dockerfile and entrypoint.sh (no longer needed) - Preserve all functionality: previewctl install and delete-preview The composite action runs directly on the runner, allowing proper access to GCP credentials and environment variables set by the setup-environment action. Co-authored-by: Ona <[email protected]> * Add container to delete job for leeway availability The composite action requires leeway to be available, which is only present in the dev-environment container. Run the entire delete job in the container to provide leeway and other required tools. This matches the pattern used in preview-env-gc.yml for the stale job. Co-authored-by: Ona <[email protected]> * Fix duplicate workflow runs on PR push Remove push trigger and use pull_request with synchronize type to prevent duplicate workflow runs when pushing to a PR branch. Previously, both push and pull_request events fired when pushing to a PR branch, causing the workflow to run twice in parallel. Changes: - Remove push trigger (branches-ignore: main) - Add synchronize and reopened to pull_request types - Keep opened and edited for PR creation and description updates The synchronize event fires when commits are pushed to a PR branch, replacing the need for the push trigger. Co-authored-by: Ona <[email protected]> * Add comment explaining pull_request trigger types Document the purpose of each pull_request event type to clarify when the workflow runs and why each type is needed. Co-authored-by: Ona <[email protected]> --------- Co-authored-by: Ona <[email protected]>
1 parent e6bd727 commit 10a86a0

File tree

6 files changed

+34
-37
lines changed

6 files changed

+34
-37
lines changed

.github/actions/delete-preview/Dockerfile

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Delete preview environment"
2+
description: "Deletes a preview environment"
3+
inputs:
4+
name:
5+
description: "The name of the preview environment"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Install previewctl
11+
shell: bash
12+
run: |
13+
set -euo pipefail
14+
leeway run dev/preview/previewctl:install
15+
16+
- name: Delete preview environment
17+
shell: bash
18+
run: |
19+
set -euo pipefail
20+
21+
export TF_INPUT=0
22+
export TF_IN_AUTOMATION=true
23+
TF_VAR_preview_name="$(previewctl get-name --branch "${{ inputs.name }}")"
24+
export TF_VAR_preview_name
25+
26+
leeway run dev/preview:delete-preview

.github/actions/delete-preview/entrypoint.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/actions/delete-preview/metadata.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/workflows/branch-build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ permissions:
77
packages: read
88
on:
99
pull_request:
10-
types: [ opened, edited ]
11-
push:
12-
branches-ignore:
13-
- main
10+
# opened: PR is created
11+
# synchronize: Commits are pushed to the PR branch
12+
# reopened: PR is reopened
13+
# edited: PR description/title is edited (for checkbox updates like [x] /werft with-preview)
14+
types: [ opened, synchronize, reopened, edited ]
1415
workflow_dispatch:
1516
inputs:
1617
recreate_vm:

.github/workflows/preview-env-delete.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
delete:
1515
if: github.event.ref_type == 'branch' || github.event.inputs.name != ''
1616
runs-on: ubuntu-latest
17+
container:
18+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:main-gha.34181
19+
options: --user root
1720
steps:
1821
- uses: actions/checkout@v4
1922
- name: Setup Environment

0 commit comments

Comments
 (0)