| @ -1,19 +0,0 @@ | |||
| #!/usr/bin/env bash | |||
| echo -n "Enter the name of the environment (default=dev): " | |||
| read ENVIRONMENT | |||
| ENVIRONMENT=${ENVIRONMENT:-dev} | |||
| OS_PROJECT_NAME=jag-csb-edivorce-$ENVIRONMENT | |||
| echo "Changing project to $OS_PROJECT_NAME..." | |||
| oc project $OS_PROJECT_NAME | |||
| echo -n "Enter the path to the environment creation template (default=templates/edivorce-environment-template.yaml): " | |||
| read CREATE_SCRIPT | |||
| CREATE_SCRIPT=${CREATE_SCRIPT:-templates/edivorce-environment-template.yaml} | |||
| oc create -f $CREATE_SCRIPT | |||
| /bin/bash project_label.sh $OS_PROJECT_NAME team=jag product=edivorce environment=$ENVIRONMENT | |||
| @ -1,28 +0,0 @@ | |||
| #!/usr/bin/env bash | |||
| # this is hard-coded to only destroy the dev environment | |||
| # you can chage it to 'test' or 'prod' if you are sure you want to destroy EVERYTHING, include the database | |||
| oc project jag-csb-edivorce-dev | |||
| # delete all imagestreams | |||
| oc delete is --all | |||
| # delete services by name (we don't want to accidentally delete the gluster service!) | |||
| oc delete svc weasyprint | |||
| oc delete svc postgresql | |||
| oc delete svc edivorce-django | |||
| # delete routes | |||
| oc delete route --all | |||
| # delete persistent volume claims | |||
| oc delete pvc --all | |||
| # delete replication controllers | |||
| oc delete rc --all | |||
| # delete deployment configurations | |||
| oc delete dc --all | |||
| # delete pods | |||
| oc delete po --all | |||
| @ -1,18 +1,12 @@ | |||
| node('master') { | |||
| stage 'buildInDevelopment' | |||
| stage 'buildInTools' | |||
| openshiftBuild(namespace: 'jag-csb-edivorce-tools', buildConfig: 'edivorce-django', showBuildLogs: 'true') | |||
| stage 'deployInDevelopment' | |||
| stage 'deployInDev' | |||
| openshiftTag(namespace: 'jag-csb-edivorce-tools', sourceStream: 'edivorce-django', sourceTag: 'latest', destinationNamespace: 'jag-csb-edivorce-tools', destinationStream: 'edivorce-django', destinationTag: 'deploy-to-dev') | |||
| openshiftDeploy(namespace: 'jag-csb-edivorce-dev', deploymentConfig: 'edivorce-django') | |||
| openshiftScale(namespace: 'jag-csb-edivorce-dev', deploymentConfig: 'edivorce-django',replicaCount: '1') | |||
| stage 'test' | |||
| sh 'curl -s https://justice.gov.bc.ca/divorce-dev' | |||
| stage 'deployInTesting' | |||
| openshiftTag(namespace: 'jag-csb-edivorce-tools', sourceStream: 'edivorce-django', sourceTag: 'latest', destinationNamespace: 'jag-csb-edivorce-tools', destinationStream: 'edivorce-django', destinationTag: 'deploy-to-test') | |||
| openshiftDeploy(namespace: 'jag-csb-edivorce-test', deploymentConfig: 'edivorce-django') | |||
| openshiftScale(namespace: 'jag-csb-edivorce-test', deploymentConfig: 'edivorce-django',replicaCount: '1') | |||
| } | |||
| @ -0,0 +1,8 @@ | |||
| node('master') { | |||
| stage 'deployInProd' | |||
| openshiftTag(namespace: 'jag-csb-edivorce-tools', sourceStream: 'edivorce-django', sourceTag: 'deploy-to-test', destinationNamespace: 'jag-csb-edivorce-tools', destinationStream: 'edivorce-django', destinationTag: 'deploy-to-prod') | |||
| openshiftDeploy(namespace: 'jag-csb-edivorce-prod', deploymentConfig: 'edivorce-django') | |||
| openshiftScale(namespace: 'jag-csb-edivorce-prod', deploymentConfig: 'edivorce-django',replicaCount: '1') | |||
| } | |||
| @ -0,0 +1,9 @@ | |||
| node('master') { | |||
| stage 'deployInTest' | |||
| openshiftTag(namespace: 'jag-csb-edivorce-tools', sourceStream: 'edivorce-django', sourceTag: 'deploy-to-dev', destinationNamespace: 'jag-csb-edivorce-tools', destinationStream: 'edivorce-django', destinationTag: 'deploy-to-test') | |||
| openshiftDeploy(namespace: 'jag-csb-edivorce-test', deploymentConfig: 'edivorce-django') | |||
| openshiftScale(namespace: 'jag-csb-edivorce-test', deploymentConfig: 'edivorce-django',replicaCount: '1') | |||
| } | |||
| @ -0,0 +1,114 @@ | |||
| --- | |||
| kind: Template | |||
| apiVersion: v1 | |||
| metadata: | |||
| name: edivorce-build-pipeline | |||
| labels: | |||
| template: edivorce-build-pipeline | |||
| objects: | |||
| - kind: BuildConfig | |||
| apiVersion: v1 | |||
| metadata: | |||
| name: build-and-deploy-to-dev | |||
| namespace: | |||
| labels: | |||
| name: build-and-deploy-to-dev | |||
| annotations: | |||
| pipeline.alpha.openshift.io/uses: '[{"name": "", "namespace": "", "kind": "DeploymentConfig"}]' | |||
| spec: | |||
| triggers: | |||
| - | |||
| type: GitHub | |||
| github: | |||
| secret: ${GITHUB_WEBHOOK_SECRET} | |||
| - | |||
| type: Generic | |||
| generic: | |||
| secret: ${GITHUB_WEBHOOK_SECRET} | |||
| runPolicy: Serial | |||
| source: | |||
| type: Git | |||
| git: | |||
| uri: 'https://github.com/bcgov/eDivorce' | |||
| ref: master | |||
| contextDir: openshift/jenkins | |||
| strategy: | |||
| type: JenkinsPipeline | |||
| jenkinsPipelineStrategy: | |||
| jenkinsfilePath: build-and-deploy-to-dev | |||
| output: | |||
| resources: | |||
| postCommit: | |||
| - kind: BuildConfig | |||
| apiVersion: v1 | |||
| metadata: | |||
| name: deploy-to-prod | |||
| namespace: | |||
| labels: | |||
| name: deploy-to-prod | |||
| annotations: | |||
| pipeline.alpha.openshift.io/uses: '[{"name": "", "namespace": "", "kind": "DeploymentConfig"}]' | |||
| spec: | |||
| triggers: | |||
| - | |||
| type: GitHub | |||
| github: | |||
| secret: ${GITHUB_WEBHOOK_SECRET} | |||
| - | |||
| type: Generic | |||
| generic: | |||
| secret: ${GITHUB_WEBHOOK_SECRET} | |||
| runPolicy: Serial | |||
| source: | |||
| type: Git | |||
| git: | |||
| uri: 'https://github.com/bcgov/eDivorce' | |||
| ref: master | |||
| contextDir: openshift/jenkins | |||
| strategy: | |||
| type: JenkinsPipeline | |||
| jenkinsPipelineStrategy: | |||
| jenkinsfilePath: deploy-to-prod | |||
| output: | |||
| resources: | |||
| postCommit: | |||
| - kind: BuildConfig | |||
| apiVersion: v1 | |||
| metadata: | |||
| name: deploy-to-test | |||
| namespace: | |||
| labels: | |||
| name: deploy-to-test | |||
| annotations: | |||
| pipeline.alpha.openshift.io/uses: '[{"name": "", "namespace": "", "kind": "DeploymentConfig"}]' | |||
| spec: | |||
| triggers: | |||
| - | |||
| type: GitHub | |||
| github: | |||
| secret: ${GITHUB_WEBHOOK_SECRET} | |||
| - | |||
| type: Generic | |||
| generic: | |||
| secret: ${GITHUB_WEBHOOK_SECRET} | |||
| runPolicy: Serial | |||
| source: | |||
| type: Git | |||
| git: | |||
| uri: 'https://github.com/bcgov/eDivorce' | |||
| ref: master | |||
| contextDir: openshift/jenkins | |||
| strategy: | |||
| type: JenkinsPipeline | |||
| jenkinsPipelineStrategy: | |||
| jenkinsfilePath: deploy-to-test | |||
| output: | |||
| resources: | |||
| postCommit: | |||
| parameters: | |||
| - name: GITHUB_WEBHOOK_SECRET | |||
| displayName: GitHub Webhook Secret | |||
| description: A secret string used to configure the GitHub webhook. | |||
| generate: expression | |||
| from: "[a-zA-Z0-9]{40}" | |||
| @ -1,14 +0,0 @@ | |||
| #!/usr/bin/env bash | |||
| # todo: this is an example from https://github.com/bcgov/esm-server/tree/develop/openshift | |||
| # todo: it needs to be completely reconfigured for eDivorce!!!! | |||
| #project_label.sh $OS_PROJECT_NAME category=$CATEGORY team=$TEAM product=$PRODUCT environment=$ENVIRONMENT | |||
| PROJECT_NAME=$1 | |||
| echo "Project name is $1" | |||
| for i in "${@:2}"; do | |||
| oc label --overwrite namespace/$PROJECT_NAME $i | |||
| done | |||
| @ -1,41 +0,0 @@ | |||
| #!/bin/bash | |||
| # Use this script to run one-off commands inside a container of a pod where your | |||
| # Python application code lives in. | |||
| # You can accomplish the same results by using regular commands from OpenShift. | |||
| # This script is just wrapping calls to `oc` to make it a little more | |||
| # convenient to use. In the future, the `oc` cli tool might incorporate changes | |||
| # that make this script obsolete. | |||
| # Related GitHub issues: | |||
| # - https://github.com/GoogleCloudPlatform/kubernetes/issues/8876 | |||
| # - https://github.com/openshift/origin/issues/2001 | |||
| # Usage examples: | |||
| # | |||
| # ./run-in-container.sh ./manage.py migrate | |||
| # ./run-in-container.sh ./manage.py createsuperuser | |||
| # ./run-in-container.sh ./manage.py shell | |||
| # | |||
| # If your Python pods are labeled with a name other than "django", you can use: | |||
| # | |||
| # POD_NAME=name ./run-in-container.sh ./manage.py check | |||
| # | |||
| # If there is more than one replica, you can also specify a POD by index: | |||
| # | |||
| # POD_INDEX=1 ./run-in-container.sh ./manage.py shell | |||
| # | |||
| # Or both together: | |||
| # | |||
| # POD_NAME=frontend POD_INDEX=2 ./run-in-container.sh ./manage.py shell | |||
| # Get name of a currently deployed pod by label and index | |||
| POD_INSTANCE_NAME=`oc get pods \ | |||
| -l "name=${POD_NAME:-django-frontend}" \ | |||
| -t "{{ with index .items ${POD_INDEX:-0} }}{{ .metadata.name }}{{ end }}"` | |||
| # Run command in a container of the specified pod: | |||
| oc exec -p "$POD_INSTANCE_NAME" -it -- bash -c "${@:-echo}" | |||