From dda1531952589014bec89b6f7478f77ee5696fd9 Mon Sep 17 00:00:00 2001 From: Dafydd <72009875+dafydd-t@users.noreply.github.com> Date: Tue, 26 Mar 2024 09:24:48 +0000 Subject: [PATCH] Update ephemeral instances workflow to get version from package.json (#85088) * use the same value for GRAFANA_VERSION and HOSTED_GRAFANA_IMAGE_TAG * update codeowners for these files --- .github/CODEOWNERS | 4 ++-- .../workflows/ephemeral-instances-pr-comment.yml | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c71208a9291..9e0e0bdaa49 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -686,8 +686,8 @@ embed.go @grafana/grafana-as-code /.github/workflows/publish-kinds-release.yml @grafana/platform-cat /.github/workflows/verify-kinds.yml @grafana/platform-cat /.github/workflows/dashboards-issue-add-label.yml @grafana/dashboards-squad -/.github/workflows/ephemeral-instances-pr-comment.yml @grafana/grafana-operator-experience-squad -/.github/workflows/ephemeral-instances-pr-opened-closed.yml @grafana/grafana-operator-experience-squad +/.github/workflows/ephemeral-instances-pr-comment.yml @grafana/grafana-backend-services-squad +/.github/workflows/ephemeral-instances-pr-opened-closed.yml @grafana/grafana-backend-services-squad /.github/workflows/create-security-patch-from-security-mirror.yml @grafana/grafana-release-guild /.github/workflows/core-plugins-build-and-release.yml @grafana/plugins-platform-frontend @grafana/plugins-platform-backend /.github/workflows/i18n-crowdin-upload.yml @grafana/grafana-frontend-platform diff --git a/.github/workflows/ephemeral-instances-pr-comment.yml b/.github/workflows/ephemeral-instances-pr-comment.yml index 13916e5829d..057d56dd247 100644 --- a/.github/workflows/ephemeral-instances-pr-comment.yml +++ b/.github/workflows/ephemeral-instances-pr-comment.yml @@ -52,13 +52,18 @@ jobs: token: ${{ steps.generate_token.outputs.token }} ref: main path: ephemeral - + - name: Get latest grafana version number + run: | + # if package.json contains e.g. 11.0.0-pre, this writes 11.0.0 to version.txt + curl https://raw.githubusercontent.com/grafana/grafana/main/package.json | jq -r .version | grep -o '^[0-9\.]*' > version.txt - name: Run action env: GITHUB_EVENT: ${{ toJson(github.event)}} run: | - GRAFANA_VERSION=10.1.0 - + # Create a prerelease version number using the latest version from package.json and some metadata from the github event. + v=$(cat version.txt) + export GRAFANA_VERSION="$v-ephemeral-${{ github.event.issue.number}}-${{ github.run_number }}-${{ github.run_attempt }}" + echo "${GRAFANA_VERSION}" cd $GITHUB_WORKSPACE/ephemeral/src go run . \ -GITHUB_TOKEN="${{ steps.generate_token.outputs.token }}" \ @@ -66,7 +71,7 @@ jobs: -GITHUB_TRIGGERING_ACTOR="${{ github.triggering_actor }}" \ -GCOM_HOST="${{ secrets.EI_GCOM_HOST }}" \ -GCOM_TOKEN="${{ secrets.EI_GCOM_TOKEN }}" \ - -HOSTED_GRAFANA_IMAGE_TAG="$GRAFANA_VERSION-ephemeral-oss-${{ github.event.issue.number}}-${{ github.run_number }}-${{ github.run_attempt }}" \ + -HOSTED_GRAFANA_IMAGE_TAG="$GRAFANA_VERSION" \ -REGISTRY="${{ secrets.EI_EPHEMERAL_INSTANCES_REGISTRY }}" \ -GRAFANA_VERSION="$GRAFANA_VERSION" \ -GCP_SERVICE_ACCOUNT_KEY_BASE64="${{ secrets.EI_GCP_SERVICE_ACCOUNT_KEY_BASE64 }}" \