From 9255e775a0fff181b06de62d3f87a5a36cb94f7f Mon Sep 17 00:00:00 2001 From: pwei1018 Date: Wed, 19 Apr 2023 09:04:50 -0700 Subject: [PATCH] Clean up for the new domain name changes. --- ppr-ui/devops/cloudbuild-cd.yaml | 30 --- ppr-ui/devops/cloudbuild-pr.yaml | 61 ++++++ ppr-ui/firebase-prod.json | 34 --- ppr-ui/firebase-test.json | 34 --- ppr-ui/{firebase-dev.json => firebase.json} | 0 ppr-ui/k8s/templates/bc.yaml | 112 ---------- ppr-ui/k8s/templates/dc.yaml | 220 -------------------- ppr-ui/package.json | 2 +- 8 files changed, 62 insertions(+), 431 deletions(-) delete mode 100644 ppr-ui/devops/cloudbuild-cd.yaml create mode 100644 ppr-ui/devops/cloudbuild-pr.yaml delete mode 100644 ppr-ui/firebase-prod.json delete mode 100644 ppr-ui/firebase-test.json rename ppr-ui/{firebase-dev.json => firebase.json} (100%) delete mode 100644 ppr-ui/k8s/templates/bc.yaml delete mode 100644 ppr-ui/k8s/templates/dc.yaml diff --git a/ppr-ui/devops/cloudbuild-cd.yaml b/ppr-ui/devops/cloudbuild-cd.yaml deleted file mode 100644 index 3a247d2bb..000000000 --- a/ppr-ui/devops/cloudbuild-cd.yaml +++ /dev/null @@ -1,30 +0,0 @@ -steps: - # install / setup ci - - name: node:$_DEPLOYMENT_NODE_VERSION - entrypoint: npm - args: ['install'] - - # - # Generate the static site - # - - name: node:$_DEPLOYMENT_NODE_VERSION - entrypoint: npm - args: ['--openssl-legacy-provider', 'run', 'build'] - - # - # Deploy to firebase channel, using the PR # - # store log to /workspace to get the channel URL - # - - name: gcr.io/$_DEPLOYMENT_PROJECT/firebase - entrypoint: bash - args: ['-c', 'firebase deploy --project=$_DEPLOYMENT_PROJECT --config=firebase-$_DEPLOYMENT_ENVIRONMENT.json --only hosting:$_DEPLOYMENT_HOST_NAME'] - -substitutions: - _DEPLOYMENT_ENVIRONMENT: '${_DEPLOYMENT_ENVIRONMENT}' - _DEPLOYMENT_PROJECT: '${_DEPLOYMENT_PROJECT}' - _DEPLOYMENT_NODE_VERSION: '${_DEPLOYMENT_NODE_VERSION}' - _DEPLOYMENT_HOST_NAME: '${_DEPLOYMENT_HOST_NAME}' - - -options: - logging: CLOUD_LOGGING_ONLY diff --git a/ppr-ui/devops/cloudbuild-pr.yaml b/ppr-ui/devops/cloudbuild-pr.yaml new file mode 100644 index 000000000..6e53c2279 --- /dev/null +++ b/ppr-ui/devops/cloudbuild-pr.yaml @@ -0,0 +1,61 @@ +steps: + # install / setup ci + - name: node:16.14.2 + entrypoint: npm + dir: "ppr-ui" + args: ['install'] + + # setup .env + - name: 'bash' + dir: "ppr-ui" + script: | + #!/usr/bin/env bash + cp .env.example .env + + # + # Generate the static site + # + - name: node:16.14.2 + dir: "ppr-ui" + entrypoint: npm + env: + - 'VUE_APP_ADDRESS_COMPLETE_KEY=$_VUE_APP_ADDRESS_COMPLETE_KEY' + - 'VUE_APP_PPR_LD_CLIENT_ID=$_VUE_APP_PPR_LD_CLIENT_ID' + args: ['--openssl-legacy-provider', 'run', 'build'] + + # + # Deploy to firebase channel, using the PR # + # store log to /workspace to get the channel URL + # + - name: gcr.io/yfthig-dev/firebase + dir: "ppr-ui" + entrypoint: bash + args: ['-c', 'firebase hosting:channel:deploy --project=yfthig-dev PR-$_PR_NUMBER > /workspace/firebase-deploy.txt'] + + # + # Update the PR with the temporary URL + # + - id: "Update the PR" + name: gcr.io/cloud-builders/curl + dir: "ppr-ui" + entrypoint: bash + args: + - -c + - | + # Read from "/workspace" + cat /workspace/firebase-deploy.txt + url=`cat /workspace/firebase-deploy.txt| grep 'Channel URL' | grep -Eo "https://[a-zA-Z0-9./?=_%:-]*"` + echo "this is the body:" + echo '{"body": "Temporary Url for review:'"$url"'"}' + curl -X POST \ + https://api.github.com/repos/bcgov/ppr/issues/$_PR_NUMBER/comments \ + --header "Authorization: Token $$TOKEN" \ + --header "Accept: application/vnd.github.v3+json" \ + --data-binary '{"body": "Temporary Url for review: '"$url"'"}' + secretEnv: ['TOKEN'] +availableSecrets: + secretManager: + - versionName: projects/$PROJECT_ID/secrets/token-pr-review/versions/latest + env: 'TOKEN' +options: + dynamic_substitutions: true diff --git a/ppr-ui/firebase-prod.json b/ppr-ui/firebase-prod.json deleted file mode 100644 index 5c717e390..000000000 --- a/ppr-ui/firebase-prod.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "hosting": - { - "site": "bcregistry-assets-prod", - "public": "dist", - "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], - "rewrites": [ - { - "source": "**", - "destination": "/index.html" - } - ], - "headers" : [ - { - "source": "**", - "headers" : [ - { "key" : "Access-Control-Allow-Origin", "value" : "*" }, - { "key" : "X-Frame-Options", "value" : "DENY" }, - { "key" : "X-Content-Type-Options", "value" : "nosniff" }, - { "key" : "X-XSS-Protection", "value" : "1; mode=block" }, - { - "key": "Content-Security-Policy", - "value": "default-src 'self'; frame-src 'self' *.gov.bc.ca *.hotjar.com *.googleapis.com https://*.nr-data.net https://*.newrelic.com https://*.cac1.pure.cloud; script-src 'self' 'unsafe-eval' 'unsafe-inline' *.gov.bc.ca *.hotjar.com *.googleapis.com https://*.nr-data.net https://*.newrelic.com https://*.cac1.pure.cloud; style-src 'self' 'unsafe-inline' *.cloudflare.com *.googleapis.com; font-src 'self' *.gov.bc.ca *.hotjar.com *.cloudflare.com *.googleapis.com *.gstatic.com *.jsdelivr.net; img-src 'self' data: *.hotjar.com https://*.cac1.pure.cloud; connect-src 'self' *.gov.bc.ca *.launchdarkly.com *.hotjar.com *.postescanada-canadapost.ca *.sentry.io *.apigee.net wss://*.hotjar.com *.hotjar.io https://*.nr-data.net https://shyrka-prod-cac1.s3.ca-central-1.amazonaws.com https://*.newrelic.com https://*.cac1.pure.cloud wss://*.cac1.pure.cloud; manifest-src 'self'; media-src 'self' https://*.cac1.pure.cloud; object-src 'self' https://*.cac1.pure.cloud; child-src 'self' https://*.cac1.pure.cloud;" - }, - { "key": "Cache-Control", "value": "no-cache, no-store, must-revalidate"}, - { "key": "Pragma", "value": "no-cache"}, - { "key": "Referrer-Policy", "value": "no-referrer" }, - { "key": "Feature-Policy", "value": "microphone 'self'" }, - { "key": "Strict-Transport-Security", "value": "max-age=31536000;" } - ] - } - ] - } -} diff --git a/ppr-ui/firebase-test.json b/ppr-ui/firebase-test.json deleted file mode 100644 index 17dcc68c0..000000000 --- a/ppr-ui/firebase-test.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "hosting": - { - "site": "bcregistry-assets-test", - "public": "dist", - "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], - "rewrites": [ - { - "source": "**", - "destination": "/index.html" - } - ], - "headers" : [ - { - "source": "**", - "headers" : [ - { "key" : "Access-Control-Allow-Origin", "value" : "*" }, - { "key" : "X-Frame-Options", "value" : "DENY" }, - { "key" : "X-Content-Type-Options", "value" : "nosniff" }, - { "key" : "X-XSS-Protection", "value" : "1; mode=block" }, - { - "key": "Content-Security-Policy", - "value": "default-src 'self'; frame-src 'self' *.gov.bc.ca *.hotjar.com *.googleapis.com https://*.nr-data.net https://*.newrelic.com https://*.cac1.pure.cloud; script-src 'self' 'unsafe-eval' 'unsafe-inline' *.gov.bc.ca *.hotjar.com *.googleapis.com https://*.nr-data.net https://*.newrelic.com https://*.cac1.pure.cloud; style-src 'self' 'unsafe-inline' *.cloudflare.com *.googleapis.com; font-src 'self' *.gov.bc.ca *.hotjar.com *.cloudflare.com *.googleapis.com *.gstatic.com *.jsdelivr.net; img-src 'self' data: *.hotjar.com https://*.cac1.pure.cloud; connect-src 'self' *.gov.bc.ca *.launchdarkly.com *.hotjar.com *.postescanada-canadapost.ca *.sentry.io *.apigee.net wss://*.hotjar.com *.hotjar.io https://*.nr-data.net https://shyrka-prod-cac1.s3.ca-central-1.amazonaws.com https://*.newrelic.com https://*.cac1.pure.cloud wss://*.cac1.pure.cloud; manifest-src 'self'; media-src 'self' https://*.cac1.pure.cloud; object-src 'self' https://*.cac1.pure.cloud; child-src 'self' https://*.cac1.pure.cloud;" - }, - { "key": "Cache-Control", "value": "no-cache, no-store, must-revalidate"}, - { "key": "Pragma", "value": "no-cache"}, - { "key": "Referrer-Policy", "value": "no-referrer" }, - { "key": "Feature-Policy", "value": "microphone 'self'" }, - { "key": "Strict-Transport-Security", "value": "max-age=31536000;" } - ] - } - ] - } -} diff --git a/ppr-ui/firebase-dev.json b/ppr-ui/firebase.json similarity index 100% rename from ppr-ui/firebase-dev.json rename to ppr-ui/firebase.json diff --git a/ppr-ui/k8s/templates/bc.yaml b/ppr-ui/k8s/templates/bc.yaml deleted file mode 100644 index 301ab3a83..000000000 --- a/ppr-ui/k8s/templates/bc.yaml +++ /dev/null @@ -1,112 +0,0 @@ -apiVersion: template.openshift.io/v1 -kind: Template -metadata: - labels: - name: ${NAME} - name: ${NAME}-build -objects: -- apiVersion: v1 - kind: ImageStream - metadata: - name: ${NAME} - labels: - name: ${NAME} -- apiVersion: v1 - kind: BuildConfig - metadata: - name: ${NAME} - labels: - name: ${NAME} - spec: - output: - to: - kind: ImageStreamTag - name: ${NAME}:${OUTPUT_IMAGE_TAG} - resources: - limits: - cpu: ${CPU_LIMIT} - memory: ${MEMORY_LIMIT} - requests: - cpu: ${CPU_REQUEST} - memory: ${MEMORY_REQUEST} - runPolicy: Serial - source: - contextDir: ${SOURCE_CONTEXT_DIR} - git: - ref: ${GIT_REF} - uri: ${GIT_REPO_URL} - dockerfile: | - FROM docker-remote.artifacts.developer.gov.bc.ca/node:16.14.2 as build-stage - WORKDIR /app - COPY ./package*.json ./ - RUN npm install - COPY . . - RUN npm run build - - FROM docker-remote.artifacts.developer.gov.bc.ca/nginx:1.18.0 as production-stage - RUN echo "hello1" - COPY nginx.conf /etc/nginx/nginx.conf - RUN echo "hello2" - RUN mkdir /app - COPY --from=build-stage /app/dist /app - EXPOSE 8080:8080 - CMD ["nginx", "-g", "daemon off;"] - type: Git - strategy: - type: Docker - dockerStrategy: - pullSecret: - name: artifactory-creds - - triggers: - - type: ConfigChange -parameters: -- description: | - The name assigned to all of the objects defined in this template. - You should keep this as default unless your know what your doing. - displayName: Name - name: NAME - required: true - value: ppr-ui -- description: | - The URL to your GIT repo, don't use the this default unless - your just experimenting. - displayName: Git Repo URL - name: GIT_REPO_URL - required: true - value: https://github.com/bcgov/ppr.git -- description: The source context directory. - displayName: Source Context Directory - name: SOURCE_CONTEXT_DIR - required: false - value: ppr-ui -- description: The git reference or branch. - displayName: Git Reference - name: GIT_REF - required: true - value: main -- description: The tag given to the built image. - displayName: Output Image Tag - name: OUTPUT_IMAGE_TAG - required: true - value: latest -- description: The resources CPU limit (in cores) for this build. - displayName: Resources CPU Limit - name: CPU_LIMIT - required: true - value: "2" -- description: The resources Memory limit (in Mi, Gi, etc) for this build. - displayName: Resources Memory Limit - name: MEMORY_LIMIT - required: true - value: 4Gi -- description: The resources CPU request (in cores) for this build. - displayName: Resources CPU Request - name: CPU_REQUEST - required: true - value: "1" -- description: The resources Memory request (in Mi, Gi, etc) for this build. - displayName: Resources Memory Request - name: MEMORY_REQUEST - required: true - value: 2Gi diff --git a/ppr-ui/k8s/templates/dc.yaml b/ppr-ui/k8s/templates/dc.yaml deleted file mode 100644 index 7e0c98043..000000000 --- a/ppr-ui/k8s/templates/dc.yaml +++ /dev/null @@ -1,220 +0,0 @@ ---- -kind: Template -apiVersion: v1 -metadata: - name: ${NAME}-${TAG}-deployment-template - annotations: - description: - Deployment template for an UI application. - tags: Vue - iconClass: icon-vue -objects: - - kind: Service - apiVersion: v1 - metadata: - name: ${NAME}-${TAG} - labels: - name: ${NAME} - environment: ${TAG} - role: ${ROLE} - spec: - ports: - - name: ${NAME}-${TAG}-tcp - port: 8080 - targetPort: 8080 - selector: - name: ${NAME} - environment: ${TAG} - - - kind: Route - apiVersion: v1 - metadata: - name: ${NAME}-${TAG} - labels: - name: ${NAME} - environment: ${TAG} - role: ${ROLE} - annotations: - haproxy.router.openshift.io/ip_whitelist: ${ALLOW_LIST} - spec: - host: ${APPLICATION_DOMAIN} - path: /ppr/ui - tls: - insecureEdgeTerminationPolicy: Redirect - termination: edge - port: - targetPort: ${NAME}-${TAG}-tcp - to: - kind: Service - name: ${NAME}-${TAG} - weight: 100 - - - kind: DeploymentConfig - apiVersion: v1 - metadata: - name: ${NAME}-${TAG} - labels: - name: ${NAME} - environment: ${TAG} - role: ${ROLE} - annotations: - description: Defines how to deploy the application server - spec: - strategy: - rollingParams: - intervalSeconds: 1 - maxSurge: 25% - maxUnavailable: 25% - timeoutSeconds: 600 - updatePeriodSeconds: 1 - type: Rolling - triggers: - - type: ImageChange - imageChangeParams: - automatic: true - containerNames: - - ${NAME}-${TAG} - from: - kind: ImageStreamTag - namespace: ${NAMESPACE}-${IMAGE_NAMESPACE} - name: ${NAME}:${TAG} - replicas: 1 - selector: - name: ${NAME} - environment: ${TAG} - template: - metadata: - name: ${NAME}-${TAG} - labels: - name: ${NAME} - environment: ${TAG} - role: ${ROLE} - spec: - volumes: - - configMap: - defaultMode: 420 - name: ${NAME}-${TAG}-ui-configuration - name: web-ui-configuration - - configMap: - defaultMode: 420 - name: ${NAME}-${TAG}-keycloak-config - name: keycloak-configuration - containers: - - name: ${NAME}-${TAG} - image: ${IMAGE_REGISTRY}/${NAMESPACE}-${IMAGE_NAMESPACE}/${NAME}:${TAG} - ports: - - name: http - containerPort: 8080 - protocol: TCP - livenessProbe: - httpGet: - path: / - port: http - readinessProbe: - httpGet: - path: / - port: http - volumeMounts: - - mountPath: /app/config - name: web-ui-configuration - readOnly: true - - mountPath: /app/config/kc - name: keycloak-configuration - readOnly: true - - kind: HorizontalPodAutoscaler - apiVersion: autoscaling/v1 - metadata: - name: ${NAME}-${TAG} - labels: - name: ${NAME} - environment: ${TAG} - role: ${ROLE} - spec: - scaleTargetRef: - kind: DeploymentConfig - name: ${NAME}-${TAG} - minReplicas: ${{MIN_REPLICAS}} - maxReplicas: ${{MAX_REPLICAS}} - -parameters: - - name: NAME - displayName: Name - description: The name assigned to all of the OpenShift resources associated to the server instance. - required: true - value: ppr-ui - - - name: TAG - displayName: Environment TAG name - description: The TAG name for this environment, e.g., dev, test, prod - value: dev - required: true - - - name: ROLE - displayName: Role - description: Role - required: true - value: ui - - - name: NAMESPACE - displayName: Namespace Name - description: The base namespace name for the project. - required: true - value: 3b2420 - - - name: IMAGE_NAMESPACE - displayName: Image Namespace - required: true - description: The namespace of the OpenShift project containing the imagestream for the application. - value: tools - - - name: IMAGE_REGISTRY - displayName: Image Registry - required: true - description: The image registry of the OpenShift project. - value: image-registry.openshift-image-registry.svc:5000 - - - name: APPLICATION_DOMAIN - displayName: Application Domain - description: The endpoint used for routing access to the application. - value: ppr-ui-dev.apps.silver.devops.gov.bc.ca - - - name: ALLOW_LIST - displayName: Allow List - description: The allow list containing all of the trusted source IPs. - required: false - - - name: MIN_REPLICAS - displayName: Minimum Replicas - description: The minimum number of pods to have running. - required: true - value: "1" - - - name: MAX_REPLICAS - displayName: Maximum Replicas - description: The maximum number of pods to have running. - required: true - value: "1" - - - name: CPU_REQUEST - displayName: Resources CPU Request - description: The resources CPU request (in cores) for this build. - required: true - value: 10m - - - name: CPU_LIMIT - displayName: Resources CPU Limit - description: The resources CPU limit (in cores) for this build. - required: true - value: 500m - - - name: MEMORY_REQUEST - displayName: Resources Memory Request - description: The resources Memory request (in Mi, Gi, etc) for this build. - required: true - value: 10Mi - - - name: MEMORY_LIMIT - displayName: Resources Memory Limit - description: The resources Memory limit (in Mi, Gi, etc) for this build. - required: true - value: 1Gi \ No newline at end of file diff --git a/ppr-ui/package.json b/ppr-ui/package.json index 20a0a2567..005026705 100644 --- a/ppr-ui/package.json +++ b/ppr-ui/package.json @@ -1,6 +1,6 @@ { "name": "ppr-ui", - "version": "1.0.10", + "version": "1.1.0", "private": true, "appName": "Assets UI", "sbcName": "SBC Common Components",