Skip to content
24 changes: 23 additions & 1 deletion templates/.gitlab-ci-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,29 @@ variables:
section_end "debug-sleep"
fi

# Install sparkci (dev release just for testing).
echo "Install sparkci"
if [ -n "${BRANCH_TO_TEST}" ]; then
curl -L https://go.dev/dl/go1.24.1.linux-amd64.tar.gz -o /tmp/go1.24.1.linux-amd64.tar.gz
rm -rf /usr/local/go
tar -C /usr/local -xzf /tmp/go1.24.1.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
git clone https://github.com/sparkfabrik/sparkci.git
cd sparkci
git checkout -b test/${BRANCH_TO_TEST} origin/${BRANCH_TO_TEST}
make build && chmod +x ./sparkci && mv ./sparkci /usr/local/bin/
#else
#curl -L https://github.com/sparkfabrik/sparkci/releases/download/latest/sparkci_0.0.0-dev_linux_amd64.tar.gz | tar xz
#mv sparkci /usr/local/bin/
fi

# Configure gwif using sparkci.
if [ -n "${ENABLE_GCP_WIF}" ] && [ "${ENABLE_GCP_WIF}" = "1" ]; then
sparkci gitlab format section --title "wif" --description "Workload Identity Federation"
sparkci gwif configure
sparkci gitlab format section --title "wif" --end
fi

default:
id_tokens:
GITLAB_OIDC_TOKEN:
Expand All @@ -181,7 +204,6 @@ default:
.global-setup:
before_script:
- !reference [.gitlab-helper-functions, before_script]
- !reference [.gcp-wif, before_script]
- !reference [.default-setup, before_script]

before_script:
Expand Down
4 changes: 2 additions & 2 deletions templates/functions/gcp-wif.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
export GOOGLE_APPLICATION_CREDENTIALS="${GCP_WIF_CRED_FILE}"
else
echo "The Workload Identity Federation authentication failed (login)."
GCP_WIF_EXIT_CODE=1
GCP_WIF_EXIT_CODE=1
fi
else
echo "The Workload Identity Federation authentication failed (create-cred-config)."
Expand Down Expand Up @@ -245,4 +245,4 @@
fi
if command -v section_end &> /dev/null; then
section_end "wif"
fi
fi
Loading