-
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
f62d278
commit bb2d57c
Showing
25 changed files
with
1,156 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,24 @@ | ||
apiVersion: v2 | ||
name: tfrs-apps | ||
description: A Helm chart for Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 1.0.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "3.0.0" |
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,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,24 @@ | ||
apiVersion: v2 | ||
name: tfrs-backend | ||
description: A Helm chart for Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "3.0.0" |
67 changes: 67 additions & 0 deletions
67
charts/tfrs-apps/charts/tfrs-backend/templates/_helpers.tpl
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,67 @@ | ||
{{/* | ||
The labels for all components: | ||
labels: | ||
helm.sh/chart: tfrs-backend-1.0.0 | ||
app.kubernetes.io/name: tfrs-backend | ||
app.kubernetes.io/instance: tfrs-backend-dev or tfrs-backend-dev-jan | ||
app.kubernetes.io/version: "3.0.0" | ||
app.kubernetes.io/managed-by: Helm | ||
The selector lables: | ||
selector: | ||
app.kubernetes.io/name: tfrs-backend | ||
app.kubernetes.io/instance: tfrs-backend-dev-1977 | ||
.Release.Name comes from command helm install | ||
example: helm install tfrs-backend-dev ... or helm install tfrs-backend-dev-jan ... | ||
.Chart.Name come from the name attribute in Chart.yaml | ||
*/}} | ||
|
||
{{/* | ||
Expand the name of the chart. If nameOverride is empty, use .Chart.Name. | ||
Typically no need to assign value to nameOverride, | ||
*/}} | ||
{{- define "tfrs-backend.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
The .Release.Name is the first parameter of command helm install tfrs-backend-dev or tfrs-backend-dev-jan | ||
*/}} | ||
{{- define "tfrs-backend.fullname" -}} | ||
{{- .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "tfrs-backend.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels: | ||
app.kubernetes.io/managed-by would be Helm | ||
*/}} | ||
{{- define "tfrs-backend.labels" -}} | ||
helm.sh/chart: {{ include "tfrs-backend.chart" . }} | ||
{{ include "tfrs-backend.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "tfrs-backend.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "tfrs-backend.name" . }} | ||
app.kubernetes.io/instance: {{ include "tfrs-backend.fullname" . }} | ||
{{- end }} | ||
|
Oops, something went wrong.