Skip to content

Commit ee41bff

Browse files
committed
Refactor GitHub Actions workflow to use secrets for registry URL
- Removed the `base_registry` input parameter and replaced it with the `ARTIFACTORY_URL` secret for improved security. - Updated all references in the workflow to utilize the new secret for Docker login, image pull, and build processes. - Defaulted the `skip_scan` input to true for streamlined testing.
1 parent e4deaa0 commit ee41bff

1 file changed

Lines changed: 14 additions & 18 deletions

File tree

.github/workflows/test-custom-registry.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@ on:
66
- feature/configurable-base-registry
77
workflow_dispatch:
88
inputs:
9-
base_registry:
10-
description: 'Custom registry URL (e.g., your-artifactory.jfrog.io)'
11-
required: true
12-
default: ''
139
skip_scan:
1410
description: 'Skip actual scan (just test Docker build)'
1511
type: boolean
16-
default: false
12+
default: true
1713

1814
jobs:
1915
test-custom-registry:
@@ -36,24 +32,24 @@ jobs:
3632
# Step 2: Test registry login (standalone test)
3733
- name: Test Registry Login
3834
run: |
39-
echo "Testing login to: ${{ inputs.base_registry }}"
40-
echo "${{ secrets.ARTIFACTORY_PASSWORD }}" | docker login "${{ inputs.base_registry }}" -u "${{ secrets.ARTIFACTORY_USERNAME }}" --password-stdin
35+
echo "Testing login to: ${{ secrets.ARTIFACTORY_URL }}"
36+
echo "${{ secrets.ARTIFACTORY_PASSWORD }}" | docker login "${{ secrets.ARTIFACTORY_URL }}" -u "${{ secrets.ARTIFACTORY_USERNAME }}" --password-stdin
4137
echo "✅ Registry login successful!"
4238
4339
# Step 3: Test image pull (standalone test)
4440
- name: Test Image Pull
4541
run: |
4642
echo "Testing image pull from custom registry..."
47-
REGISTRY="${{ inputs.base_registry }}"
43+
REGISTRY="${{ secrets.ARTIFACTORY_URL }}"
4844
# Ensure registry ends with /
4945
[[ "$REGISTRY" != */ ]] && REGISTRY="${REGISTRY}/"
50-
46+
5147
IMAGE="${REGISTRY}checkmarx/ast-cli:2.3.41"
5248
echo "Pulling: $IMAGE"
53-
49+
5450
docker pull "$IMAGE"
5551
echo "✅ Image pull successful!"
56-
52+
5753
echo ""
5854
echo "Image details:"
5955
docker inspect "$IMAGE" | jq '.[0].RepoTags, .[0].Created, .[0].Size'
@@ -62,18 +58,18 @@ jobs:
6258
- name: Test Docker Build
6359
run: |
6460
echo "Testing Docker build with custom base registry..."
65-
REGISTRY="${{ inputs.base_registry }}"
61+
REGISTRY="${{ secrets.ARTIFACTORY_URL }}"
6662
[[ "$REGISTRY" != */ ]] && REGISTRY="${REGISTRY}/"
67-
63+
6864
echo "Building with BASE_REGISTRY=${REGISTRY}"
69-
65+
7066
docker build \
7167
--build-arg BASE_REGISTRY="${REGISTRY}" \
7268
-t checkmarx-ast-action:test \
7369
.
74-
70+
7571
echo "✅ Docker build successful!"
76-
72+
7773
echo ""
7874
echo "Built image details:"
7975
docker images checkmarx-ast-action:test
@@ -83,7 +79,7 @@ jobs:
8379
if: ${{ inputs.skip_scan == false }}
8480
uses: ./
8581
with:
86-
base_registry: ${{ inputs.base_registry }}
82+
base_registry: ${{ secrets.ARTIFACTORY_URL }}
8783
base_registry_username: ${{ secrets.ARTIFACTORY_USERNAME }}
8884
base_registry_password: ${{ secrets.ARTIFACTORY_PASSWORD }}
8985
base_uri: ${{ secrets.CX_BASE_URI }}
@@ -109,5 +105,5 @@ jobs:
109105
echo "| Full Scan | ⏭️ Skipped |" >> $GITHUB_STEP_SUMMARY
110106
fi
111107
echo "" >> $GITHUB_STEP_SUMMARY
112-
echo "**Registry Used:** \`${{ inputs.base_registry }}\`" >> $GITHUB_STEP_SUMMARY
108+
echo "**Registry Used:** \`${{ secrets.ARTIFACTORY_URL }}\`" >> $GITHUB_STEP_SUMMARY
113109

0 commit comments

Comments
 (0)