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

Fix #565 Standardize pipeline for deployment of test-server and add option to deploy to dockerhub #577

Merged
merged 1 commit into from
Jan 22, 2025
Merged
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
159 changes: 79 additions & 80 deletions .github/workflows/develop_pa-test-internal-testserver-app.yml
Original file line number Diff line number Diff line change
@@ -1,90 +1,89 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy container app to Container Registries
name: Build and publish docker image for PowerAuthServer

on:
push:
branches:
- develop
workflow_dispatch:
inputs:
jfrog_deploy:
push_to_registry:
type: boolean
description: Check if build image should be uploaded to JFrog
default: false
required: false
description: Publish to registry?
environment:
type: environment
description: Select the environment
pull_request:
branches:
- 'develop'
- 'master'
- 'releases/*'
paths:
- 'powerauth-test-server/**'

jobs:
build:
runs-on: 'ubuntu-latest'
environment: test

environment: ${{ inputs.environment }}
env:
# these are global secrets - for readonly access to artifactory
INTERNAL_USERNAME: ${{ secrets.JFROG_USERNAME }}
INTERNAL_PASSWORD: ${{ secrets.JFROG_PASSWORD }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
server-id: jfrog-central
server-username: INTERNAL_USERNAME
server-password: INTERNAL_PASSWORD
cache: maven
- name: Set Timestamp for docker image for development branch
if: github.ref == 'refs/heads/develop'
run: echo "TIMESTAMP=-$(date +%Y.%m.%d)" >> $GITHUB_ENV
- name: Get Powerauth Test Server version
run: |
cd powerauth-test-server
REVISION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`
echo "REVISION=$REVISION" >> $GITHUB_ENV
- name: Package test server war
run: |
cd powerauth-test-server
mvn package -DuseInternalRepo=true
env:
# those are not environmental secrect, but global secret - for readonly access to artifactory
INTERNAL_USERNAME: ${{ secrets.JFROG_USERNAME }}
INTERNAL_PASSWORD: ${{ secrets.JFROG_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to ACR
if: ${{ github.actor != 'dependabot[bot]' }}
uses: docker/login-action@v3
with:
registry: https://powerauthextendedtest.azurecr.io/
username: ${{ secrets.AZUREAPPSERVICE_CONTAINERUSERNAME }}
password: ${{ secrets.AZUREAPPSERVICE_CONTAINERPASSWORD }}
- name: Copy liquibase files
run: |
cd powerauth-test-server
./copy_liquibase.sh
- name: Build and push container image to ACR
uses: docker/build-push-action@v6
with:
push: ${{ github.actor != 'dependabot[bot]' }}
platforms: linux/amd64,linux/arm64
tags: powerauthextendedtest.azurecr.io/powerauth-test-server:${{ env.REVISION }}${{ env.TIMESTAMP }}-${{ github.sha }}
file: ./powerauth-test-server/Dockerfile
context: ./powerauth-test-server/
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Log in to JFrog
if: ${{ github.event_name == 'workflow_dispatch' && inputs.jfrog_deploy == true }}
uses: docker/login-action@v3
with:
registry: https://wultra.jfrog.io/
username: ${{ secrets.JFROG_CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.JFROG_CONTAINER_REGISTRY_PASSWORD }}
- name: Build and push container image to JFrog
if: ${{ github.event_name == 'workflow_dispatch' && inputs.jfrog_deploy == true }}
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name == 'workflow_dispatch' && inputs.jfrog_deploy == true }}
platforms: linux/amd64,linux/arm64
tags: wultra.jfrog.io/wultra-docker/powerauth-test-server:${{ env.REVISION }}${{ env.TIMESTAMP }}
file: ./powerauth-test-server/Dockerfile
context: ./powerauth-test-server/
cache-from: type=gha
cache-to: type=gha,mode=max

- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
server-id: jfrog-central
server-username: INTERNAL_USERNAME
server-password: INTERNAL_PASSWORD
- name: Set Timestamp for docker image for development branch
if: "!(startsWith(github.ref, 'refs/heads/releases/') || startsWith(github.ref, 'refs/tags/'))"
run: echo "TIMESTAMP=-$(date +%Y.%m.%d)" >> $GITHUB_ENV
- name: Get Powerauth Test Server version
run: |
cd powerauth-test-server
REVISION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`
echo "REVISION=$REVISION" >> $GITHUB_ENV
- name: Prepare wars and libs
run: |
cd powerauth-test-server
mvn -U -DuseInternalRepo=true --no-transfer-progress clean package
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Log in to ACR
if: vars.ACR_REGISTRY_URL != ''
uses: docker/login-action@v3
with:
registry: ${{ vars.ACR_REGISTRY_URL }}
username: ${{ vars.ACR_USERNAME }}
password: '${{ secrets.ACR_PASSWORD }}'
- name: Log in to Distribution registry
if: vars.DISTRIBUTION_REGISTRY_URL != ''
uses: docker/login-action@v3
with:
registry: ${{ vars.DISTRIBUTION_REGISTRY_URL }}
username: ${{ vars.DISTRIBUTION_USERNAME }}
password: ${{ secrets.DISTRIBUTION_PASSWORD }}
- name: Copy liquibase files
run: |
cd powerauth-test-server
./copy_liquibase.sh
- name: Build and push container image to registry
uses: docker/build-push-action@v6
with:
push: ${{ inputs.push_to_registry == true }}
platforms: linux/amd64,linux/arm64
tags: |
${{ vars.ACR_REGISTRY_URL != '' && format('{0}/powerauth-test-server:{1}{2}-{3}', vars.ACR_REPOSITORY, env.REVISION, env.TIMESTAMP, github.sha) || '' }}
${{ vars.DISTRIBUTION_REGISTRY_URL != '' && format('{0}/powerauth-test-server:{1}{2}-{3}', vars.DISTRIBUTION_REPOSITORY, env.REVISION, env.TIMESTAMP, github.sha) || '' }}
file: powerauth-test-server/Dockerfile
context: powerauth-test-server
- run: echo '### 🚀 Published images' >> $GITHUB_STEP_SUMMARY
- if: inputs.push_to_registry == true && vars.ACR_REGISTRY_URL != ''
run: |
echo '${{ vars.ACR_REPOSITORY }}/powerauth-test-server:${{ env.REVISION }}${{ env.TIMESTAMP }}-${{ github.sha }}' >> $GITHUB_STEP_SUMMARY
- if: inputs.push_to_registry == true && vars.DISTRIBUTION_REGISTRY_URL != ''
run: echo '${{ vars.DISTRIBUTION_REPOSITORY }}/powerauth-test-server:${{ env.REVISION }}${{ env.TIMESTAMP }}-${{ github.sha }}' >> $GITHUB_STEP_SUMMARY
Loading