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

arm e2e #1832

Closed
wants to merge 24 commits into from
Closed

arm e2e #1832

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 36 additions & 13 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@ name: backend
on:
push:
workflow_dispatch:
inputs:
build_arm:
type: boolean
description: "Build for ARM as well"
default: false
required: false
workflow_call:
inputs:
build_arm:
type: string
description: "Build for ARM as well"
default: "false"
required: true

env:
DOCKER_IMAGE_NAME: ghcr.io/loculus-project/backend
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BUILD_ARM: ${{ github.event.inputs.build_arm || inputs.build_arm || github.ref == 'refs/heads/main' }}

concurrency:
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-backend
Expand All @@ -26,7 +44,7 @@ jobs:
id: files-hash
run: |
DIR_HASH=$(echo -n ${{ hashFiles('backend/**', '.github/workflows/backend.yml') }})
echo "DIR_HASH=$DIR_HASH" >> $GITHUB_ENV
echo "DIR_HASH=$DIR_HASH${{ env.BUILD_ARM && '-arm'|| '' }}" >> $GITHUB_ENV

- name: Setup Docker metadata
id: dockerMetadata
Expand All @@ -38,7 +56,7 @@ jobs:
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
type=sha,prefix=commit-

type=raw,value=${{ env.BRANCH_NAME }}-arm,enable=${{ env.BUILD_ARM }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand All @@ -52,6 +70,9 @@ jobs:
EXISTS=$(docker manifest inspect ${{ env.DOCKER_IMAGE_NAME }}:${{ env.DIR_HASH }} > /dev/null 2>&1 && echo "true" || echo "false")
echo "CACHE_HIT=$EXISTS" >> $GITHUB_ENV

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up JDK
if: env.CACHE_HIT == 'false'
uses: actions/setup-java@v4
Expand All @@ -63,22 +84,24 @@ jobs:
if: env.CACHE_HIT == 'false'
uses: gradle/actions/setup-gradle@v3

- name: Build Docker Image For Branch
- name: Build Backend
if: env.CACHE_HIT == 'false'
run: ./gradlew bootBuildImage --imageName=${{ env.DOCKER_IMAGE_NAME }}:${{ env.DIR_HASH }}
working-directory: ./backend
env:
USER: ${{ github.actor }}
TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: ./gradlew bootJar

- name: Push Docker Image
- name: Build and push image if input files changed
if: env.CACHE_HIT == 'false'
run: docker push ${{ env.DOCKER_IMAGE_NAME }}:${{ env.DIR_HASH }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/build-push-action@v5
with:
context: ./backend
push: true
tags: ${{ steps.dockerMetadata.outputs.tags }}
cache-from: type=gha,scope=backend-${{ github.ref }}
cache-to: type=gha,mode=max,scope=backend-${{ github.ref }}
platforms: ${{ env.BUILD_ARM && 'linux/amd64,linux/arm64' || 'linux/amd64' }}

- name: Tag and push existing images
- name: Retag and push existing image if cache hit
if: env.CACHE_HIT == 'true'
run: |
TAGS=(${{ steps.dockerMetadata.outputs.tags }})
for TAG in "${TAGS[@]}"; do
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/build-arm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Trigger a build of all docker images including ARM images

on:
push:
workflow_dispatch:

permissions:
contents: read
packages: write
checks: read

jobs:
trigger-backend:
uses: ./.github/workflows/backend.yml
with:
build_arm: true

trigger-config-preprocessor:
uses: ./.github/workflows/config-preprocessor-build.yml
with:
build_arm: true

trigger-dummy-preprocessing:
uses: ./.github/workflows/dummyPreprocessing.yml
with:
build_arm: true

trigger-ingest:
uses: ./.github/workflows/ingest.yml
with:
build_arm: true

trigger-keycloakify:
uses: ./.github/workflows/keycloakify-build.yml
with:
build_arm: true

trigger-preprocessing-nextclade:
uses: ./.github/workflows/preprocessing-nextclade.yml
with:
build_arm: true

trigger-website:
uses: ./.github/workflows/website.yml
with:
build_arm: true
15 changes: 12 additions & 3 deletions .github/workflows/config-preprocessor-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,26 @@ on:
type: boolean
description: "Build for ARM as well"
default: false
required: false
required: true
workflow_call:
inputs:
build_arm:
type: string
description: "Build for ARM as well"
default: "false"
required: true

env:
DOCKER_IMAGE_NAME: ghcr.io/loculus-project/config-processor
BUILD_ARM: ${{ github.ref == 'refs/heads/main' || github.event.inputs.build_arm }} # When to build for arm as well
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BUILD_ARM: ${{ github.event.inputs.build_arm || inputs.build_arm || github.ref == 'refs/heads/main' }}

defaults:
run:
working-directory: ./kubernetes/config-processor

concurrency:
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-config-processor
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-config-processor-${{github.event.inputs.build_arm}}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -50,6 +58,7 @@ jobs:
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=sha,prefix=commit-
type=raw,value=${{ env.BRANCH_NAME }}-arm,enable=${{ env.BUILD_ARM }}
- name: Build and push image
uses: docker/build-push-action@v5
with:
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/dummyPreprocessing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@ on:
description: "Build for ARM as well"
default: false
required: false
workflow_call:
inputs:
build_arm:
type: boolean
description: "Build for ARM as well"
default: false
required: false

env:
DOCKER_IMAGE_NAME: ghcr.io/loculus-project/preprocessing-dummy
BUILD_ARM: ${{ github.ref == 'refs/heads/main' || github.event.inputs.build_arm }} # When to build for arm as well
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BUILD_ARM: ${{ github.event.inputs.build_arm || inputs.build_arm || github.ref == 'refs/heads/main' }}

concurrency:
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-preprocessing-dummy
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-preprocessing-dumm-${{github.event.inputs.build_arm}}y
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -45,6 +53,7 @@ jobs:
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
type=sha,prefix=commit-
type=raw,value=${{ env.BRANCH_NAME }}-arm,enable=${{ env.BUILD_ARM }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/ingest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ on:
description: "Build for ARM as well"
default: false
required: false
workflow_call:
inputs:
build_arm:
type: boolean
description: "Build for ARM as well"
default: false
required: false

env:
DOCKER_IMAGE_NAME: ghcr.io/loculus-project/ingest
BUILD_ARM: ${{ github.ref == 'refs/heads/main' || github.event.inputs.build_arm }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BUILD_ARM: ${{ github.event.inputs.build_arm || inputs.build_arm || github.ref == 'refs/heads/main' }}

concurrency:
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-ingest
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-ingest-${{github.event.inputs.build_arm}}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -45,6 +53,7 @@ jobs:
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
type=sha,prefix=commit-
type=raw,value=${{ env.BRANCH_NAME }}-arm,enable=${{ env.BUILD_ARM }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/keycloakify-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@ on:
description: "Build for ARM as well"
default: false
required: false

workflow_call:
inputs:
build_arm:
type: boolean
description: "Build for ARM as well"
default: false
required: false
env:
DOCKER_IMAGE_NAME: ghcr.io/loculus-project/keycloakify
BUILD_ARM: ${{ github.ref == 'refs/heads/main' || github.event.inputs.build_arm }} # When to build for arm as well
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BUILD_ARM: ${{ github.event.inputs.build_arm || inputs.build_arm || github.ref == 'refs/heads/main' }}

concurrency:
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-keycloak-build
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-keycloak-buil-${{github.event.inputs.build_arm}}d
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -50,6 +57,7 @@ jobs:
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
type=sha,prefix=commit-
type=raw,value=${{ env.BRANCH_NAME }}-arm,enable=${{ env.BUILD_ARM }}
- name: Check if image exists
id: check-image
run: |
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/preprocessing-nextclade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@ on:
description: "Build for ARM as well"
default: false
required: false
workflow_call:
inputs:
build_arm:
type: boolean
description: "Build for ARM as well"
default: false
required: false

env:
DOCKER_IMAGE_NAME: ghcr.io/loculus-project/preprocessing-nextclade
BUILD_ARM: ${{ github.ref == 'refs/heads/main' || github.event.inputs.build_arm }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BUILD_ARM: ${{ github.event.inputs.build_arm || inputs.build_arm || github.ref == 'refs/heads/main' }}

concurrency:
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-preprocessing-nextclade
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-preprocessing-nextclade-${{github.event.inputs.build_arm}}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -46,6 +54,7 @@ jobs:
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
type=sha,prefix=commit-
type=raw,value=${{ env.BRANCH_NAME }}-arm,enable=${{ env.BUILD_ARM }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
name: website

on:
push:
workflow_dispatch:
inputs:
build_arm:
type: boolean
description: "Build for ARM as well"
default: false
required: false

workflow_call:
inputs:
build_arm:
type: boolean
description: "Build for ARM as well"
default: false
required: false
env:
DOCKER_IMAGE_NAME: ghcr.io/loculus-project/website
BUILD_ARM: ${{ github.ref == 'refs/heads/main' || github.event.inputs.build_arm }} # When to build for arm as well
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BUILD_ARM: ${{ github.event.inputs.build_arm || inputs.build_arm || github.ref == 'refs/heads/main' }}

concurrency:
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-website
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-website-${{github.event.inputs.build_arm}}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -46,6 +52,7 @@ jobs:
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
type=sha,prefix=commit-
type=raw,value=${{ env.BRANCH_NAME }}-arm,enable=${{ env.BUILD_ARM }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM eclipse-temurin:21-jre-alpine

WORKDIR /app

COPY build/libs/backend.jar app.jar

EXPOSE 8079

ENTRYPOINT ["java", "-jar", "app.jar", "--spring.profiles.active=docker"]
8 changes: 8 additions & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,11 @@ tasks.named('bootBuildImage') {
// https://paketo.io/docs/howto/configuration/
environment["BPE_SPRING_PROFILES_ACTIVE"] = "docker"
}

tasks.named("jar") {
enabled = false // prevent to generate plain jar
}
tasks.named("bootJar") {
enabled = true
archiveVersion.set("")
}
2 changes: 1 addition & 1 deletion docs/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v22
v22
Loading