@@ -153,27 +153,49 @@ runs:
153153 if : ${{ inputs.enable-install == 'true' }}
154154 uses : helm/kind-action@v1.12.0
155155
156+ - uses : docker/login-action@v3
157+ with :
158+ registry : ${{ inputs.oci-registry }}
159+ username : ${{ inputs.oci-registry-username }}
160+ password : ${{ inputs.oci-registry-password }}
161+
162+ - shell : bash
163+ run : |
164+ cat ~/.docker/config.json
165+
166+ HELM_SET="${{ inputs.helm-set }}"
167+ # Extract image tag
168+ IMAGE_TAG=$(echo "$HELM_SET" | grep -oP '(?<=tag=)[^,]*' | tr -d '[:space:]')
169+
170+ IMAGE="ghcr.io/cigales-cloud/landing-page/application:$IMAGE_TAG"
171+
172+ echo "IMAGE=$IMAGE"
173+
174+ # Try to pull the image from the OCI registry
175+ docker pull "$IMAGE"
176+
156177 - name : Install default OCI registry secrets
157178 id : oci-registry-secret
158179 if : ${{ inputs.enable-install == 'true' && inputs.oci-registry != '' && inputs.oci-registry-username != '' && inputs.oci-registry-password != '' }}
159180 shell : bash
160181 run : |
182+ SECRET_NAME="regcred"
183+ echo "oci-registry-secret=$SECRET_NAME" >> "$GITHUB_OUTPUT"
184+
161185 # See https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
162186 NAMESPACE="${{ steps.prepare-ct-variables.outputs.namespace }}"
163- kubectl --context kind-chart-testing create namespace "$NAMESPACE"
187+ kubectl create namespace "$NAMESPACE"
164188
165- SECRET_NAME="regcred"
166- DOCKER_REGISTRY="${{ inputs.oci-registry }}"
167- DOCKER_USERNAME="${{ inputs.oci-registry-username }}"
168- DOCKER_PASSWORD="${{ inputs.oci-registry-password }}"
189+ DOCKER_CONFIG_JSON_PATH=$(echo ~/.docker/config.json)
190+ if [ ! -f "$DOCKER_CONFIG_JSON_PATH" ]; then
191+ echo "::error ::Docker config.json file not found at $DOCKER_CONFIG_JSON_PATH"
192+ exit 1
193+ fi
169194
170- kubectl --context kind-chart-testing create secret docker-registry "$SECRET_NAME" \
195+ kubectl create secret generic "$SECRET_NAME" \
171196 --namespace="$NAMESPACE" \
172- --docker-server=$DOCKER_REGISTRY \
173- --docker-username=$DOCKER_USERNAME \
174- --docker-password=$DOCKER_PASSWORD
175-
176- echo "oci-registry-secret=$SECRET_NAME" >> "$GITHUB_OUTPUT"
197+ --from-file=".dockerconfigjson=$DOCKER_CONFIG_JSON_PATH" \
198+ --type=kubernetes.io/dockerconfigjson
177199
178200 - name : Run chart-testing (install)
179201 if : ${{ inputs.enable-install == 'true' }}
@@ -190,7 +212,7 @@ runs:
190212 OCI_REGISTRY_SECRET="${{ steps.oci-registry-secret.outputs.oci-registry-secret }}"
191213 if [ -n "$OCI_REGISTRY_SECRET" ]; then
192214 # Ensure secret exists
193- kubectl --context kind-chart-testing get secret "$OCI_REGISTRY_SECRET" --output=yaml --namespace=$NAMESPACE
215+ kubectl get secret "$OCI_REGISTRY_SECRET" --output=yaml --namespace=$NAMESPACE
194216
195217 HELM_SET="$HELM_SET
196218 imagePullSecrets[0].name=${OCI_REGISTRY_SECRET}"
@@ -203,7 +225,10 @@ runs:
203225 if [ -z "$line" ]; then
204226 continue
205227 fi
206- # Escape commas in the line
228+ # Remove leading and trailing whitespace
229+ line=$(echo "$line" | xargs) || true
230+
231+ # Escape commas in the line
207232 line=$(echo "$line" | sed 's/,/\\,/g') || true
208233
209234 if [ -n "$HELM_EXTRA_SET_ARGS" ]; then
@@ -216,8 +241,9 @@ runs:
216241
217242 HELM_EXTRA_SET_ARGS="--set=${HELM_EXTRA_SET_ARGS}"
218243
219- echo "::debug::ct install ${{ steps.prepare-ct-variables.outputs.args }} --helm-extra-set-args ${HELM_EXTRA_SET_ARGS}"
244+ COMMAND="ct install ${{ steps.prepare-ct-variables.outputs.args }} --namespace $NAMESPACE --helm-extra-set-args='${HELM_EXTRA_SET_ARGS}'"
245+
246+ echo "::info ::$COMMAND"
220247
221- ct install ${{ steps.prepare-ct-variables.outputs.args }} \
222- --namespace $NAMESPACE \
223- --helm-extra-set-args ${HELM_EXTRA_SET_ARGS}
248+ # shellcheck disable=SC2086
249+ eval $COMMAND
0 commit comments