Skip to content

Main - Build Image and Push to Openshift Registry for Dev Deployment #157

Main - Build Image and Push to Openshift Registry for Dev Deployment

Main - Build Image and Push to Openshift Registry for Dev Deployment #157

Workflow file for this run

# Deploy an artifact onto Dev
name: Main - Build Image and Push to Openshift Registry for Dev Deployment
on:
workflow_dispatch:
inputs:
app_name:
required: true
description: App to be deployed
type: choice
options:
- dps-email-poller
- dps-email-worker
- dps-notification-service
- dps-payment-service
- dps-validation-service
- figaro-validation-service
- spd-notification-worker
- vips-notification-worker
environment:
required: true
description: What is the targeted environment?
type: choice
options:
- dev
- test
- prod
jobs:
# unit-test:
# uses: SierraSystems/reusable-workflows/.github/workflows/java-unit-tests.yml@main
# with:
# working_directory: "src"
# profile: ${{ github.event.inputs.app_name }}
# java_version: 17
# secrets:
# nexus_url: ${{ secrets.NEXUS_URL }}
app-version:
name: Get the app-version from the POM file
runs-on: ubuntu-latest
defaults:
run:
working-directory: "."
outputs:
app-version: ${{ steps.get-app-version.outputs.version }}
steps:
- uses: actions/checkout@v2
- name: Build Vips Client
working-directory: "./src/libs"
run: git submodule update --init
- name: "Set up JDK 17"
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17
cache: 'maven'
- 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: Get Project Version
id: get-app-version
working-directory: "./src"
run: |
_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout -P${{ github.event.inputs.app_name }})
echo "version=$_version " >> "$GITHUB_OUTPUT"
echo $_version
build-and-push-image:
needs:
- app-version
uses: SierraSystems/reusable-workflows/.github/workflows/docker-build-and-push-image.yml@main
with:
app_name: ${{ github.event.inputs.app_name }}
working_directory: .
image_tags: "dev,${{ needs.app-version.outputs.app-version }}"
env: tools
build_args: |-
DPS_SERVICE_NAME=${{ github.event.inputs.app_name }}
MVN_PROFILES=${{ github.event.inputs.app_name }},openshift
secrets:
openshift_server_url: "${{ secrets.OPENSHIFT_SERVER_URL_SILVER }}"
openshift_token: "${{ secrets.OPENSHIFT_SA_PIPELINE_TOKEN_SILVER }}"
openshift_external_repository: "${{ secrets.OPENSHIFT_EXTERNAL_REPOSITORY_SILVER }}"
openshift_license_plate: "${{ secrets.OPENSHIFT_LICENSE_PLATE_SILVER }}"
docker_username: "${{ secrets.DOCKER_USERNAME }}"
docker_password: "${{ secrets.DOCKER_PASSWORD }}"
trivy:
needs:
- app-version
- build-and-push-image
uses: SierraSystems/reusable-workflows/.github/workflows/trivy-scan-openshift-image.yml@main
with:
imagestream_name: ${{ github.event.inputs.app_name }}
image_tag: "${{ needs.app-version.outputs.app-version }}"
secrets:
openshift_external_repository: "${{ secrets.OPENSHIFT_EXTERNAL_REPOSITORY_SILVER }}"
openshift_namespace: "${{ secrets.OPENSHIFT_LICENSE_PLATE_SILVER }}-tools"
openshift_sa_name: "${{ secrets.OPENSHIFT_SA_PIPELINE_PASSWORD_SILVER }}"
openshift_sa_password: "${{ secrets.OPENSHIFT_SA_PIPELINE_TOKEN_SILVER }}"
openshift_server_url: "${{ secrets.OPENSHIFT_SERVER_URL_SILVER }}"
openshift_token: "${{ secrets.OPENSHIFT_SA_PIPELINE_TOKEN_SILVER }}"