-
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.
Add pull request build for Jan release (#2463)
- Loading branch information
1 parent
4110a2d
commit 3ae22be
Showing
14 changed files
with
644 additions
and
38 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 |
---|---|---|
|
@@ -20,4 +20,5 @@ After the release is deployed on Prod | |
## Update frontend/package.json | ||
* version | ||
|
||
TBV | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Please refer to ./readme.md for how to build single pull request | ||
|
||
# Update this workflow name per pull request | ||
name: TFRS Dev Jan PR CICD | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [opened, edited, synchronize, reopened] | ||
branches: | ||
- 'main-release-jan-2024' | ||
|
||
jobs: | ||
|
||
setup-database: | ||
if: endsWith( github.event.pull_request.title, 'build-on-dev' ) | ||
uses: ./.github/workflows/pr-dev-database-template.yaml | ||
with: | ||
pr-number: ${{ github.event.pull_request.number }} | ||
dev-suffix: -jan-${{ github.event.pull_request.number }} | ||
secrets: | ||
dev-namespace: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-dev | ||
tfrs-dev-username: ${{ secrets.TFRS_DEV_USERNAME }} | ||
tfrs-dev-password: ${{ secrets.TFRS_DEV_PASSWORD }} | ||
openshift-server: ${{ secrets.OPENSHIFT_SERVER }} | ||
openshift-token: ${{ secrets.OPENSHIFT_TOKEN }} | ||
|
||
# when build pull reuqest, the suffix sample is -jan-1234 | ||
# the checkout-ref is in the format of refs/pull/1234/head | ||
build: | ||
if: endsWith( github.event.pull_request.title, 'build-on-dev' ) | ||
name: Build Pull Request | ||
uses: ./.github/workflows/build-template.yaml | ||
with: | ||
suffix: -jan-${{ github.event.pull_request.number }} | ||
checkout-ref: refs/pull/${{ github.event.pull_request.number }}/head | ||
secrets: | ||
tools-namespace: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools | ||
openshift-server: ${{ secrets.OPENSHIFT_SERVER }} | ||
openshift-token: ${{ secrets.OPENSHIFT_TOKEN }} | ||
|
||
deploy: | ||
if: endsWith( github.event.pull_request.title, 'build-on-dev' ) | ||
needs: [setup-database, build] | ||
uses: ./.github/workflows/pr-dev-deploy-template.yaml | ||
with: | ||
suffix: -jan-${{ github.event.pull_request.number }} | ||
checkout-ref: refs/pull/${{ github.event.pull_request.number }}/head | ||
database-service-host-name: tfrs-spilo-jan-${{ github.event.pull_request.number }} | ||
secrets: | ||
tools-namespace: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools | ||
namespace: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-dev | ||
openshift-server: ${{ secrets.OPENSHIFT_SERVER }} | ||
openshift-token: ${{ secrets.OPENSHIFT_TOKEN }} | ||
|
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,69 @@ | ||
name: PR Dev Database Template | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
# pull request number | ||
pr-number: | ||
required: true | ||
type: string | ||
# the suffix will be appended to tfrs-spilo, same values: -1234, -jan-1242 | ||
dev-suffix: | ||
required: true | ||
type: string | ||
secrets: | ||
dev-namespace: | ||
required: true | ||
tfrs-dev-username: | ||
required: true | ||
tfrs-dev-password: | ||
required: true | ||
openshift-server: | ||
required: true | ||
openshift-token: | ||
required: true | ||
|
||
jobs: | ||
|
||
database: | ||
|
||
name: Start Database | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
|
||
steps: | ||
|
||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: refs/pull/${{ inputs.pr-number }}/head | ||
|
||
- 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.dev-namespace }} | ||
|
||
- name: Setup Database | ||
shell: bash {0} | ||
run: | | ||
cd charts/tfrs-spilo | ||
helm dependency build | ||
helm status -n ${{ secrets.dev-namespace }} tfrs-spilo${{ inputs.dev-suffix }} | ||
if [ $? -eq 0 ]; then | ||
echo "tfrs-spilo${{ inputs.dev-suffix }} exists already" | ||
else | ||
echo "Installing tfrs-spilo${{ inputs.dev-suffix }}" | ||
helm install -n ${{ secrets.dev-namespace }} -f ./values-dev.yaml --wait tfrs-spilo${{ inputs.dev-suffix }} . | ||
oc -n ${{ secrets.dev-namespace }} wait --for=condition=Ready pod/tfrs-spilo${{ inputs.dev-suffix }}-0 | ||
oc -n ${{ secrets.dev-namespace }} exec tfrs-spilo${{ inputs.dev-suffix }}-0 -- psql -c "create user \"${{ secrets.tfrs-dev-username }}\" WITH PASSWORD '${{ secrets.tfrs-dev-password }}'" || true | ||
oc -n ${{ secrets.dev-namespace }} exec tfrs-spilo${{ inputs.dev-suffix }}-0 -- psql -c "create database tfrs owner \"${{ secrets.tfrs-dev-username }}\" ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8'" || true | ||
oc -n ${{ secrets.dev-namespace }} exec tfrs-spilo${{ inputs.dev-suffix }}-0 -- psql -c "ALTER SYSTEM SET log_filename='postgresql-%H.log'" || true | ||
oc -n ${{ secrets.dev-namespace }} exec tfrs-spilo${{ inputs.dev-suffix }}-0 -- psql -c "ALTER SYSTEM SET log_connections='off'" || true | ||
oc -n ${{ secrets.dev-namespace }} exec tfrs-spilo${{ inputs.dev-suffix }}-0 -- psql -c "ALTER SYSTEM SET log_disconnections='off'" || true | ||
oc -n ${{ secrets.dev-namespace }} exec tfrs-spilo${{ inputs.dev-suffix }}-0 -- psql -c "ALTER SYSTEM SET log_checkpoints='off'" || true | ||
oc -n ${{ secrets.dev-namespace }} exec tfrs-spilo${{ inputs.dev-suffix }}-0 -- psql -c "select pg_reload_conf()" || true | ||
fi | ||
Oops, something went wrong.