Skip to content

Commit

Permalink
Test build and push script for k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-eberle committed Jan 29, 2024
1 parent 692049a commit ff05000
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/k8s-quarkus-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Quarkus Sync Build & Deploy on k8s

on:
push:
branches: [ main, feature/k8s-deployment ]
pull_request:
branches: [ main ]

permissions:
contents: read
packages: write

jobs:
build:
name: build & push
runs-on: ubuntu-latest
env:
working-directory: ./bookstore-quarkus-sync

steps:
- uses: actions/checkout@v3

- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: assemble
run: ./gradlew assemble

- name: build container
run: ./gradlew build -x test -Dquarkus.container-image.build=true

# - name: Login to GitHub Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# logout: true

- name: push container
run: |
./gradlew build -x test -Dquarkus.container-image.push=true \
-Dquarkus.container-image.group=${{ github.repository_owner }} \
-Dquarkus.container-image.name=${{ github.event.repository.name }} \
-Dquarkus.container-image.registry=ghcr.io \
-Dquarkus.container-image.additional-tags=${{ github.sha }} \
-Dquarkus.container-image.username=${{ github.actor }} \
-Dquarkus.container-image.password=${{ secrets.GITHUB_TOKEN }}
# deploy:
# name: deploy to k8s
# runs-on: ubuntu-latest
# needs: build
#
# steps:
# - uses: actions/checkout@v3
#
# - name: Helm Deploy to k8s
# uses: vimeda/[email protected]
# with:
# release: 'bookstore-quarkus-sync'
# namespace: 'benchmarks'
# chart: 'bookstore-quarkus-sync/helm'
# token: '${{ secrets.GITHUB_TOKEN }}'
# values: |
# image:
# tag: ${{ github.sha }}
# env:
# KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}'
1 change: 1 addition & 0 deletions bookstore-quarkus-sync/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies {
implementation("io.quarkus:quarkus-smallrye-health")

implementation("io.quarkus:quarkus-container-image-jib")
implementation("io.quarkus:quarkus-kubernetes")

testImplementation("io.quarkus:quarkus-junit5")
testImplementation("io.rest-assured:rest-assured")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
quarkus.http.port=3000
# As we will expose the same API for Quarkus and SpringBoot AWS LB needs a prefix to route to the correct service
%prod.quarkus.http.root-path=/quarkus-sync
#
# Database
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=${DB_USER:postgres}
Expand Down

0 comments on commit ff05000

Please sign in to comment.