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

#1959 - Staging sims prod environment : formio GitHub action build deploy split #2000

43 changes: 43 additions & 0 deletions .github/workflows/env-setup-build-forms-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Env Setup - Build Forms Server
run-name: Env Setup - Build forms server from ${{ inputs.gitRef }}(form.io tag ${{ inputs.formioTag }})

on:
workflow_dispatch:
inputs:
formioTag:
description: "Formio tag, please refer https://github.com/formio/formio/tags to deploy the appropriate tag."
type: string
required: true
default: "v2.5.3"
gitRef:
description: "Git Ref"
required: true
default: ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why should we need the default as empty?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The git ref for build is the reference something like main-65, it does not have any default value.


jobs:
build:
name: Build Forms Server
runs-on: ubuntu-latest
env:
FORMIO_SOURCE_REPO_TAG: ${{ inputs.formioTag }}
BUILD_REF: ${{ inputs.formioTag }}
BUILD_NAMESPACE: ${{ vars.BUILD_NAMESPACE }}
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: $BUILD_REF
# Checkout the PR branch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

period

Copy link
Contributor

@ann-aot ann-aot Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 39 too and comments in other files too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update it in my next pr

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ inputs.gitRef }}
# Log in to OpenShift.
- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }}
# Build Forms
- name: Build Forms server
working-directory: "./devops/"
run: |
make oc-build-forms
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Env Setup - Build and Deploy Forms Server
run-name: Env Setup - Build and deploy forms server from ${{ inputs.gitRef }}(form.io tag ${{ inputs.formioTag }}) to ${{ inputs.environment }}
name: Env Setup - Deploy Forms Server
run-name: Env Setup - Deploy forms server from ${{ inputs.gitRef }}(form.io tag ${{ inputs.formioTag }}) to ${{ inputs.environment }}

on:
workflow_dispatch:
@@ -19,22 +19,19 @@ on:
default: ""

jobs:
build_deploy:
name: Build and Deploy Formio Server.
deploy:
name: Deploy Forms Server
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
env:
FORMIO_SOURCE_REPO_TAG: ${{ inputs.formioTag }}
FORMS_NAME: forms
NAMESPACE: ${{ secrets.OPENSHIFT_ENV_NAMESPACE }}
BUILD_REF: ${{ inputs.formioTag }}
HOST_PREFIX: ${{ secrets.HOST_PREFIX }}
MONGODB_URI: ${{ secrets.MONGODB_URI }}
BUILD_NAMESPACE: 0c27fb-tools
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo NAMESPACE: $NAMESPACE
echo BRANCH: $BUILD_REF
echo HOST_PREFIX: $HOST_PREFIX
@@ -44,16 +41,9 @@ jobs:
with:
ref: ${{ inputs.gitRef }}
# Log in to OpenShift.
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK.
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail.
- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443
# Build Forms
- name: Build Forms server
working-directory: "./devops/"
run: |
make oc-build-forms
oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }}
# Deploy Forms
- name: Deploy Forms server
working-directory: "./devops/"