Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix logql analyzer #14511

Merged
merged 13 commits into from
Oct 17, 2024
19 changes: 12 additions & 7 deletions .github/workflows/logql-analyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,28 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-tags: true
path: loki

- name: Run shell command
- name: prepare
id: prepare
env:
MAJOR_MINOR_VERSION_REGEXP: '([0-9]+\\.[0-9]+)'
RELEASE_TAG_REGEXP: '^([0-9]+\\.[0-9]+\\.[0-9]+)$'
working-directory: loki
run: |
echo $("${WORKSPACE_ROOT}/loki/tools/image-tag") > .tag
if [[ "${RELEASE_VERSION}" == "test" ]]; then
echo "$(./tools/image-tag)" > .tag
if [[ "$RELEASE_VERSION" == "test" ]]; then
echo "RELEASE_VERSION is not set, using image tag"
RELEASE_VERSION=$(cat .tag)
RELEASE_VERSION="$(cat .tag)"
fi
echo "RELEASE_VERSION: $RELEASE_VERSION"

# if the tag matches the pattern `D.D.D` then RELEASE_NAME="D-D-x", otherwise RELEASE_NAME="next"
RELEASE_NAME=$([[ $RELEASE_VERSION =~ $RELEASE_TAG_REGEXP ]] && echo $RELEASE_TAG | grep -oE $MAJOR_MINOR_VERSION_REGEXP | sed "s/\\./-/g" | sed "s/$/-x/" || echo "next")
echo "RELEASE_NAME: $RELEASE_NAME"

echo "::set-output name=release_version::${RELEASE_VERSION}"
echo "::set-output name=release_name::${RELEASE_NAME}"
echo "release_version=${RELEASE_VERSION}" >> "$GITHUB_OUTPUT"
echo "release_name=${RELEASE_NAME}" >> "$GITHUB_OUTPUT"

- id: "get-github-app-token"
name: "get github app token"
Expand All @@ -62,14 +65,16 @@ jobs:
uses: "docker/build-push-action@v6"
with:
build-args: "IMAGE_TAG=${{ steps.prepare.outputs.release_version }}"
file: "cmd/logql-analyzer/Dockerfile"
context: loki
file: "loki/cmd/logql-analyzer/Dockerfile"
platforms: "linux/amd64"
push: true
tags: "grafana/logql-analyzer:${{ steps.prepare.outputs.release_version }}"

- name: Log in to Google Artifact Registry
uses: grafana/shared-workflows/actions/login-to-gar@main
with:
registry: "us-docker.pkg.dev"
environment: "prod"

- name: Update to latest image
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/scripts/helm-tagged-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ sed --in-place \

make TTY='' helm-docs

echo "::set-output name=new_chart_version::${new_chart_version}"
# shellcheck disable=SC2154,SC2250
echo "new_chart_version=${new_chart_version}" >> "$GITHUB_OUTPUT"
6 changes: 4 additions & 2 deletions .github/workflows/scripts/helm-weekly-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ fi

make TTY='' helm-docs

echo "::set-output name=new_chart_version::${new_chart_version}"
# shellcheck disable=SC2154,SC2250
echo "new_chart_version=${new_chart_version}" >> "$GITHUB_OUTPUT"
if ${k_release}; then
echo "::set-output name=weekly::$(extract_k_version "${latest_loki_tag}")"
# shellcheck disable=SC2154,SC2250
echo "weekly=$(extract_k_version "${latest_loki_tag}")" >> "$GITHUB_OUTPUT"
fi
Loading