eb25d9f4a8
* add retries to the setup enterprise action * add fail pipeline after the last retry * fix a dyslectic typo * fix syntax errors in the script * fix syntax errors in the script and the issue detected by zizmor * cd to grafana enterprise dir * update the go ws
81 lines
2.2 KiB
YAML
81 lines
2.2 KiB
YAML
name: 'Setup Grafana Enterprise'
|
|
description: 'Clones and sets up Grafana Enterprise repository for testing'
|
|
|
|
inputs:
|
|
github-app-name:
|
|
description: 'Name of the GitHub App in Vault'
|
|
required: false
|
|
default: 'grafana-ci-bot'
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Retrieve GitHub App secrets
|
|
id: get-secrets
|
|
uses: grafana/shared-workflows/actions/get-vault-secrets@get-vault-secrets-v1.0.1 # zizmor: ignore[unpinned-uses]
|
|
with:
|
|
repo_secrets: |
|
|
APP_ID=${{ inputs.github-app-name }}:app-id
|
|
APP_INSTALLATION_ID=${{ inputs.github-app-name }}:app-installation-id
|
|
PRIVATE_KEY=${{ inputs.github-app-name }}:private-key
|
|
|
|
- name: Generate GitHub App token
|
|
id: generate_token
|
|
uses: actions/create-github-app-token@v1
|
|
with:
|
|
app-id: ${{ env.APP_ID }}
|
|
private-key: ${{ env.PRIVATE_KEY }}
|
|
repositories: "grafana-enterprise"
|
|
owner: "grafana"
|
|
|
|
- name: Setup Enterprise
|
|
shell: bash
|
|
env:
|
|
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
|
|
run: |
|
|
RETRIES="5"
|
|
|
|
for i in $(seq 1 $RETRIES); do
|
|
echo "Attempt $i to clone..."
|
|
|
|
if git clone https://x-access-token:${GH_TOKEN}@github.com/grafana/grafana-enterprise.git ../grafana-enterprise; then
|
|
echo "Clone succeeded on attempt $i"
|
|
break
|
|
fi
|
|
|
|
if [ $i -eq $RETRIES ]; then
|
|
echo "Clone failed after $RETRIES attempts, failing pipeline."
|
|
exit 1
|
|
fi
|
|
|
|
sleep "$i"
|
|
done
|
|
|
|
cd ../grafana-enterprise
|
|
|
|
for i in $(seq 1 $RETRIES); do
|
|
echo "Attempt $i to checkout..."
|
|
|
|
if git checkout ${GITHUB_HEAD_REF}; then
|
|
echo "checked out ${GITHUB_HEAD_REF}"
|
|
elif git checkout ${GITHUB_BASE_REF}; then
|
|
echo "checked out ${GITHUB_BASE_REF}"
|
|
else
|
|
git checkout main
|
|
fi
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "Checkout succeeded, breaking retry loop"
|
|
break
|
|
fi
|
|
|
|
if [ $i -eq $RETRIES ]; then
|
|
echo "Checkout failed after $RETRIES attempts, failing pipeline."
|
|
exit 1
|
|
fi
|
|
|
|
sleep "$i"
|
|
done
|
|
|
|
QUIET=1 ./build.sh
|