Skip to content

Commit 4c2c0c4

Browse files
soumya-greenbonegreenbonebot
authored andcommitted
Add: dry-run to test
1 parent d5746eb commit 4c2c0c4

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

agents/action.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ inputs:
88
staging_version:
99
description: 'Version tag from staging to promote'
1010
required: true
11+
dry_run:
12+
description: 'Dry run mode - verify only, do not push to production'
13+
required: false
14+
default: 'true'
1115
github_token:
1216
description: 'GitHub token for GHCR access'
1317
required: true
@@ -48,10 +52,18 @@ runs:
4852
exit 1
4953
fi
5054
51-
docker pull $STAGING_IMAGE
55+
echo "Staging image verified: $STAGING_IMAGE"
56+
57+
if [ "${{ inputs.dry_run }}" = "true" ]; then
58+
echo "DRY RUN MODE - Skipping pull"
59+
else
60+
docker pull $STAGING_IMAGE
61+
fi
62+
5263
echo "STAGING_IMAGE=$STAGING_IMAGE" >> $GITHUB_ENV
5364
5465
- name: Tag and push to GHCR production
66+
if: inputs.dry_run != 'true'
5567
shell: bash
5668
run: |
5769
docker tag $STAGING_IMAGE ghcr.io/${{ inputs.image_repository }}:${{ inputs.staging_version }}
@@ -61,14 +73,25 @@ runs:
6173
docker push ghcr.io/${{ inputs.image_repository }}:enterprise
6274
docker push ghcr.io/${{ inputs.image_repository }}:latest
6375
76+
- name: Dry run summary for GHCR
77+
if: inputs.dry_run == 'true'
78+
shell: bash
79+
run: |
80+
echo "DRY RUN - Would push to GHCR:"
81+
echo " - ghcr.io/${{ inputs.image_repository }}:${{ inputs.staging_version }}"
82+
echo " - ghcr.io/${{ inputs.image_repository }}:enterprise"
83+
echo " - ghcr.io/${{ inputs.image_repository }}:latest"
84+
6485
- name: Login to Harbor
86+
if: inputs.dry_run != 'true'
6587
uses: docker/login-action@v3
6688
with:
6789
registry: ${{ inputs.harbor_registry }}
6890
username: ${{ inputs.harbor_username }}
6991
password: ${{ inputs.harbor_password }}
7092

7193
- name: Tag and push to Harbor
94+
if: inputs.dry_run != 'true'
7295
shell: bash
7396
run: |
7497
HARBOR_IMAGE="${{ inputs.harbor_registry }}/community/${{ steps.service.outputs.service_name }}"
@@ -78,3 +101,12 @@ runs:
78101
docker push ${HARBOR_IMAGE}:${{ inputs.staging_version }}
79102
docker push ${HARBOR_IMAGE}:community
80103
docker push ${HARBOR_IMAGE}:latest
104+
105+
- name: Dry run summary for Harbor
106+
if: inputs.dry_run == 'true'
107+
shell: bash
108+
run: |
109+
echo "DRY RUN - Would push to Harbor:"
110+
echo " - ${{ inputs.harbor_registry }}/community/${{ steps.service.outputs.service_name }}:${{ inputs.staging_version }}"
111+
echo " - ${{ inputs.harbor_registry }}/community/${{ steps.service.outputs.service_name }}:community"
112+
echo " - ${{ inputs.harbor_registry }}/community/${{ steps.service.outputs.service_name }}:latest"

0 commit comments

Comments
 (0)