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

trigger preview image build on tag #6933

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/preview-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ on:
- Tests
types:
- completed
branches:
- master

env:
DOCKER_REPO: redash

jobs:
build-skip-check:
runs-on: ubuntu-22.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event.workflow_run.conclusion == 'success' && (endsWith(github.event.workflow_run.head_branch, '-dev') || startsWith(github.event.workflow_run.head_branch, 'master')) }}
outputs:
skip: ${{ steps.skip-check.outputs.skip }}
steps:
Expand Down Expand Up @@ -71,7 +69,12 @@ jobs:
run: |
set -x
VERSION=$(jq -r .version package.json)
FULL_VERSION=${VERSION}-b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}
BRANCH=${{ event.workflow_run.head_branch }}
if [[ "$BRANCH" =~ ^[0-9]+\.[0-9]+\.[0-9]+\-dev ]]; then
FULL_VERSION=${VERSION}
else
FULL_VERSION=${VERSION}-b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this what we want? This used to be the short SHA of the commit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's what it used to be
you can check images, that i've published during testing in a fork
https://hub.docker.com/r/achubatiuk/preview/tags

fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eradman Reading over these lines here, doesn't the FULL_VERSION variable end up how it used to be for the monthly snapshots?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously the trigger condition was based on a single condition

name: Preview Image
on:
  push:
    tags:
      - '*-dev'

This made the entire workflow easy to reason about. I don't know what will happen when the workflow is run; needs to be tested in a private repository.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's needed to:

  1. prevent building image with code, that doesn't pass tests in master
  2. spend less time on ARM64 images build, which are only possible to build on QEMU in github actions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on QEMU in github actions

That raises an interesting point. GitHub Actions added M1 based macOS runners a few months ago. Wonder if means we could build ARM64 images natively using those?

Might be too much hassle to try and figure that out though. Not sure. 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't solve a problem, still emulation is required

sed -ri "s/^__version__ = ([A-Za-z0-9.-]*)'/__version__ = '${FULL_VERSION}'/" redash/__init__.py
sed -i "s/dev/${GITHUB_SHA}/" client/app/version.json
echo "VERSION_TAG=$FULL_VERSION" >> "$GITHUB_OUTPUT"
Expand Down