Skip to content

OK-414 Build ovara fatjar image #495

OK-414 Build ovara fatjar image

OK-414 Build ovara fatjar image #495

Workflow file for this run

name: Valinta-tulos-service
on:
workflow_dispatch:
push:
paths-ignore:
- '**.md'
jobs:
test-and-build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
- uses: szenius/[email protected]
with:
timezoneLinux: "Europe/Helsinki"
- name: Build Valintarekisteri Docker container
run: |
cd valinta-tulos-valintarekisteri-db/postgresql/docker/
docker build --tag valintarekisteri-postgres .
cd -
- name: Build with Maven
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
run: |
mvn -B clean package --settings settings.xml
- uses: actions/cache@v2
id: restore-build
with:
path: |
target
valinta-tulos-henkiloviite-synchronizer/target
valinta-tulos-service/target
valinta-tulos-valintarekisteri-db/target
key: ${{ github.sha }}
deploy-container:
needs: test-and-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
id: restore-build
with:
path: |
target
valinta-tulos-henkiloviite-synchronizer/target
valinta-tulos-service/target
valinta-tulos-valintarekisteri-db/target
valinta-tulos-ovara/target
key: ${{ github.sha }}
- name: Build and deploy Docker container
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
git clone https://github.com/Opetushallitus/ci-tools.git
source ci-tools/common/setup-tools.sh
export BASE_IMAGE="baseimage-war-openjdk11:master"
./ci-tools/common/pull-image.sh
mv valinta-tulos-service/target/valinta-tulos-service-*.war $DOCKER_BUILD_DIR/artifact/valinta-tulos-service.war
cp -vr valinta-tulos-service/src/main/resources/oph-configuration $DOCKER_BUILD_DIR/config/
./ci-tools/github-build/build-war.sh valinta-tulos-service
./ci-tools/common/clean-docker-build-dir.sh
export BASE_IMAGE="baseimage-fatjar-openjdk11:master"
./ci-tools/common/pull-image.sh
mv valinta-tulos-henkiloviite-synchronizer/target/valinta-tulos-henkiloviite-synchronizer-*-jar-with-dependencies.jar $DOCKER_BUILD_DIR/artifact/valinta-tulos-henkiloviite-synchronizer.jar
cp -vr valinta-tulos-henkiloviite-synchronizer/target/classes/oph-configuration $DOCKER_BUILD_DIR/config/
./ci-tools/github-build/build-fatjar.sh valinta-tulos-henkiloviite-synchronizer
export BASE_IMAGE="baseimage-fatjar-openjdk11:master"
./ci-tools/common/pull-image.sh
mv valinta-tulos-ovara/target/valinta-tulos-ovara-*-jar-with-dependencies.jar $DOCKER_BUILD_DIR/artifact/valinta-tulos-ovara.jar
cp -vr valinta-tulos-ovara/target/classes/oph-configuration $DOCKER_BUILD_DIR/config/
./ci-tools/github-build/build-fatjar.sh valinta-tulos-ovara
./ci-tools/github-build/upload-image.sh valinta-tulos-service
./ci-tools/github-build/upload-image.sh valinta-tulos-henkiloviite-synchronizer
./ci-tools/github-build/upload-image.sh valinta-tulos-ovara
deploy-jar-library:
needs: test-and-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
id: restore-build
with:
path: |
target
valinta-tulos-henkiloviite-synchronizer/target
valinta-tulos-service/target
valinta-tulos-valintarekisteri-db/target
valinta-tulos-ovara/target
key: ${{ github.sha }}
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
- name: Deploy jar library
if: github.ref == 'refs/heads/master'
shell: bash
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
GITHUB_TOKEN: ${{ github.token }}
run: |
git clone https://github.com/Opetushallitus/ci-tools.git
source ci-tools/common/setup-tools.sh
mvn deploy -B -pl fi.vm.sade:valinta-tulos-service-parent,valinta-tulos-valintarekisteri-db,valinta-tulos-service,valinta-tulos-ovara -DskipTests --settings settings.xml