v49.3.1 #16
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build + Docker Uberjar | |
on: | |
release: | |
types: [released] | |
jobs: | |
build: | |
name: Build MB oss | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 40 | |
env: | |
MB_EDITION: oss | |
INTERACTIVE: false | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v3 | |
- name: Prepare front-end environment | |
uses: ./.github/actions/prepare-frontend | |
- name: Prepare back-end environment | |
uses: ./.github/actions/prepare-backend | |
with: | |
m2-cache-key: uberjar | |
- name: Build | |
run: ./bin/build.sh | |
- name: Prepare uberjar artifact | |
uses: ./.github/actions/prepare-uberjar-artifact | |
with: | |
name: metabase-oss-uberjar | |
check_jar_health: | |
runs-on: ubuntu-22.04 | |
name: Is oss (java ${{ matrix.java-version }}) healthy? | |
needs: build | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
java-version: [11, 17, 21] | |
steps: | |
- name: Prepare JRE (Java Run-time Environment) | |
uses: actions/setup-java@v4 | |
with: | |
java-package: jre | |
java-version: ${{ matrix.java-version }} | |
distribution: 'temurin' | |
- run: java -version | |
- uses: actions/download-artifact@v4 | |
name: Retrieve uberjar artifact | |
with: | |
name: metabase-oss-uberjar | |
- name: Launch uberjar | |
run: java -jar ./target/uberjar/metabase.jar & | |
- name: Wait for Metabase to start | |
run: while ! curl 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done | |
containerize_test_and_push_container: | |
runs-on: ubuntu-22.04 | |
name: Containerize oss | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
needs: check_jar_health | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
steps: | |
- name: Extract and clean branch name | |
shell: bash | |
run: echo "branch=$(echo $GITHUB_REF_NAME | sed 's/[^-._a-zA-Z0-9]/-/g')" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Verify the intended tag of the container image | |
run: echo "Container image will be tagged as ${{ steps.extract_branch.outputs.branch }}-oss" | |
- name: Check out the code (Dockerfile needed) | |
uses: actions/checkout@v3 | |
- name: Download uploaded artifacts to insert into container | |
uses: actions/download-artifact@v4 | |
with: | |
name: metabase-oss-uberjar | |
path: bin/docker/ | |
- name: Move the oss uberjar to the context dir | |
run: mv bin/docker/target/uberjar/metabase.jar bin/docker/. | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/[email protected] | |
with: | |
driver-opts: network=host | |
- name: Build oss container | |
uses: docker/build-push-action@v2 | |
with: | |
context: bin/docker/. | |
platforms: linux/amd64 | |
network: host | |
tags: localhost:5000/metabase:${{ steps.extract_branch.outputs.branch }}-oss | |
no-cache: true | |
push: true | |
- name: Launch oss container | |
run: docker run --rm -dp 3000:3000 localhost:5000/metabase:${{ steps.extract_branch.outputs.branch }}-oss | |
timeout-minutes: 5 | |
- name: Is Docker running? | |
run: docker ps | |
- name: Wait for Metabase to start and reach 100% health | |
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done | |
timeout-minutes: 3 | |
- name: Log in to the GitHub Container Registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=latest | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
type=sha | |
- name: Build and push Docker image | |
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
with: | |
context: bin/docker/. | |
platforms: linux/amd64 | |
network: host | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
push: true |