diff --git a/action.yml b/action.yml index beda473..811e301 100644 --- a/action.yml +++ b/action.yml @@ -64,6 +64,10 @@ inputs: chamber_version: description: Kubectl version default: 2.11.1 + url-resource-type: + description: The type of the resource to get the URL from + required: false + default: 'ingress' outputs: webapp-url: description: "Web Application url" @@ -88,4 +92,4 @@ runs: HELM_VERSION: ${{ inputs.helm_version }} HELMFILE_VERSION: ${{ inputs.helmfile_version }} CHAMBER_VERSION: ${{ inputs.chamber_version }} - + URL_RESOURCE_TYPE: ${{ inputs.url-resource-type }} diff --git a/entrypoint.sh b/entrypoint.sh index 1409a37..5d60296 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -49,12 +49,17 @@ if [[ "${OPERATION}" == "deploy" ]]; then ${OPERATION_COMMAND} RELEASES=$(helmfile ${BASIC_ARGS} ${EXTRA_VALUES_ARGS} ${DEBUG_ARGS} list --output json | jq .[].name -r) - for RELEASE in ${RELEASES} + for RELEASE in ${RELEASES} do - ENTRYPOINT=$(kubectl --namespace ${NAMESPACE} get -l ${RELEASE_LABEL_NAME}=${RELEASE} ingress -o json | jq --raw-output '[.items[].metadata.annotations["outputs.webapp-url"]] | first') - if [[ "${ENTRYPOINT}" != "" ]]; then - echo "webapp-url=${ENTRYPOINT}" >> $GITHUB_OUTPUT - fi + echo "Processing release: ${RELEASE}" + echo "Executing kubectl command: kubectl --namespace ${NAMESPACE} get -l ${RELEASE_LABEL_NAME}=${RELEASE} ${URL_RESOURCE_TYPE} -o json" + ENTRYPOINT=$(kubectl --namespace ${NAMESPACE} get -l ${RELEASE_LABEL_NAME}=${RELEASE} ${URL_RESOURCE_TYPE} -o json | jq --raw-output '[.items[].metadata.annotations["outputs.webapp-url"]] | first') + if [[ "${ENTRYPOINT}" != "" ]]; then + echo "Found webapp-url for release ${RELEASE}: ${ENTRYPOINT}" + echo "webapp-url=${ENTRYPOINT}" >> $GITHUB_OUTPUT + else + echo "No webapp-url found for release ${RELEASE}" + fi done