Skip to content

Deploy to OpenShift #36

Deploy to OpenShift

Deploy to OpenShift #36

name: Deploy to OpenShift
on:
workflow_dispatch:
inputs:
SKIP_TLS:
description: 'Skip TLS verification'
default: 'true'
required: false
ACM_WORKLOADS:
description: 'Enable ACM Workloads'
default: 'n'
required: false
AMQ_STREAMS:
description: 'Enable AMQ Streams'
default: 'y'
required: false
CONFIGURE_POSTGRES:
description: 'Configure Postgres'
default: 'y'
required: false
MONGODB_OPERATOR:
description: 'Enable MongoDB Operator'
default: 'n'
required: false
MONGODB:
description: 'Enable MongoDB'
default: 'n'
required: false
HELM_DEPLOYMENT:
description: 'Enable Helm Deployment'
default: 'y'
required: false
DELETE_DEPLOYMENT:
description: 'Delete Deployment'
default: 'false'
required: false
DEBUG:
description: 'Debug Level'
default: '-v'
required: false
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install Ansible and dependencies
run: |
python -m pip install --upgrade pip
pip install ansible
ansible --version
whereis ansible
- name: Set up OpenShift CLI
run: |
./files/configure-openshift-packages.sh -d
./files/configure-openshift-packages.sh -i
oc version
- name: Log in to OpenShift cluster
run: oc login --token=${{ secrets.OPENSHIFT_TOKEN }} --server=${{ secrets.OPENSHIFT_SERVER }} --insecure-skip-tls-verify=${{ github.event.inputs.SKIP_TLS }}
env:
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
OPENSHIFT_SERVER: ${{ secrets.OPENSHIFT_SERVER }}
- name: Set environment variables
run: |
echo "DOMAIN=${{ secrets.CLUSTER_DOMAIN_NAME }}" >> $GITHUB_ENV
echo "OCP_TOKEN=${{ secrets.OPENSHIFT_TOKEN }}" >> $GITHUB_ENV
echo "ACM_WORKLOADS=${{ github.event.inputs.ACM_WORKLOADS }}" >> $GITHUB_ENV
echo "AMQ_STREAMS=${{ github.event.inputs.AMQ_STREAMS }}" >> $GITHUB_ENV
echo "CONFIGURE_POSTGRES=${{ github.event.inputs.CONFIGURE_POSTGRES }}" >> $GITHUB_ENV
echo "HELM_DEPLOYMENT=${{ github.event.inputs.HELM_DEPLOYMENT }}" >> $GITHUB_ENV
echo "DELETE_DEPLOYMENT=${{ github.event.inputs.DELETE_DEPLOYMENT }}" >> $GITHUB_ENV
echo "MONGODB_OPERATOR=${{ github.event.inputs.MONGODB_OPERATOR }}" >> $GITHUB_ENV
echo "MONGODB=${{ github.event.inputs.MONGODB }}" >> $GITHUB_ENV
echo "DEBUG=${{ github.event.inputs.DEBUG }}" >> $GITHUB_ENV
- name: Create env.variables file
run: |
echo "ACM_WORKLOADS=${{ github.event.inputs.ACM_WORKLOADS }}" >> env.variables
echo "AMQ_STREAMS=${{ github.event.inputs.AMQ_STREAMS }}" >> env.variables
echo "CONFIGURE_POSTGRES=${{ github.event.inputs.CONFIGURE_POSTGRES }}" >> env.variables
echo "MONGODB_OPERATOR=${{ github.event.inputs.MONGODB_OPERATOR }}" >> env.variables
echo "MONGODB=${{ github.event.inputs.MONGODB }}" >> env.variables
echo "HELM_DEPLOYMENT=${{ github.event.inputs.HELM_DEPLOYMENT }}" >> env.variables
echo "DELETE_DEPLOYMENT=${{ github.event.inputs.DELETE_DEPLOYMENT }}" >> env.variables
echo "DEBUG=${{ github.event.inputs.DEBUG }}" >> env.variables
- name: Deploy application
run: |
echo "Deploying Quarkus Coffee Shop application"
source env.variables
cat env.variables
./files/deploy-quarkuscoffeeshop-ansible.sh -d ${{ secrets.CLUSTER_DOMAIN_NAME }} -t ${{ secrets.OPENSHIFT_TOKEN }} -s RALEIGH || exit $?
env:
CLUSTER_DOMAIN_NAME: ${{ secrets.CLUSTER_DOMAIN_NAME }}
TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
ACM_WORKLOADS: ${{ github.event.inputs.ACM_WORKLOADS }}
AMQ_STREAMS: ${{ github.event.inputs.AMQ_STREAMS }}
CONFIGURE_POSTGRES: ${{ github.event.inputs.CONFIGURE_POSTGRES }}
MONGODB_OPERATOR: ${{ github.event.inputs.MONGODB_OPERATOR }}
MONGODB: ${{ github.event.inputs.MONGODB }}
HELM_DEPLOYMENT: ${{ github.event.inputs.HELM_DEPLOYMENT }}
DELETE_DEPLOYMENT: ${{ github.event.inputs.DELETE_DEPLOYMENT }}
DEBUG: ${{ github.event.inputs.DEBUG }}