-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build frontend and backend for Jan pipeline (#2421)
- Loading branch information
1 parent
5b86ea1
commit 48f9645
Showing
23 changed files
with
829 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
name: PR Build Template | ||
name: Branch Build Template | ||
|
||
on: | ||
workflow_call: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
name: Branch Deploy Template | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
branch-name: # sample value: release-2.9.0 or main-release-jan-2024 | ||
required: true | ||
type: string | ||
# suffix is in format of -dev, -test, -dev-jan, test-jan, -dev-1923, dev-jan-1923 | ||
suffix: | ||
required: true | ||
type: string | ||
# env-name is in format of dev, test | ||
env-name: | ||
required: true | ||
type: string | ||
# database-service-host-name sample tfrs-spilo, tfrs-spilo-jan, tfrs-spilo-dev-1988 | ||
database-service-host-name: | ||
required: true | ||
type: string | ||
secrets: | ||
tools-namespace: | ||
required: true | ||
namespace: | ||
required: true | ||
openshift-server: | ||
required: true | ||
openshift-token: | ||
required: true | ||
|
||
jobs: | ||
|
||
deploy: | ||
|
||
name: Deploy tfrs | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
|
||
steps: | ||
|
||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.branch-name }} | ||
|
||
- name: Log in to Openshift | ||
uses: redhat-actions/oc-login@v1.2 | ||
with: | ||
openshift_server_url: ${{ secrets.openshift-server }} | ||
openshift_token: ${{ secrets.openshift-token }} | ||
insecure_skip_tls_verify: true | ||
namespace: ${{ secrets.tools-namespace }} | ||
|
||
- name: Tag Images from tools | ||
run: | | ||
oc tag ${{ secrets.tools-namespace }}/tfrs-frontend:build-${{ inputs.branch-name }} ${{ secrets.namespace }}/tfrs-frontend:${{ inputs.env-name }}-${{ inputs.branch-name }} | ||
oc tag ${{ secrets.tools-namespace }}/tfrs-backend:build-${{ inputs.branch-name }} ${{ secrets.namespace }}/tfrs-backend:${{ inputs.env-name }}-${{ inputs.branch-name }} | ||
- name: Deploy tfrs-frontend | ||
shell: bash {0} | ||
run: | | ||
cd charts/tfrs-apps/charts/tfrs-frontend | ||
helm status -n ${{ secrets.namespace }} tfrs-frontend${{ inputs.suffix }} | ||
if [ $? -eq 0 ]; then | ||
echo "tfrs-frontend${{ inputs.suffix }} release exists already" | ||
helm upgrade \ | ||
--set frontendImageTagName=${{ inputs.env-name }}-${{ inputs.branch-name }} \ | ||
--set suffix=${{ inputs.suffix }} \ | ||
--set namespace=${{ secrets.namespace }} \ | ||
--set envName=${{ inputs.env-Name }} \ | ||
-n ${{ secrets.namespace }} -f ./values${{ inputs.suffix }}.yaml tfrs-frontend${{ inputs.suffix }} . | ||
else | ||
echo "tfrs-frontend${{ inputs.suffix }} release does not exist" | ||
helm install \ | ||
--set frontendImageTagName=${{ inputs.env-name }}-${{ inputs.branch-name }} \ | ||
--set suffix=${{ inputs.suffix }} \ | ||
--set namespace=${{ secrets.namespace }} \ | ||
--set envName=${{ inputs.env-Name }} \ | ||
-n ${{ secrets.namespace }} -f ./values${{ inputs.suffix }}.yaml tfrs-frontend${{ inputs.suffix }} . | ||
fi | ||
- name: Deploy tfrs-backend | ||
shell: bash {0} | ||
run: | | ||
cd charts/tfrs-apps/charts/tfrs-backend | ||
helm status -n ${{ secrets.namespace }} tfrs-backend${{ inputs.suffix }} | ||
if [ $? -eq 0 ]; then | ||
echo "tfrs-backend${{ inputs.suffix }} release exists already" | ||
helm upgrade \ | ||
--set backendImageTagName=${{ inputs.env-name }}-${{ inputs.branch-name }} \ | ||
--set suffix=${{ inputs.suffix }} \ | ||
--set namespace=${{ secrets.namespace }} \ | ||
--set envName=${{ inputs.env-Name }} \ | ||
--set databaseServiceHostName=${{ inputs.database-service-host-name }} \ | ||
-n ${{ secrets.namespace }} -f ./values${{ inputs.suffix }}.yaml tfrs-backend${{ inputs.suffix }} . | ||
else | ||
echo "tfrs-backend${{ inputs.suffix }} release does not exist" | ||
helm install \ | ||
--set backendImageTagName=${{ inputs.env-name }}-${{ inputs.branch-name }} \ | ||
--set suffix=${{ inputs.suffix }} \ | ||
--set namespace=${{ secrets.namespace }} \ | ||
--set envName=${{ inputs.env-Name }} \ | ||
--set databaseServiceHostName=${{ inputs.database-service-host-name }} \ | ||
-n ${{ secrets.namespace }} -f ./values${{ inputs.suffix }}.yaml tfrs-backend${{ inputs.suffix }} . | ||
fi | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.