From d89158f72038aca1b39abe9bdc175ebcbdb87af7 Mon Sep 17 00:00:00 2001 From: jakob Date: Mon, 11 Apr 2022 13:40:15 +0000 Subject: [PATCH 1/8] use handlebar env var syntax --- .../kubectl-action/kubectl-deployment-action-factory.ts | 2 +- .../test-image/deployment/www-icelandair-com.config.yml | 2 +- .../deployment/www-icelandair-com.deployment.yml | 4 ++-- .../test-image/deployment/www-icelandair-com.service.yml | 8 ++++---- .../test-image2/deployment/image2.deployment.yml | 4 ++-- .../testimages/test-image3/deployment/image2.config.yml | 2 +- .../test-image3/deployment/image2.deployment.yml | 4 ++-- .../www-icelandair-com.deployment.yml | 4 ++-- .../www-icelandair-com/www-icelandair-com.deployment.yml | 4 ++-- .../www-icelandair-com/www-icelandair-com.service.yml | 8 ++++---- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/deployer/src/deployment-actions/kubectl-action/kubectl-deployment-action-factory.ts b/packages/deployer/src/deployment-actions/kubectl-action/kubectl-deployment-action-factory.ts index 4c8df989..8e09cb21 100644 --- a/packages/deployer/src/deployment-actions/kubectl-action/kubectl-deployment-action-factory.ts +++ b/packages/deployer/src/deployment-actions/kubectl-action/kubectl-deployment-action-factory.ts @@ -59,7 +59,7 @@ function expandEnvVariables(lines: string[]) { } export function expandEnvAndMustacheVariablesInFile(deploymentFileDescriptorContent: string) { - return expandTemplate(expandEnvVariables(deploymentFileDescriptorContent.split("\n"))) + return expandTemplate(deploymentFileDescriptorContent) } export interface ICreateKubectlDeploymentAction { diff --git a/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml b/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml index c1e3d1c5..896d87c4 100644 --- a/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml +++ b/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml @@ -6,4 +6,4 @@ metadata: team: flip data: whitelist: |- - ${Base64Decode:WWW_ICELANDAIR_IP_WHITELIST} + {{Base64Encode:WWW_ICELANDAIR_IP_WHITELIST}} diff --git a/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.deployment.yml b/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.deployment.yml index 806cd50b..dd763bce 100644 --- a/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.deployment.yml +++ b/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.deployment.yml @@ -16,7 +16,7 @@ spec: imagePullSecrets: - name: registry-pull-secret containers: - - image: ${TPL_DOCKER_IMAGE} + - image: {{TPL_DOCKER_IMAGE}} name: www-icelandair-com resources: limits: @@ -43,7 +43,7 @@ spec: - name: RUNTIME_ENVIRONMENT valueFrom: configMapKeyRef: - name: ${EXPORT1} + name: {{EXPORT1}} key: ENV - image: DOCKER_IMAGE_SSR name: www-icelandair-com-ssr diff --git a/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.service.yml b/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.service.yml index ef5872aa..ab516527 100644 --- a/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.service.yml +++ b/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.service.yml @@ -6,8 +6,8 @@ metadata: service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" labels: name: www-icelandair-com - subdomain: '${SUB_DOMAIN_PREFIX}beta' - topdomain: ${PREFIXED_TOP_DOMAIN_NAME} + subdomain: '{{SUB_DOMAIN_PREFIX}}beta' + topdomain: {{PREFIXED_TOP_DOMAIN_NAME}} team: flip spec: type: LoadBalancer @@ -30,8 +30,8 @@ metadata: service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" labels: name: www-icelandair-com - subdomain: ${SUB_DOMAIN_PREFIX}beta - topdomain: ${PREFIXED_TOP_DOMAIN_NAME} + subdomain: {{SUB_DOMAIN_PREFIX}}beta + topdomain: {{PREFIXED_TOP_DOMAIN_NAME}} team: flip spec: type: LoadBalancer diff --git a/packages/deployer/src/integratedtest/testimages/test-image2/deployment/image2.deployment.yml b/packages/deployer/src/integratedtest/testimages/test-image2/deployment/image2.deployment.yml index df0a0130..9b8a2b44 100644 --- a/packages/deployer/src/integratedtest/testimages/test-image2/deployment/image2.deployment.yml +++ b/packages/deployer/src/integratedtest/testimages/test-image2/deployment/image2.deployment.yml @@ -16,7 +16,7 @@ spec: imagePullSecrets: - name: registry-pull-secret containers: - - image: ${TPL_DOCKER_IMAGE} + - image: {{TPL_DOCKER_IMAGE}} name: image2 resources: limits: @@ -43,7 +43,7 @@ spec: - name: RUNTIME_ENVIRONMENT valueFrom: configMapKeyRef: - name: ${EXPORT1} + name: {{EXPORT1}} key: ENV - image: DOCKER_IMAGE_SSR name: image2-ssr diff --git a/packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.config.yml b/packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.config.yml index 7bbeb119..edd4a371 100644 --- a/packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.config.yml +++ b/packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.config.yml @@ -6,4 +6,4 @@ metadata: team: flip data: whitelist: |- - ${Base64Decode:WWW_ICELANDAIR_IP_WHITELIST} + {{Base64Decode WWW_ICELANDAIR_IP_WHITELIST}} diff --git a/packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.deployment.yml b/packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.deployment.yml index df0a0130..9b8a2b44 100644 --- a/packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.deployment.yml +++ b/packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.deployment.yml @@ -16,7 +16,7 @@ spec: imagePullSecrets: - name: registry-pull-secret containers: - - image: ${TPL_DOCKER_IMAGE} + - image: {{TPL_DOCKER_IMAGE}} name: image2 resources: limits: @@ -43,7 +43,7 @@ spec: - name: RUNTIME_ENVIRONMENT valueFrom: configMapKeyRef: - name: ${EXPORT1} + name: {{EXPORT1}} key: ENV - image: DOCKER_IMAGE_SSR name: image2-ssr diff --git a/packages/deployer/src/testdata/deployment-dirs/www-icelandair-com-deleted/www-icelandair-com.deployment.yml b/packages/deployer/src/testdata/deployment-dirs/www-icelandair-com-deleted/www-icelandair-com.deployment.yml index e7e01fc0..676ea158 100644 --- a/packages/deployer/src/testdata/deployment-dirs/www-icelandair-com-deleted/www-icelandair-com.deployment.yml +++ b/packages/deployer/src/testdata/deployment-dirs/www-icelandair-com-deleted/www-icelandair-com.deployment.yml @@ -16,7 +16,7 @@ spec: imagePullSecrets: - name: registry-pull-secret containers: - - image: ${TPL_DOCKER_IMAGE} + - image: {{TPL_DOCKER_IMAGE}} name: www-icelandair-com resources: limits: @@ -43,7 +43,7 @@ spec: - name: RUNTIME_ENV2 valueFrom: configMapKeyRef: - name: ${EXPORT2} + name: {{EXPORT2}} key: ENV - image: DOCKER_IMAGE_SSR name: www-icelandair-com-ssr diff --git a/packages/deployer/src/testdata/deployment-dirs/www-icelandair-com/www-icelandair-com.deployment.yml b/packages/deployer/src/testdata/deployment-dirs/www-icelandair-com/www-icelandair-com.deployment.yml index f54c8216..f87a440d 100644 --- a/packages/deployer/src/testdata/deployment-dirs/www-icelandair-com/www-icelandair-com.deployment.yml +++ b/packages/deployer/src/testdata/deployment-dirs/www-icelandair-com/www-icelandair-com.deployment.yml @@ -16,7 +16,7 @@ spec: imagePullSecrets: - name: registry-pull-secret containers: - - image: ${TPL_DOCKER_IMAGE} + - image: {{TPL_DOCKER_IMAGE}} secondaryImage: {{{ TPL_DOCKER_IMAGE }}} name: www-icelandair-com resources: @@ -44,7 +44,7 @@ spec: - name: RUNTIME_ENV2 valueFrom: configMapKeyRef: - name: ${EXPORT2} + name: {{EXPORT2}} key: ENV - name: RUNTIME_ENV_3 value: {{BRANCH_NAME}} diff --git a/packages/deployer/src/testdata/deployment-dirs/www-icelandair-com/www-icelandair-com.service.yml b/packages/deployer/src/testdata/deployment-dirs/www-icelandair-com/www-icelandair-com.service.yml index a667a179..b16fa140 100644 --- a/packages/deployer/src/testdata/deployment-dirs/www-icelandair-com/www-icelandair-com.service.yml +++ b/packages/deployer/src/testdata/deployment-dirs/www-icelandair-com/www-icelandair-com.service.yml @@ -6,8 +6,8 @@ metadata: service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" labels: name: www-icelandair-com - subdomain: ${SUB_DOMAIN_PREFIX}beta - topdomain: ${PREFIXED_TOP_DOMAIN_NAME} + subdomain: {{SUB_DOMAIN_PREFIX}}beta + topdomain: {{PREFIXED_TOP_DOMAIN_NAME}} team: flip spec: type: LoadBalancer @@ -30,8 +30,8 @@ metadata: service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" labels: name: www-icelandair-com - subdomain: ${SUB_DOMAIN_PREFIX}beta - topdomain: ${PREFIXED_TOP_DOMAIN_NAME} + subdomain: {{SUB_DOMAIN_PREFIX}}beta + topdomain: {{PREFIXED_TOP_DOMAIN_NAME}} team: flip spec: type: LoadBalancer From c87daee3319eacae217e5e61cbe0175a15a34a35 Mon Sep 17 00:00:00 2001 From: jakob Date: Mon, 11 Apr 2022 13:46:09 +0000 Subject: [PATCH 2/8] fix base64encode in yaml --- .../testimages/test-image-json-metadata/kube.yaml | 2 +- .../test-image/deployment/www-icelandair-com.config.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/deployer/src/integratedtest/testimages/test-image-json-metadata/kube.yaml b/packages/deployer/src/integratedtest/testimages/test-image-json-metadata/kube.yaml index 770c1302..ac33201b 100644 --- a/packages/deployer/src/integratedtest/testimages/test-image-json-metadata/kube.yaml +++ b/packages/deployer/src/integratedtest/testimages/test-image-json-metadata/kube.yaml @@ -1,6 +1,6 @@ apiVersion: v1 data: - {{SECRET_KEY}}: {{Base64Encode:SECRET_TEXT}} + {{SECRET_KEY}}: {{Base64Encode SECRET_TEXT}} kind: Secret metadata: imagename: DOCKER_IMAGE diff --git a/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml b/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml index 896d87c4..42a70d9f 100644 --- a/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml +++ b/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml @@ -6,4 +6,4 @@ metadata: team: flip data: whitelist: |- - {{Base64Encode:WWW_ICELANDAIR_IP_WHITELIST}} + {{Base64Encode WWW_ICELANDAIR_IP_WHITELIST}} From e6fd07e4e17d6b8a8d7b0c41b575355c459911b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0laugur=20S=2E=20Egilsson?= Date: Mon, 11 Apr 2022 14:24:39 +0000 Subject: [PATCH 3/8] Move test images to a separate package to get shepherd-build-docker correctly installed for building. --- packages/deployer/package.json | 3 +- .../deployment-plan-loading.spec.ts | 6 +- .../testimages/test-image2/entrypoint.sh | 7 - .../testimages/test-image3/entrypoint.sh | 7 - .../entrypoint.sh | 12 - .../kube.yaml | 36 -- .../test-migration-image-newformat/Dockerfile | 8 - .../integratedtest/shepherd.integratedtest.ts | 335 ++++++++++++++++++ .../testimages/build-test-images.sh | 3 +- .../Dockerfile | 0 .../entrypoint.sh | 0 .../shepherd.json | 0 .../test-image-json-metadata/Dockerfile | 0 .../test-image-json-metadata/build-docker.sh | 0 .../test-image-json-metadata/kube.yaml | 0 .../test-image-json-metadata/shepherd.json | 0 .../Dockerfile | 0 .../deployment/image.config.yml | 0 .../shepherd.json | 0 .../testimages/test-image/Dockerfile | 0 .../testimages/test-image/build-docker.sh | 0 .../test-image/deployment/.gitignore | 0 .../www-icelandair-com-internal.service.yml | 0 .../deployment/www-icelandair-com.config.yml | 0 .../www-icelandair-com.deployment.yml | 0 .../deployment/www-icelandair-com.service.yml | 0 .../testimages/test-image2/Dockerfile | 0 .../testimages/test-image2/build-docker.sh | 0 .../deployment/image2.deployment.yml | 0 .../test-image2/deployment/image2.service.yml | 0 .../testimages/test-image2}/entrypoint.sh | 0 .../testimages/test-image3/Dockerfile | 0 .../testimages/test-image3/build-docker.sh | 0 .../test-image3/deployment/image2.config.yml | 0 .../deployment/image2.deployment.yml | 0 .../test-image3/deployment/image2.service.yml | 0 .../testimages/test-image3}/entrypoint.sh | 0 .../testimages/test-infrastructure/Dockerfile | 0 .../test-infrastructure/entrypoint.sh | 0 .../test-infrastructure/shepherd.json | 0 .../Dockerfile | 0 .../shepherd.json | 0 .../entrypoint.sh | 0 .../shepherd.json | 0 .../test-migration-image/Dockerfile | 0 .../test-migration-image/build-docker.sh | 0 packages/test-images/package.json | 29 ++ packages/versionist/package.json | 1 - 48 files changed, 370 insertions(+), 77 deletions(-) delete mode 100755 packages/deployer/src/integratedtest/testimages/test-image2/entrypoint.sh delete mode 100755 packages/deployer/src/integratedtest/testimages/test-image3/entrypoint.sh delete mode 100755 packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/entrypoint.sh delete mode 100644 packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/kube.yaml delete mode 100644 packages/deployer/src/integratedtest/testimages/test-migration-image-newformat/Dockerfile create mode 100644 packages/test-images/integratedtest/shepherd.integratedtest.ts rename packages/{deployer/src => test-images}/integratedtest/testimages/build-test-images.sh (95%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-deployer-image-with-deployment-tests/Dockerfile (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-deployer-image-with-deployment-tests/entrypoint.sh (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-deployer-image-with-deployment-tests/shepherd.json (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image-json-metadata/Dockerfile (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image-json-metadata/build-docker.sh (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image-json-metadata/kube.yaml (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image-json-metadata/shepherd.json (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/Dockerfile (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/deployment/image.config.yml (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/shepherd.json (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image/Dockerfile (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image/build-docker.sh (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image/deployment/.gitignore (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image/deployment/www-icelandair-com-internal.service.yml (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image/deployment/www-icelandair-com.deployment.yml (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image/deployment/www-icelandair-com.service.yml (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image2/Dockerfile (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image2/build-docker.sh (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image2/deployment/image2.deployment.yml (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image2/deployment/image2.service.yml (100%) rename packages/{deployer/src/integratedtest/testimages/test-image-json-metadata => test-images/integratedtest/testimages/test-image2}/entrypoint.sh (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image3/Dockerfile (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image3/build-docker.sh (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image3/deployment/image2.config.yml (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image3/deployment/image2.deployment.yml (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-image3/deployment/image2.service.yml (100%) rename packages/{deployer/src/integratedtest/testimages/test-image => test-images/integratedtest/testimages/test-image3}/entrypoint.sh (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-infrastructure/Dockerfile (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-infrastructure/entrypoint.sh (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-infrastructure/shepherd.json (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-k8s-image-with-deployment-tests/Dockerfile (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-k8s-image-with-deployment-tests/shepherd.json (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-migration-image-newformat/entrypoint.sh (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-migration-image-newformat/shepherd.json (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-migration-image/Dockerfile (100%) rename packages/{deployer/src => test-images}/integratedtest/testimages/test-migration-image/build-docker.sh (100%) create mode 100644 packages/test-images/package.json diff --git a/packages/deployer/package.json b/packages/deployer/package.json index 00e9cb93..3d7f5ea4 100644 --- a/packages/deployer/package.json +++ b/packages/deployer/package.json @@ -49,13 +49,12 @@ "typescript": "^3.7.3" }, "scripts": { - "build-test-images": "cd src/integratedtest/testimages && ./build-test-images.sh", "start-postgres": "docker run --rm --name postgres -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres", "kill-postgres": "docker stop postgres", "specs": "mocha --exit --require ts-node/register --recursive 'src/**/*.spec.ts'", "coverage": "TS_NODE_COMPILER_OPTIONS='{\"removeComments\":false}' nyc mocha --require ts-node/register --require source-map-support/register --recursive 'src/**/*.spec.ts'", "tdd": "mocha --exit -R dot --require ts-node/register --recursive --watch-extensions ts --watch 'src/**/*.spec.ts'", - "integratedtest": "yarn build && yarn build-test-images && mocha --exit --recursive 'dist/integratedtest/**/*.integratedtest.js'", + "integratedtest": "yarn build && mocha --exit --recursive 'dist/integratedtest/**/*.integratedtest.js'", "compile-in-background": "tsc -w > /dev/null &", "itdd": "npm run compile-in-background && mocha --exit --require ts-node/register --recursive --watch-extensions ts,js,sh --watch 'src/**/*.integratedtest.ts'", "test": "yarn specs", diff --git a/packages/deployer/src/deployment-plan/deployment-plan-loading.spec.ts b/packages/deployer/src/deployment-plan/deployment-plan-loading.spec.ts index 3d50a67a..1aa3faf1 100644 --- a/packages/deployer/src/deployment-plan/deployment-plan-loading.spec.ts +++ b/packages/deployer/src/deployment-plan/deployment-plan-loading.spec.ts @@ -309,7 +309,7 @@ describe("Docker image plan loader", function() { }) }) - describe("missing env variable", function() { + describe("missing env variable, #2", function() { let loadError: Error before(function() { delete process.env.EXPORT1 @@ -410,7 +410,7 @@ describe("Docker image plan loader", function() { }) }) - describe("missing env variable", function() { + xdescribe("missing env variable, $ is now obsolete", function() { let loadError: Error before(async function() { delete process.env.EXPORT1 @@ -436,7 +436,7 @@ describe("Docker image plan loader", function() { }) }) - describe("missing env variable for base64 decoding", function() { + xdescribe("missing env variable for base64 decoding, $ variable is obsolete, redesign this test", function() { let loadError: Error before(async function() { process.env.EXPORT1 = "qwerty" diff --git a/packages/deployer/src/integratedtest/testimages/test-image2/entrypoint.sh b/packages/deployer/src/integratedtest/testimages/test-image2/entrypoint.sh deleted file mode 100755 index e821c814..00000000 --- a/packages/deployer/src/integratedtest/testimages/test-image2/entrypoint.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -echo "LineOne" -echo "LineTwo" ->&2 echo "TESTING LINE-BY-LINE ERROR OUTPUT" -echo "LineThree should be shown" - diff --git a/packages/deployer/src/integratedtest/testimages/test-image3/entrypoint.sh b/packages/deployer/src/integratedtest/testimages/test-image3/entrypoint.sh deleted file mode 100755 index e821c814..00000000 --- a/packages/deployer/src/integratedtest/testimages/test-image3/entrypoint.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -echo "LineOne" -echo "LineTwo" ->&2 echo "TESTING LINE-BY-LINE ERROR OUTPUT" -echo "LineThree should be shown" - diff --git a/packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/entrypoint.sh b/packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/entrypoint.sh deleted file mode 100755 index 5c47735c..00000000 --- a/packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/entrypoint.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -echo Executing docker command "$@" -if [ "$1" = "pretest" ]; then - echo Pre test exit with code ${PRETEST_EXITCODE} - exit ${PRETEST_EXITCODE} -elif [ "$1" = "posttest" ]; then - echo Post test exit with code ${POSTTEST_EXITCODE} - exit ${POSTTEST_EXITCODE} -else - exec "$@" -fi diff --git a/packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/kube.yaml b/packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/kube.yaml deleted file mode 100644 index e663848f..00000000 --- a/packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/kube.yaml +++ /dev/null @@ -1,36 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - imagename: DOCKER_IMAGE ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: deployment-one-to-roll-back - labels: - ttl-hours: '66' -spec: - replicas: 1 - template: - metadata: - labels: - app: just-a-test-deployment - environment: dev - origin: new-branch - spec: - containers: - - name: just-a-test-deployment - image: DOCKER_IMAGE - imagePullPolicy: IfNotPresent - env: - - name: FEATURES_ON - value: 'true' - readinessProbe: - httpGet: - path: / - port: 80 - initialDelaySeconds: 15 - timeoutSeconds: 4 - ports: - - containerPort: 80 - name: httpport diff --git a/packages/deployer/src/integratedtest/testimages/test-migration-image-newformat/Dockerfile b/packages/deployer/src/integratedtest/testimages/test-migration-image-newformat/Dockerfile deleted file mode 100644 index 61a090d4..00000000 --- a/packages/deployer/src/integratedtest/testimages/test-migration-image-newformat/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM alpine:3.4 - -ADD entrypoint.sh ./entrypoint.sh - -ARG SHEPHERD_METADATA -LABEL shepherd.metadata=${SHEPHERD_METADATA} - -ENTRYPOINT ["./entrypoint.sh"] diff --git a/packages/test-images/integratedtest/shepherd.integratedtest.ts b/packages/test-images/integratedtest/shepherd.integratedtest.ts new file mode 100644 index 00000000..6eefea7c --- /dev/null +++ b/packages/test-images/integratedtest/shepherd.integratedtest.ts @@ -0,0 +1,335 @@ +import * as _ from "lodash" + +import { PgConfig, PostgresStore as PgBackend } from "@shepherdorg/postgres-backend" + +import script, { TScriptTestExecution } from "@shepherdorg/deployer/dist/test-tools/script-test" +import { TFileSystemPath } from "@shepherdorg/deployer/dist/helpers/basic-types" +import { base64Encode } from "@shepherdorg/deployer/dist/template/base64-env-subst" +import { IPostgresStorageBackend } from "@shepherdorg/postgres-backend" +import { expect } from "chai" + +const fs = require("fs") +const path = require("path") +const cleanDir = require("@shepherdorg/deployer/dist/test-tools/clean-dir") + +function ensureCleanOutputFolder(firstRoundFolder: TFileSystemPath) { + if (!fs.existsSync(firstRoundFolder)) { + fs.mkdirSync(firstRoundFolder) + } + cleanDir(firstRoundFolder, false) +} + +describe("running shepherd", function() { + let shepherdTestHarness = path.join(process.cwd(), "testbin/test-shepherd.sh") + + this.timeout(40000) + + beforeEach(function() { + if (!fs.existsSync("./.build/.testdata")) { + fs.mkdirSync("./.build/.testdata") + } + if (!fs.existsSync("./.build/.testdata")) { + fs.mkdirSync("./.build/.testdata") + } + if (!fs.existsSync("./.build/.testdata/actual")) { + fs.mkdirSync("./.build/.testdata/actual") + } + cleanDir("./.build/.testdata/actual", false) + }) + + describe("using file state storage", function() { + beforeEach(() => { + delete process.env.SHEPHERD_UI_API_ENDPOINT + let shepherdStoreDir = "./.build/.shepherdstore" + cleanDir(shepherdStoreDir) + }) + + it("should deploy everything", function(done) { + script + .execute(shepherdTestHarness, ["--dryrun"], { + env: _.extend({}, process.env, { + SHEPHERD_PG_HOST: "", + INFRASTRUCTURE_IMPORTED_ENV: "thatsme", + SERVICE_HOST_NAME: "svc.host.somewhere", + }), + }) + .ignoreLinesWith(["buildDate", "lastCommits", "kubeConfigB64", "gitHash"]) + .output("./.build/.testdata/kubeapply") + .shouldEqual("./src/integratedtest/expected/all-deployments") + .done(function() { + done() + }) + }) + }) + + describe("adding to herd", function() { + let tempHerdFilePath = path.resolve("./.build/herd-for-editing.yaml") + + beforeEach(() => { + let shepherdStoreDir = "./.build/.shepherdstore" + cleanDir(shepherdStoreDir) + cleanDir("./.build/.testdata/testexport", false) + + fs.copyFileSync("./src/herd-loading/testdata/herd-editing/herd.yaml", tempHerdFilePath) + }) + + it("should add deployment to herd", done => { + script + .execute(shepherdTestHarness, ["--dryrun", tempHerdFilePath], { + env: _.extend({}, process.env, { + SHEPHERD_PG_HOST: "", + UPSTREAM_IMAGE_URL: "testenvimage:0.0.0", + UPSTREAM_HERD_KEY: "addedimage", + UPSTREAM_HERD_DESCRIPTION: "Just a casual e2e test", + }), + }) + .stdout() + .shouldContain("Adding addedimage") + .stdout() + .shouldContain("Deploying addedimage") + .stdout() + .shouldContain("Executing deployment plan dryrun...") + .stdout() + .shouldContain("...plan dryrun execution complete") + .done(function() { + done() + }) + }) + }) + + describe("use of state storage", function() { + const EXPECTED_STATE_STORE_KEYS = [ + "integratedtestenv-Service_image2", + "integratedtestenv-Service_www-fromdir", + "integratedtestenv-Service_www-icelandair-com-internal", + "integratedtestenv-Service_www-icelandair-com-internal-test1", + "integratedtestenv-Deployment_image2", + "integratedtestenv-Namespace_monitors", + "integratedtestenv-ConfigMap_www-icelandair-com-nginx-acls", + "integratedtestenv-ConfigMap_www-icelandair-com-nginx-acls-test1", + "integratedtestenv-ConfigMap_image2-config", + "integratedtestenv-Deployment_www-icelandair-com", + "integratedtestenv-Deployment_www-icelandair-com-test1", + "integratedtestenv-Service_www-icelandair-com", + "integratedtestenv-Service_www-icelandair-com-test1", + "integratedtestenv-test-migration-image-newformat", + "integratedtestenv-testenvimage-migrations:0.0.0", + "integratedtestenv-testInfrastructure", + ] + + const firstRoundFolder = path.join(process.cwd(), "./.build/kubeapply") + const secondRoundFolder = path.join(process.cwd(), "./.build/kubeapply-secondround") + let pgBackend: IPostgresStorageBackend + let firstRun: TScriptTestExecution + let secondRun: TScriptTestExecution + + before(function(done) { + if (!process.env.SHEPHERD_PG_HOST) { + process.env.SHEPHERD_PG_HOST = "localhost" + } + process.env.RESET_FOR_REAL = "yes-i-really-want-to-drop-deployments-table" + process.env.UPSTREAM_WAIT_FOR_ROLLOUT = "true" + let config = PgConfig() + pgBackend = PgBackend(config) + + ensureCleanOutputFolder(firstRoundFolder) + ensureCleanOutputFolder(secondRoundFolder) + + let postgresConnectionError = (err: Error) => { + throw new Error("Error connecting to postgres! Cause: " + err.message) + } + pgBackend + .connect() + .catch(postgresConnectionError) + .then(() => { + pgBackend.resetAllDeploymentStates().catch((resetError: Error) => { + console.error(`RESET ERROR !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!`, resetError) + return resetError + }) + }) + .then(() => { + process.env.KUBECTL_OUTPUT_FOLDER = firstRoundFolder + + let testEnv = { INFRASTRUCTURE_IMPORTED_ENV: "thatsme", SERVICE_HOST_NAME: "svc.host.somewhere" } + firstRun = script + .execute(shepherdTestHarness, [], { + env: _.extend(testEnv, process.env), + }) + .done(function(_stdout) { + // console.log(`stdout`, stdout) + process.env.KUBECTL_OUTPUT_FOLDER = secondRoundFolder + + secondRun = script + .execute(shepherdTestHarness, [], { + env: _.extend(testEnv, process.env), + }) + .done(function(_stdout) { + done() + }) + }) + }) + .catch((setupError: Error) => { + console.error(`Error setting up for test!`, setupError) + }) + }) + + it("should deploy once in two runs", function() { + firstRun + .output(firstRoundFolder) + .shouldEqual(process.cwd() + "/src/integratedtest/expected/k8s-deployments") + .checkExpectations() + secondRun + .output(secondRoundFolder) + .shouldBeEmptyDir() + .checkExpectations() + }) + + EXPECTED_STATE_STORE_KEYS.forEach(expectedKey => { + it(`should store ${expectedKey} in backend`, () => { + return pgBackend.get(expectedKey).then(resultingState => { + expect(resultingState.value).not.to.equal(undefined) + }) + }) + }) + }) + + describe("postDeployTest support", function() { + beforeEach(() => { + const firstRoundFolder = path.join(process.cwd(), "./.build/kubeapply") + ensureCleanOutputFolder(firstRoundFolder) + + process.env.KUBECTL_OUTPUT_FOLDER = firstRoundFolder + delete process.env.SHEPHERD_UI_API_ENDPOINT + let shepherdStoreDir = "./.build/.shepherdstore" + cleanDir(shepherdStoreDir) + }) + + it(" should fail on post tests and attempt to rollback to previous version, independently on deployment plans, and exit with number of failing plans", function(done) { + script + .execute(shepherdTestHarness, ["--fakerun", "src/herd-loading/testdata/deploytestherd/herd.yaml"], { + env: _.extend({}, process.env, { + SHEPHERD_PG_HOST: "", + FAIL_POSTDEPLOY_TEST: true, + PRETEST_EXITCODE: "0", + POSTTEST_EXITCODE: "1", + }), + }) + .expectExitCode(1) + .stdout() + .shouldContain("Executing docker command pretest") + .stdout() + .shouldContain("Executing docker command pretest") + .stdout() + .shouldContain("Post test exit with code 1") + .stdout() + .shouldContain("Executing docker command deploy") + .stdout() + .shouldContain("Yessir, deploying now") + .stdout() + .shouldContain("Executing docker command posttest") + .stdout() + .shouldContain("Test run failed, rolling back to last good version.") + .stdout() + .shouldContain("Rollback complete.") + .stdout() + .shouldContain("Execution of 1 deployment plan(s) resulted in failure") + .stdout() + .shouldNotContain("not found") + .done(function(_output, _code) { + done() + }) + }) + }) + + xit("should execute infrastructure deployers first to completion", () => {}) + + describe("with state storage", function() { + beforeEach(function() { + if (!process.env.SHEPHERD_PG_HOST) { + process.env.SHEPHERD_PG_HOST = "localhost" + } + + process.env.RESET_FOR_REAL = "yes-i-really-want-to-drop-deployments-table" + let pgBackend = PgBackend(PgConfig()) + + cleanDir("./.build/.testdata/testexport", false) + + return pgBackend + .connect() + .then(() => pgBackend.resetAllDeploymentStates()) + .catch((err: Error) => { + throw new Error("Error connecting to postgres! Cause: " + err.message) + }) + }) + + it("should modify branch deployment", function(done) { + script + .execute(shepherdTestHarness, ["--dryrun"], { + env: _.extend( + { + INFRASTRUCTURE_IMPORTED_ENV: "thatsme", + SERVICE_HOST_NAME: "svc.host.somewhere", + }, + process.env + ), + }) + .done(function() { + done() + }) + }) + + const testEnv = { + www_icelandair_com_image: "www-image:99", + PREFIXED_TOP_DOMAIN_NAME: "testtopdomain", + SUB_DOMAIN_PREFIX: "testSDP", + WWW_ICELANDAIR_IP_WHITELIST: base64Encode("teststring"), + DEBUG_MODE: "false", + PERFORMANCE_LOG: "false", + MICROSERVICES_POSTGRES_RDS_HOST: "postgres-local", + MICRO_SITES_DB_PASSWORD: "somedbpass", + ENV: "testit", + EXPORT1: "nowhardcoded", + SERVICE_HOST_NAME: "svc.host.somewhere", + } + + beforeEach(function() { + if (!fs.existsSync(".build")) { + fs.mkdirSync(".build") + } + if (!fs.existsSync(".build/testexport")) { + fs.mkdirSync(".build/testexport") + } + cleanDir(".build/testexport", false) + }) + + it("should export deployment documents directly", function(done) { + let expectedOutputFileOrDir = process.cwd() + "/src/integratedtest/expected/exported" + script + .execute( + "./dist/shepherd.js", + [ + "./src/herd-loading/testdata/happypath/herd.yaml", + "integratedtestenv", + "--export", + "--outputDir", + ".build/testexport", + ], + { + env: _.extend( + { + GLOBAL_MIGRATION_ENV_VARIABLE_ONE: "justAValue", + INFRASTRUCTURE_IMPORTED_ENV: "thatsme", + }, + testEnv, + process.env + ), + } + ) + .output(".build/testexport") + .shouldEqual(expectedOutputFileOrDir) + .done(function() { + done() + }) + }) + }) +}) diff --git a/packages/deployer/src/integratedtest/testimages/build-test-images.sh b/packages/test-images/integratedtest/testimages/build-test-images.sh similarity index 95% rename from packages/deployer/src/integratedtest/testimages/build-test-images.sh rename to packages/test-images/integratedtest/testimages/build-test-images.sh index 54a828fc..e779dd59 100755 --- a/packages/deployer/src/integratedtest/testimages/build-test-images.sh +++ b/packages/test-images/integratedtest/testimages/build-test-images.sh @@ -1,11 +1,12 @@ #!/usr/bin/env bash THISDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + set -eao pipefail unset DOCKER_REGISTRY_HOST -export PATH=$PATH:${THISDIR}/node_modules/.bin export FORCE_REBUILD=true + echo "Rebuilding test images" (cd ${THISDIR}/test-migration-image/ && ./build-docker.sh) (cd ${THISDIR}/test-image && ./build-docker.sh) diff --git a/packages/deployer/src/integratedtest/testimages/test-deployer-image-with-deployment-tests/Dockerfile b/packages/test-images/integratedtest/testimages/test-deployer-image-with-deployment-tests/Dockerfile similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-deployer-image-with-deployment-tests/Dockerfile rename to packages/test-images/integratedtest/testimages/test-deployer-image-with-deployment-tests/Dockerfile diff --git a/packages/deployer/src/integratedtest/testimages/test-deployer-image-with-deployment-tests/entrypoint.sh b/packages/test-images/integratedtest/testimages/test-deployer-image-with-deployment-tests/entrypoint.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-deployer-image-with-deployment-tests/entrypoint.sh rename to packages/test-images/integratedtest/testimages/test-deployer-image-with-deployment-tests/entrypoint.sh diff --git a/packages/deployer/src/integratedtest/testimages/test-deployer-image-with-deployment-tests/shepherd.json b/packages/test-images/integratedtest/testimages/test-deployer-image-with-deployment-tests/shepherd.json similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-deployer-image-with-deployment-tests/shepherd.json rename to packages/test-images/integratedtest/testimages/test-deployer-image-with-deployment-tests/shepherd.json diff --git a/packages/deployer/src/integratedtest/testimages/test-image-json-metadata/Dockerfile b/packages/test-images/integratedtest/testimages/test-image-json-metadata/Dockerfile similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image-json-metadata/Dockerfile rename to packages/test-images/integratedtest/testimages/test-image-json-metadata/Dockerfile diff --git a/packages/deployer/src/integratedtest/testimages/test-image-json-metadata/build-docker.sh b/packages/test-images/integratedtest/testimages/test-image-json-metadata/build-docker.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image-json-metadata/build-docker.sh rename to packages/test-images/integratedtest/testimages/test-image-json-metadata/build-docker.sh diff --git a/packages/deployer/src/integratedtest/testimages/test-image-json-metadata/kube.yaml b/packages/test-images/integratedtest/testimages/test-image-json-metadata/kube.yaml similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image-json-metadata/kube.yaml rename to packages/test-images/integratedtest/testimages/test-image-json-metadata/kube.yaml diff --git a/packages/deployer/src/integratedtest/testimages/test-image-json-metadata/shepherd.json b/packages/test-images/integratedtest/testimages/test-image-json-metadata/shepherd.json similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image-json-metadata/shepherd.json rename to packages/test-images/integratedtest/testimages/test-image-json-metadata/shepherd.json diff --git a/packages/deployer/src/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/Dockerfile b/packages/test-images/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/Dockerfile similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/Dockerfile rename to packages/test-images/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/Dockerfile diff --git a/packages/deployer/src/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/deployment/image.config.yml b/packages/test-images/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/deployment/image.config.yml similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/deployment/image.config.yml rename to packages/test-images/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/deployment/image.config.yml diff --git a/packages/deployer/src/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/shepherd.json b/packages/test-images/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/shepherd.json similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/shepherd.json rename to packages/test-images/integratedtest/testimages/test-image-with-yaml-wrecking-hbs/shepherd.json diff --git a/packages/deployer/src/integratedtest/testimages/test-image/Dockerfile b/packages/test-images/integratedtest/testimages/test-image/Dockerfile similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image/Dockerfile rename to packages/test-images/integratedtest/testimages/test-image/Dockerfile diff --git a/packages/deployer/src/integratedtest/testimages/test-image/build-docker.sh b/packages/test-images/integratedtest/testimages/test-image/build-docker.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image/build-docker.sh rename to packages/test-images/integratedtest/testimages/test-image/build-docker.sh diff --git a/packages/deployer/src/integratedtest/testimages/test-image/deployment/.gitignore b/packages/test-images/integratedtest/testimages/test-image/deployment/.gitignore similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image/deployment/.gitignore rename to packages/test-images/integratedtest/testimages/test-image/deployment/.gitignore diff --git a/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com-internal.service.yml b/packages/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com-internal.service.yml similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com-internal.service.yml rename to packages/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com-internal.service.yml diff --git a/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml b/packages/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml rename to packages/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml diff --git a/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.deployment.yml b/packages/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com.deployment.yml similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.deployment.yml rename to packages/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com.deployment.yml diff --git a/packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.service.yml b/packages/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com.service.yml similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image/deployment/www-icelandair-com.service.yml rename to packages/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com.service.yml diff --git a/packages/deployer/src/integratedtest/testimages/test-image2/Dockerfile b/packages/test-images/integratedtest/testimages/test-image2/Dockerfile similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image2/Dockerfile rename to packages/test-images/integratedtest/testimages/test-image2/Dockerfile diff --git a/packages/deployer/src/integratedtest/testimages/test-image2/build-docker.sh b/packages/test-images/integratedtest/testimages/test-image2/build-docker.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image2/build-docker.sh rename to packages/test-images/integratedtest/testimages/test-image2/build-docker.sh diff --git a/packages/deployer/src/integratedtest/testimages/test-image2/deployment/image2.deployment.yml b/packages/test-images/integratedtest/testimages/test-image2/deployment/image2.deployment.yml similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image2/deployment/image2.deployment.yml rename to packages/test-images/integratedtest/testimages/test-image2/deployment/image2.deployment.yml diff --git a/packages/deployer/src/integratedtest/testimages/test-image2/deployment/image2.service.yml b/packages/test-images/integratedtest/testimages/test-image2/deployment/image2.service.yml similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image2/deployment/image2.service.yml rename to packages/test-images/integratedtest/testimages/test-image2/deployment/image2.service.yml diff --git a/packages/deployer/src/integratedtest/testimages/test-image-json-metadata/entrypoint.sh b/packages/test-images/integratedtest/testimages/test-image2/entrypoint.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image-json-metadata/entrypoint.sh rename to packages/test-images/integratedtest/testimages/test-image2/entrypoint.sh diff --git a/packages/deployer/src/integratedtest/testimages/test-image3/Dockerfile b/packages/test-images/integratedtest/testimages/test-image3/Dockerfile similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image3/Dockerfile rename to packages/test-images/integratedtest/testimages/test-image3/Dockerfile diff --git a/packages/deployer/src/integratedtest/testimages/test-image3/build-docker.sh b/packages/test-images/integratedtest/testimages/test-image3/build-docker.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image3/build-docker.sh rename to packages/test-images/integratedtest/testimages/test-image3/build-docker.sh diff --git a/packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.config.yml b/packages/test-images/integratedtest/testimages/test-image3/deployment/image2.config.yml similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.config.yml rename to packages/test-images/integratedtest/testimages/test-image3/deployment/image2.config.yml diff --git a/packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.deployment.yml b/packages/test-images/integratedtest/testimages/test-image3/deployment/image2.deployment.yml similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.deployment.yml rename to packages/test-images/integratedtest/testimages/test-image3/deployment/image2.deployment.yml diff --git a/packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.service.yml b/packages/test-images/integratedtest/testimages/test-image3/deployment/image2.service.yml similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.service.yml rename to packages/test-images/integratedtest/testimages/test-image3/deployment/image2.service.yml diff --git a/packages/deployer/src/integratedtest/testimages/test-image/entrypoint.sh b/packages/test-images/integratedtest/testimages/test-image3/entrypoint.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image/entrypoint.sh rename to packages/test-images/integratedtest/testimages/test-image3/entrypoint.sh diff --git a/packages/deployer/src/integratedtest/testimages/test-infrastructure/Dockerfile b/packages/test-images/integratedtest/testimages/test-infrastructure/Dockerfile similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-infrastructure/Dockerfile rename to packages/test-images/integratedtest/testimages/test-infrastructure/Dockerfile diff --git a/packages/deployer/src/integratedtest/testimages/test-infrastructure/entrypoint.sh b/packages/test-images/integratedtest/testimages/test-infrastructure/entrypoint.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-infrastructure/entrypoint.sh rename to packages/test-images/integratedtest/testimages/test-infrastructure/entrypoint.sh diff --git a/packages/deployer/src/integratedtest/testimages/test-infrastructure/shepherd.json b/packages/test-images/integratedtest/testimages/test-infrastructure/shepherd.json similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-infrastructure/shepherd.json rename to packages/test-images/integratedtest/testimages/test-infrastructure/shepherd.json diff --git a/packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/Dockerfile b/packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/Dockerfile similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/Dockerfile rename to packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/Dockerfile diff --git a/packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/shepherd.json b/packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/shepherd.json similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/shepherd.json rename to packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/shepherd.json diff --git a/packages/deployer/src/integratedtest/testimages/test-migration-image-newformat/entrypoint.sh b/packages/test-images/integratedtest/testimages/test-migration-image-newformat/entrypoint.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-migration-image-newformat/entrypoint.sh rename to packages/test-images/integratedtest/testimages/test-migration-image-newformat/entrypoint.sh diff --git a/packages/deployer/src/integratedtest/testimages/test-migration-image-newformat/shepherd.json b/packages/test-images/integratedtest/testimages/test-migration-image-newformat/shepherd.json similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-migration-image-newformat/shepherd.json rename to packages/test-images/integratedtest/testimages/test-migration-image-newformat/shepherd.json diff --git a/packages/deployer/src/integratedtest/testimages/test-migration-image/Dockerfile b/packages/test-images/integratedtest/testimages/test-migration-image/Dockerfile similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-migration-image/Dockerfile rename to packages/test-images/integratedtest/testimages/test-migration-image/Dockerfile diff --git a/packages/deployer/src/integratedtest/testimages/test-migration-image/build-docker.sh b/packages/test-images/integratedtest/testimages/test-migration-image/build-docker.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-migration-image/build-docker.sh rename to packages/test-images/integratedtest/testimages/test-migration-image/build-docker.sh diff --git a/packages/test-images/package.json b/packages/test-images/package.json new file mode 100644 index 00000000..67ac64e5 --- /dev/null +++ b/packages/test-images/package.json @@ -0,0 +1,29 @@ +{ + "name": "@shepherdorg/test-images", + "version": "5.2.3", + "private": true, + "description": "Test images for deployer integrated tests.", + "keywords": [], + "author": "Guðlaugur S. Egilsson ", + "homepage": "", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/ShepherdOrg/npm-packages" + }, + "scripts": { + "build-test-images": "cd integratedtest/testimages && ./build-test-images.sh", + }, + "dependencies": { + "@shepherdorg/cli": "^5.2.3" + }, + "devDependencies": { + "@types/chai": "4.2.11", + "@types/mocha": "^5.2.7", + "@types/node": "12.12.6", + "chai": "^4.2.0", + "mocha": "^6.2.1", + "ts-node": "^8.5.2", + "typescript": "^3.7.2" + } +} diff --git a/packages/versionist/package.json b/packages/versionist/package.json index c4066941..85dacead 100644 --- a/packages/versionist/package.json +++ b/packages/versionist/package.json @@ -27,7 +27,6 @@ "specs": "mocha --exit --require ts-node/register --recursive 'src/**/*.spec.ts'", "coverage": "TS_NODE_COMPILER_OPTIONS='{\"removeComments\":false}' nyc mocha --require ts-node/register --require source-map-support/register --recursive 'src/**/*.spec.ts'", "tdd": "mocha --exit -R dot --require ts-node/register --recursive --watch-extensions ts --watch 'src/**/*.spec.ts'", - "integratedtest": "yarn build && yarn build-test-images && mocha --exit --recursive 'dist/integratedtest/**/*.integratedtest.js'", "compile-in-background": "tsc -w > /dev/null &", "test": "yarn specs", "build": "tsc && chmod +x dist/versionist.js", From b1657f44396df29c018ccf561f0b68aedf23ec05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0laugur=20S=2E=20Egilsson?= Date: Mon, 11 Apr 2022 14:26:22 +0000 Subject: [PATCH 4/8] Remove trailing comma --- packages/test-images/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/test-images/package.json b/packages/test-images/package.json index 67ac64e5..32253aa4 100644 --- a/packages/test-images/package.json +++ b/packages/test-images/package.json @@ -12,7 +12,7 @@ "url": "https://github.com/ShepherdOrg/npm-packages" }, "scripts": { - "build-test-images": "cd integratedtest/testimages && ./build-test-images.sh", + "build-test-images": "cd integratedtest/testimages && ./build-test-images.sh" }, "dependencies": { "@shepherdorg/cli": "^5.2.3" From 8df9f10e69503e4bd6571ad694b2858b30d9228b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0laugur=20S=2E=20Egilsson?= Date: Mon, 11 Apr 2022 14:27:01 +0000 Subject: [PATCH 5/8] Add missing files from previous commit. Remove trailing comma --- .../build/.shepherd/registries.json | 1 + .../apply-configmap_imageconf.yaml | 8 +++ ...p_www-icelandair-com-nginx-acls-test1.yaml | 9 +++ ...nfigmap_www-icelandair-com-nginx-acls.yaml | 9 +++ ...y-deployment_www-icelandair-com-test1.yaml | 67 +++++++++++++++++++ .../apply-deployment_www-icelandair-com.yaml | 66 ++++++++++++++++++ .../apply-service_www-fromdir.yaml | 43 ++++++++++++ ...ice_www-icelandair-com-internal-test1.yaml | 14 ++++ ...y-service_www-icelandair-com-internal.yaml | 13 ++++ ...pply-service_www-icelandair-com-test1.yaml | 49 ++++++++++++++ .../apply-service_www-icelandair-com.yaml | 47 +++++++++++++ .../delete-configmap_image2-config.yaml | 9 +++ .../delete-deployment_image2.yaml | 66 ++++++++++++++++++ .../delete-namespace_monitors.yaml | 4 ++ .../delete-service_image2.yaml | 21 ++++++ .../test-infrastructure-deployer.txt | 1 + ...est-migration-image-newformat-deployer.txt | 1 + .../testenvimage-migrations-deployer.txt | 1 + .../exported/apply-configmap_imageconf.yaml | 8 +++ ...p_www-icelandair-com-nginx-acls-test1.yaml | 9 +++ ...nfigmap_www-icelandair-com-nginx-acls.yaml | 9 +++ ...y-deployment_www-icelandair-com-test1.yaml | 67 +++++++++++++++++++ .../apply-deployment_www-icelandair-com.yaml | 66 ++++++++++++++++++ .../exported/apply-service_www-fromdir.yaml | 43 ++++++++++++ ...ice_www-icelandair-com-internal-test1.yaml | 14 ++++ ...y-service_www-icelandair-com-internal.yaml | 13 ++++ ...pply-service_www-icelandair-com-test1.yaml | 49 ++++++++++++++ .../apply-service_www-icelandair-com.yaml | 47 +++++++++++++ .../delete-configmap_image2-config.yaml | 9 +++ .../exported/delete-deployment_image2.yaml | 66 ++++++++++++++++++ .../exported/delete-namespace_monitors.yaml | 4 ++ .../exported/delete-service_image2.yaml | 21 ++++++ .../exported/test-infrastructure-deployer.txt | 1 + ...est-migration-image-newformat-deployer.txt | 1 + .../testenvimage-migrations-deployer.txt | 1 + .../apply-configmap_imageconf.yaml | 8 +++ ...p_www-icelandair-com-nginx-acls-test1.yaml | 9 +++ ...nfigmap_www-icelandair-com-nginx-acls.yaml | 9 +++ ...y-deployment_www-icelandair-com-test1.yaml | 67 +++++++++++++++++++ .../apply-deployment_www-icelandair-com.yaml | 66 ++++++++++++++++++ .../apply-service_www-fromdir.yaml | 43 ++++++++++++ ...ice_www-icelandair-com-internal-test1.yaml | 14 ++++ ...y-service_www-icelandair-com-internal.yaml | 13 ++++ ...pply-service_www-icelandair-com-test1.yaml | 49 ++++++++++++++ .../apply-service_www-icelandair-com.yaml | 47 +++++++++++++ .../delete-configmap_image2-config.yaml | 9 +++ .../delete-deployment_image2.yaml | 66 ++++++++++++++++++ .../delete-namespace_monitors.yaml | 4 ++ .../delete-service_image2.yaml | 21 ++++++ .../test-image-json-metadata/entrypoint.sh | 7 ++ .../testimages/test-image/entrypoint.sh | 7 ++ .../entrypoint.sh | 12 ++++ .../kube.yaml | 36 ++++++++++ .../test-migration-image-newformat/Dockerfile | 8 +++ 54 files changed, 1352 insertions(+) create mode 100644 packages/docker-image-metadata-loader/build/.shepherd/registries.json create mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-configmap_imageconf.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com-test1.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-service_www-fromdir.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal-test1.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-test1.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/delete-configmap_image2-config.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/delete-deployment_image2.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/delete-namespace_monitors.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/delete-service_image2.yaml create mode 100644 packages/test-images/integratedtest/expected/all-deployments/test-infrastructure-deployer.txt create mode 100644 packages/test-images/integratedtest/expected/all-deployments/test-migration-image-newformat-deployer.txt create mode 100644 packages/test-images/integratedtest/expected/all-deployments/testenvimage-migrations-deployer.txt create mode 100644 packages/test-images/integratedtest/expected/exported/apply-configmap_imageconf.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com-test1.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/apply-service_www-fromdir.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal-test1.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-test1.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/delete-configmap_image2-config.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/delete-deployment_image2.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/delete-namespace_monitors.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/delete-service_image2.yaml create mode 100644 packages/test-images/integratedtest/expected/exported/test-infrastructure-deployer.txt create mode 100644 packages/test-images/integratedtest/expected/exported/test-migration-image-newformat-deployer.txt create mode 100644 packages/test-images/integratedtest/expected/exported/testenvimage-migrations-deployer.txt create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_imageconf.yaml create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com-test1.yaml create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com.yaml create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-fromdir.yaml create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal-test1.yaml create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal.yaml create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-test1.yaml create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com.yaml create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/delete-configmap_image2-config.yaml create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/delete-deployment_image2.yaml create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/delete-namespace_monitors.yaml create mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/delete-service_image2.yaml create mode 100755 packages/test-images/integratedtest/testimages/test-image-json-metadata/entrypoint.sh create mode 100755 packages/test-images/integratedtest/testimages/test-image/entrypoint.sh create mode 100755 packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/entrypoint.sh create mode 100644 packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/kube.yaml create mode 100644 packages/test-images/integratedtest/testimages/test-migration-image-newformat/Dockerfile diff --git a/packages/docker-image-metadata-loader/build/.shepherd/registries.json b/packages/docker-image-metadata-loader/build/.shepherd/registries.json new file mode 100644 index 00000000..9b12b914 --- /dev/null +++ b/packages/docker-image-metadata-loader/build/.shepherd/registries.json @@ -0,0 +1 @@ +{"somewhere.else":{"protocol":"https","authToken":"badToken"},"another.registry":{"protocol":"https","authToken":"badToken"}} \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_imageconf.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_imageconf.yaml new file mode 100644 index 00000000..354416f2 --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_imageconf.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: imageconf + labels: + team: one +data: + somedata: svc.host.somewhere diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml new file mode 100644 index 00000000..2779c54b --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: www-icelandair-com-nginx-acls-test1 + labels: + team: flip + ttl-hours: '48' +data: + whitelist: teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml new file mode 100644 index 00000000..13956df0 --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: www-icelandair-com-nginx-acls + labels: + team: flip +data: + whitelist: |- + teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com-test1.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com-test1.yaml new file mode 100644 index 00000000..80b13456 --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com-test1.yaml @@ -0,0 +1,67 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: www-icelandair-com-test1 + labels: + name: www-icelandair-com-test1 + tier: frontend + ttl-hours: '48' +spec: + replicas: 1 + template: + metadata: + labels: + name: www-icelandair-com-test1 + tier: frontend + spec: + imagePullSecrets: + - name: registry-pull-secret + containers: + - image: 'testenvimage:0.0.0' + name: www-icelandair-com-test1 + resources: + limits: + cpu: 0.8 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + ports: + - containerPort: 81 + name: http-proxy + protocol: TCP + - containerPort: 444 + name: https-proxy + protocol: TCP + volumeMounts: + - name: certs-volume + readOnly: true + mountPath: /volumes/certs + - name: nginx-acls + readOnly: true + mountPath: /etc/nginx/acls/ + env: + - name: RUNTIME_ENVIRONMENT + valueFrom: + configMapKeyRef: + name: nowhardcoded + key: ENV + - image: DOCKER_IMAGE_SSR + name: www-icelandair-com-ssr-test1 + resources: + limits: + cpu: 0.6 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + volumes: + - name: certs-volume + secret: + secretName: star-cert-secret + - name: nginx-acls + configMap: + name: www-icelandair-com-nginx-acls-test1 + items: + - key: whitelist + path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com.yaml new file mode 100644 index 00000000..1b2f58f6 --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com.yaml @@ -0,0 +1,66 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: www-icelandair-com + labels: + name: www-icelandair-com + tier: frontend +spec: + replicas: 2 + template: + metadata: + labels: + name: www-icelandair-com + tier: frontend + spec: + imagePullSecrets: + - name: registry-pull-secret + containers: + - image: testenvimage:0.0.0 + name: www-icelandair-com + resources: + limits: + cpu: 0.8 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + ports: + - containerPort: 81 + name: http-proxy + protocol: TCP + - containerPort: 444 + name: https-proxy + protocol: TCP + volumeMounts: + - name: certs-volume + readOnly: true + mountPath: "/volumes/certs" + - name: nginx-acls + readOnly: true + mountPath: "/etc/nginx/acls/" + env: + - name: RUNTIME_ENVIRONMENT + valueFrom: + configMapKeyRef: + name: nowhardcoded + key: ENV + - image: DOCKER_IMAGE_SSR + name: www-icelandair-com-ssr + resources: + limits: + cpu: 0.6 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + volumes: + - name: certs-volume + secret: + secretName: star-cert-secret + - name: nginx-acls + configMap: + name: www-icelandair-com-nginx-acls + items: + - key: whitelist + path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-fromdir.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-fromdir.yaml new file mode 100644 index 00000000..34f646a4 --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-fromdir.yaml @@ -0,0 +1,43 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-fromdir + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: www + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com + tier: frontend +--- +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-part2 + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: www-com + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com + tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal-test1.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal-test1.yaml new file mode 100644 index 00000000..1a1a8f3b --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal-test1.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-internal-test1 + labels: + name: www-icelandair-com-internal-test1 + ttl-hours: '48' +spec: + ports: + - port: 10000 + name: http + selector: + name: www-icelandair-com-test1 + tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal.yaml new file mode 100644 index 00000000..9595938b --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-internal + labels: + name: www-icelandair-com-internal +spec: + ports: + - port: 10000 + name: http + selector: + name: www-icelandair-com + tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-test1.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-test1.yaml new file mode 100644 index 00000000..22d7748a --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-test1.yaml @@ -0,0 +1,49 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-test1 + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*' + labels: + name: www-icelandair-com-test1 + subdomain: testSDPbeta + topdomain: testtopdomain + team: flip + ttl-hours: '48' +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com-test1 + tier: frontend +--- +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-test1 + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*' + labels: + name: www-icelandair-com-test1 + subdomain: testSDPbeta + topdomain: testtopdomain + team: flip + ttl-hours: '48' +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com-test1 + tier: frontend diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com.yaml new file mode 100644 index 00000000..83eac885 --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com.yaml @@ -0,0 +1,47 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: www-icelandair-com + subdomain: 'testSDPbeta' + topdomain: testtopdomain + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com + tier: frontend +--- +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: www-icelandair-com + subdomain: testSDPbeta + topdomain: testtopdomain + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com + tier: frontend diff --git a/packages/test-images/integratedtest/expected/all-deployments/delete-configmap_image2-config.yaml b/packages/test-images/integratedtest/expected/all-deployments/delete-configmap_image2-config.yaml new file mode 100644 index 00000000..337c7d9e --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/delete-configmap_image2-config.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: image2-config + labels: + team: flip +data: + whitelist: |- + teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/delete-deployment_image2.yaml b/packages/test-images/integratedtest/expected/all-deployments/delete-deployment_image2.yaml new file mode 100644 index 00000000..c4d58692 --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/delete-deployment_image2.yaml @@ -0,0 +1,66 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: image2 + labels: + name: image2 + tier: frontend +spec: + replicas: 2 + template: + metadata: + labels: + name: image2 + tier: frontend + spec: + imagePullSecrets: + - name: registry-pull-secret + containers: + - image: testenvimage2:999.999.99999 + name: image2 + resources: + limits: + cpu: 0.8 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + ports: + - containerPort: 81 + name: http-proxy + protocol: TCP + - containerPort: 444 + name: https-proxy + protocol: TCP + volumeMounts: + - name: certs-volume + readOnly: true + mountPath: "/volumes/certs" + - name: nginx-acls + readOnly: true + mountPath: "/etc/nginx/acls/" + env: + - name: RUNTIME_ENVIRONMENT + valueFrom: + configMapKeyRef: + name: nowhardcoded + key: ENV + - image: DOCKER_IMAGE_SSR + name: image2-ssr + resources: + limits: + cpu: 0.6 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + volumes: + - name: certs-volume + secret: + secretName: star-cert-secret + - name: nginx-acls + configMap: + name: image2-nginx-acls + items: + - key: whitelist + path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/all-deployments/delete-namespace_monitors.yaml b/packages/test-images/integratedtest/expected/all-deployments/delete-namespace_monitors.yaml new file mode 100644 index 00000000..9adc13b6 --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/delete-namespace_monitors.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: monitors \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/delete-service_image2.yaml b/packages/test-images/integratedtest/expected/all-deployments/delete-service_image2.yaml new file mode 100644 index 00000000..ec63fb4f --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/delete-service_image2.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: image2 + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: image2 + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: image2 + tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/test-infrastructure-deployer.txt b/packages/test-images/integratedtest/expected/all-deployments/test-infrastructure-deployer.txt new file mode 100644 index 00000000..7ada9e09 --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/test-infrastructure-deployer.txt @@ -0,0 +1 @@ +docker run -i --rm -e ENV=testit -e INFRASTRUCTURE_IMPORTED_ENV=thatsme test-infrastructure:[image_version] deploy diff --git a/packages/test-images/integratedtest/expected/all-deployments/test-migration-image-newformat-deployer.txt b/packages/test-images/integratedtest/expected/all-deployments/test-migration-image-newformat-deployer.txt new file mode 100644 index 00000000..93c95a30 --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/test-migration-image-newformat-deployer.txt @@ -0,0 +1 @@ +docker run -i --rm -e ENV=testit -e MIGRATION_ENV_VARIABLE_ONE=justAValue -e MIGRATION_ENV_VARIABLE_TWO=fixedValue test-migration-image-newformat:[image_version] ls diff --git a/packages/test-images/integratedtest/expected/all-deployments/testenvimage-migrations-deployer.txt b/packages/test-images/integratedtest/expected/all-deployments/testenvimage-migrations-deployer.txt new file mode 100644 index 00000000..74e22d33 --- /dev/null +++ b/packages/test-images/integratedtest/expected/all-deployments/testenvimage-migrations-deployer.txt @@ -0,0 +1 @@ +docker run -i --rm -e ENV=testit -e EXPORT1=nowhardcoded -e DB_HOST=postgres-local -e DB_PASS=somedbpass -e THIS_IS_DEPLOYER_ONE=true testenvimage-migrations:[image_version] ls diff --git a/packages/test-images/integratedtest/expected/exported/apply-configmap_imageconf.yaml b/packages/test-images/integratedtest/expected/exported/apply-configmap_imageconf.yaml new file mode 100644 index 00000000..354416f2 --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/apply-configmap_imageconf.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: imageconf + labels: + team: one +data: + somedata: svc.host.somewhere diff --git a/packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml b/packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml new file mode 100644 index 00000000..2779c54b --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: www-icelandair-com-nginx-acls-test1 + labels: + team: flip + ttl-hours: '48' +data: + whitelist: teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls.yaml b/packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls.yaml new file mode 100644 index 00000000..13956df0 --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: www-icelandair-com-nginx-acls + labels: + team: flip +data: + whitelist: |- + teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com-test1.yaml b/packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com-test1.yaml new file mode 100644 index 00000000..80b13456 --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com-test1.yaml @@ -0,0 +1,67 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: www-icelandair-com-test1 + labels: + name: www-icelandair-com-test1 + tier: frontend + ttl-hours: '48' +spec: + replicas: 1 + template: + metadata: + labels: + name: www-icelandair-com-test1 + tier: frontend + spec: + imagePullSecrets: + - name: registry-pull-secret + containers: + - image: 'testenvimage:0.0.0' + name: www-icelandair-com-test1 + resources: + limits: + cpu: 0.8 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + ports: + - containerPort: 81 + name: http-proxy + protocol: TCP + - containerPort: 444 + name: https-proxy + protocol: TCP + volumeMounts: + - name: certs-volume + readOnly: true + mountPath: /volumes/certs + - name: nginx-acls + readOnly: true + mountPath: /etc/nginx/acls/ + env: + - name: RUNTIME_ENVIRONMENT + valueFrom: + configMapKeyRef: + name: nowhardcoded + key: ENV + - image: DOCKER_IMAGE_SSR + name: www-icelandair-com-ssr-test1 + resources: + limits: + cpu: 0.6 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + volumes: + - name: certs-volume + secret: + secretName: star-cert-secret + - name: nginx-acls + configMap: + name: www-icelandair-com-nginx-acls-test1 + items: + - key: whitelist + path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com.yaml b/packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com.yaml new file mode 100644 index 00000000..1b2f58f6 --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com.yaml @@ -0,0 +1,66 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: www-icelandair-com + labels: + name: www-icelandair-com + tier: frontend +spec: + replicas: 2 + template: + metadata: + labels: + name: www-icelandair-com + tier: frontend + spec: + imagePullSecrets: + - name: registry-pull-secret + containers: + - image: testenvimage:0.0.0 + name: www-icelandair-com + resources: + limits: + cpu: 0.8 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + ports: + - containerPort: 81 + name: http-proxy + protocol: TCP + - containerPort: 444 + name: https-proxy + protocol: TCP + volumeMounts: + - name: certs-volume + readOnly: true + mountPath: "/volumes/certs" + - name: nginx-acls + readOnly: true + mountPath: "/etc/nginx/acls/" + env: + - name: RUNTIME_ENVIRONMENT + valueFrom: + configMapKeyRef: + name: nowhardcoded + key: ENV + - image: DOCKER_IMAGE_SSR + name: www-icelandair-com-ssr + resources: + limits: + cpu: 0.6 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + volumes: + - name: certs-volume + secret: + secretName: star-cert-secret + - name: nginx-acls + configMap: + name: www-icelandair-com-nginx-acls + items: + - key: whitelist + path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/exported/apply-service_www-fromdir.yaml b/packages/test-images/integratedtest/expected/exported/apply-service_www-fromdir.yaml new file mode 100644 index 00000000..34f646a4 --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/apply-service_www-fromdir.yaml @@ -0,0 +1,43 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-fromdir + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: www + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com + tier: frontend +--- +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-part2 + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: www-com + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com + tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal-test1.yaml b/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal-test1.yaml new file mode 100644 index 00000000..1a1a8f3b --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal-test1.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-internal-test1 + labels: + name: www-icelandair-com-internal-test1 + ttl-hours: '48' +spec: + ports: + - port: 10000 + name: http + selector: + name: www-icelandair-com-test1 + tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal.yaml b/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal.yaml new file mode 100644 index 00000000..9595938b --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-internal + labels: + name: www-icelandair-com-internal +spec: + ports: + - port: 10000 + name: http + selector: + name: www-icelandair-com + tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-test1.yaml b/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-test1.yaml new file mode 100644 index 00000000..22d7748a --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-test1.yaml @@ -0,0 +1,49 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-test1 + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*' + labels: + name: www-icelandair-com-test1 + subdomain: testSDPbeta + topdomain: testtopdomain + team: flip + ttl-hours: '48' +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com-test1 + tier: frontend +--- +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-test1 + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*' + labels: + name: www-icelandair-com-test1 + subdomain: testSDPbeta + topdomain: testtopdomain + team: flip + ttl-hours: '48' +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com-test1 + tier: frontend diff --git a/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com.yaml b/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com.yaml new file mode 100644 index 00000000..83eac885 --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com.yaml @@ -0,0 +1,47 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: www-icelandair-com + subdomain: 'testSDPbeta' + topdomain: testtopdomain + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com + tier: frontend +--- +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: www-icelandair-com + subdomain: testSDPbeta + topdomain: testtopdomain + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com + tier: frontend diff --git a/packages/test-images/integratedtest/expected/exported/delete-configmap_image2-config.yaml b/packages/test-images/integratedtest/expected/exported/delete-configmap_image2-config.yaml new file mode 100644 index 00000000..337c7d9e --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/delete-configmap_image2-config.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: image2-config + labels: + team: flip +data: + whitelist: |- + teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/delete-deployment_image2.yaml b/packages/test-images/integratedtest/expected/exported/delete-deployment_image2.yaml new file mode 100644 index 00000000..c4d58692 --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/delete-deployment_image2.yaml @@ -0,0 +1,66 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: image2 + labels: + name: image2 + tier: frontend +spec: + replicas: 2 + template: + metadata: + labels: + name: image2 + tier: frontend + spec: + imagePullSecrets: + - name: registry-pull-secret + containers: + - image: testenvimage2:999.999.99999 + name: image2 + resources: + limits: + cpu: 0.8 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + ports: + - containerPort: 81 + name: http-proxy + protocol: TCP + - containerPort: 444 + name: https-proxy + protocol: TCP + volumeMounts: + - name: certs-volume + readOnly: true + mountPath: "/volumes/certs" + - name: nginx-acls + readOnly: true + mountPath: "/etc/nginx/acls/" + env: + - name: RUNTIME_ENVIRONMENT + valueFrom: + configMapKeyRef: + name: nowhardcoded + key: ENV + - image: DOCKER_IMAGE_SSR + name: image2-ssr + resources: + limits: + cpu: 0.6 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + volumes: + - name: certs-volume + secret: + secretName: star-cert-secret + - name: nginx-acls + configMap: + name: image2-nginx-acls + items: + - key: whitelist + path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/exported/delete-namespace_monitors.yaml b/packages/test-images/integratedtest/expected/exported/delete-namespace_monitors.yaml new file mode 100644 index 00000000..9adc13b6 --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/delete-namespace_monitors.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: monitors \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/delete-service_image2.yaml b/packages/test-images/integratedtest/expected/exported/delete-service_image2.yaml new file mode 100644 index 00000000..ec63fb4f --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/delete-service_image2.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: image2 + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: image2 + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: image2 + tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/test-infrastructure-deployer.txt b/packages/test-images/integratedtest/expected/exported/test-infrastructure-deployer.txt new file mode 100644 index 00000000..7ada9e09 --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/test-infrastructure-deployer.txt @@ -0,0 +1 @@ +docker run -i --rm -e ENV=testit -e INFRASTRUCTURE_IMPORTED_ENV=thatsme test-infrastructure:[image_version] deploy diff --git a/packages/test-images/integratedtest/expected/exported/test-migration-image-newformat-deployer.txt b/packages/test-images/integratedtest/expected/exported/test-migration-image-newformat-deployer.txt new file mode 100644 index 00000000..93c95a30 --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/test-migration-image-newformat-deployer.txt @@ -0,0 +1 @@ +docker run -i --rm -e ENV=testit -e MIGRATION_ENV_VARIABLE_ONE=justAValue -e MIGRATION_ENV_VARIABLE_TWO=fixedValue test-migration-image-newformat:[image_version] ls diff --git a/packages/test-images/integratedtest/expected/exported/testenvimage-migrations-deployer.txt b/packages/test-images/integratedtest/expected/exported/testenvimage-migrations-deployer.txt new file mode 100644 index 00000000..74e22d33 --- /dev/null +++ b/packages/test-images/integratedtest/expected/exported/testenvimage-migrations-deployer.txt @@ -0,0 +1 @@ +docker run -i --rm -e ENV=testit -e EXPORT1=nowhardcoded -e DB_HOST=postgres-local -e DB_PASS=somedbpass -e THIS_IS_DEPLOYER_ONE=true testenvimage-migrations:[image_version] ls diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_imageconf.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_imageconf.yaml new file mode 100644 index 00000000..354416f2 --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_imageconf.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: imageconf + labels: + team: one +data: + somedata: svc.host.somewhere diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml new file mode 100644 index 00000000..2779c54b --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: www-icelandair-com-nginx-acls-test1 + labels: + team: flip + ttl-hours: '48' +data: + whitelist: teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml new file mode 100644 index 00000000..1e75ca8b --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: www-icelandair-com-nginx-acls + labels: + team: flip +data: + whitelist: |- + teststring diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com-test1.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com-test1.yaml new file mode 100644 index 00000000..80b13456 --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com-test1.yaml @@ -0,0 +1,67 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: www-icelandair-com-test1 + labels: + name: www-icelandair-com-test1 + tier: frontend + ttl-hours: '48' +spec: + replicas: 1 + template: + metadata: + labels: + name: www-icelandair-com-test1 + tier: frontend + spec: + imagePullSecrets: + - name: registry-pull-secret + containers: + - image: 'testenvimage:0.0.0' + name: www-icelandair-com-test1 + resources: + limits: + cpu: 0.8 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + ports: + - containerPort: 81 + name: http-proxy + protocol: TCP + - containerPort: 444 + name: https-proxy + protocol: TCP + volumeMounts: + - name: certs-volume + readOnly: true + mountPath: /volumes/certs + - name: nginx-acls + readOnly: true + mountPath: /etc/nginx/acls/ + env: + - name: RUNTIME_ENVIRONMENT + valueFrom: + configMapKeyRef: + name: nowhardcoded + key: ENV + - image: DOCKER_IMAGE_SSR + name: www-icelandair-com-ssr-test1 + resources: + limits: + cpu: 0.6 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + volumes: + - name: certs-volume + secret: + secretName: star-cert-secret + - name: nginx-acls + configMap: + name: www-icelandair-com-nginx-acls-test1 + items: + - key: whitelist + path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com.yaml new file mode 100644 index 00000000..1b2f58f6 --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com.yaml @@ -0,0 +1,66 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: www-icelandair-com + labels: + name: www-icelandair-com + tier: frontend +spec: + replicas: 2 + template: + metadata: + labels: + name: www-icelandair-com + tier: frontend + spec: + imagePullSecrets: + - name: registry-pull-secret + containers: + - image: testenvimage:0.0.0 + name: www-icelandair-com + resources: + limits: + cpu: 0.8 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + ports: + - containerPort: 81 + name: http-proxy + protocol: TCP + - containerPort: 444 + name: https-proxy + protocol: TCP + volumeMounts: + - name: certs-volume + readOnly: true + mountPath: "/volumes/certs" + - name: nginx-acls + readOnly: true + mountPath: "/etc/nginx/acls/" + env: + - name: RUNTIME_ENVIRONMENT + valueFrom: + configMapKeyRef: + name: nowhardcoded + key: ENV + - image: DOCKER_IMAGE_SSR + name: www-icelandair-com-ssr + resources: + limits: + cpu: 0.6 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + volumes: + - name: certs-volume + secret: + secretName: star-cert-secret + - name: nginx-acls + configMap: + name: www-icelandair-com-nginx-acls + items: + - key: whitelist + path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-fromdir.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-fromdir.yaml new file mode 100644 index 00000000..34f646a4 --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-fromdir.yaml @@ -0,0 +1,43 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-fromdir + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: www + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com + tier: frontend +--- +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-part2 + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: www-com + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com + tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal-test1.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal-test1.yaml new file mode 100644 index 00000000..1a1a8f3b --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal-test1.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-internal-test1 + labels: + name: www-icelandair-com-internal-test1 + ttl-hours: '48' +spec: + ports: + - port: 10000 + name: http + selector: + name: www-icelandair-com-test1 + tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal.yaml new file mode 100644 index 00000000..9595938b --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-internal + labels: + name: www-icelandair-com-internal +spec: + ports: + - port: 10000 + name: http + selector: + name: www-icelandair-com + tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-test1.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-test1.yaml new file mode 100644 index 00000000..22d7748a --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-test1.yaml @@ -0,0 +1,49 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-test1 + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*' + labels: + name: www-icelandair-com-test1 + subdomain: testSDPbeta + topdomain: testtopdomain + team: flip + ttl-hours: '48' +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com-test1 + tier: frontend +--- +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com-test1 + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*' + labels: + name: www-icelandair-com-test1 + subdomain: testSDPbeta + topdomain: testtopdomain + team: flip + ttl-hours: '48' +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com-test1 + tier: frontend diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com.yaml new file mode 100644 index 00000000..83eac885 --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com.yaml @@ -0,0 +1,47 @@ +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: www-icelandair-com + subdomain: 'testSDPbeta' + topdomain: testtopdomain + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com + tier: frontend +--- +apiVersion: v1 +kind: Service +metadata: + name: www-icelandair-com + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: www-icelandair-com + subdomain: testSDPbeta + topdomain: testtopdomain + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: www-icelandair-com + tier: frontend diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/delete-configmap_image2-config.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/delete-configmap_image2-config.yaml new file mode 100644 index 00000000..c75f0554 --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/delete-configmap_image2-config.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: image2-config + labels: + team: flip +data: + whitelist: |- + teststring diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/delete-deployment_image2.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/delete-deployment_image2.yaml new file mode 100644 index 00000000..c4d58692 --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/delete-deployment_image2.yaml @@ -0,0 +1,66 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: image2 + labels: + name: image2 + tier: frontend +spec: + replicas: 2 + template: + metadata: + labels: + name: image2 + tier: frontend + spec: + imagePullSecrets: + - name: registry-pull-secret + containers: + - image: testenvimage2:999.999.99999 + name: image2 + resources: + limits: + cpu: 0.8 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + ports: + - containerPort: 81 + name: http-proxy + protocol: TCP + - containerPort: 444 + name: https-proxy + protocol: TCP + volumeMounts: + - name: certs-volume + readOnly: true + mountPath: "/volumes/certs" + - name: nginx-acls + readOnly: true + mountPath: "/etc/nginx/acls/" + env: + - name: RUNTIME_ENVIRONMENT + valueFrom: + configMapKeyRef: + name: nowhardcoded + key: ENV + - image: DOCKER_IMAGE_SSR + name: image2-ssr + resources: + limits: + cpu: 0.6 + memory: 512M + requests: + cpu: 0.4 + memory: 256M + volumes: + - name: certs-volume + secret: + secretName: star-cert-secret + - name: nginx-acls + configMap: + name: image2-nginx-acls + items: + - key: whitelist + path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/delete-namespace_monitors.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/delete-namespace_monitors.yaml new file mode 100644 index 00000000..9adc13b6 --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/delete-namespace_monitors.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: monitors \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/delete-service_image2.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/delete-service_image2.yaml new file mode 100644 index 00000000..ec63fb4f --- /dev/null +++ b/packages/test-images/integratedtest/expected/k8s-deployments/delete-service_image2.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: image2 + annotations: + service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" + labels: + name: image2 + team: flip +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 81 + name: http-proxy-protocol + - port: 443 + targetPort: 444 + name: https-proxy-protocol + selector: + name: image2 + tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/testimages/test-image-json-metadata/entrypoint.sh b/packages/test-images/integratedtest/testimages/test-image-json-metadata/entrypoint.sh new file mode 100755 index 00000000..e821c814 --- /dev/null +++ b/packages/test-images/integratedtest/testimages/test-image-json-metadata/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +echo "LineOne" +echo "LineTwo" +>&2 echo "TESTING LINE-BY-LINE ERROR OUTPUT" +echo "LineThree should be shown" + diff --git a/packages/test-images/integratedtest/testimages/test-image/entrypoint.sh b/packages/test-images/integratedtest/testimages/test-image/entrypoint.sh new file mode 100755 index 00000000..e821c814 --- /dev/null +++ b/packages/test-images/integratedtest/testimages/test-image/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +echo "LineOne" +echo "LineTwo" +>&2 echo "TESTING LINE-BY-LINE ERROR OUTPUT" +echo "LineThree should be shown" + diff --git a/packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/entrypoint.sh b/packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/entrypoint.sh new file mode 100755 index 00000000..5c47735c --- /dev/null +++ b/packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +echo Executing docker command "$@" +if [ "$1" = "pretest" ]; then + echo Pre test exit with code ${PRETEST_EXITCODE} + exit ${PRETEST_EXITCODE} +elif [ "$1" = "posttest" ]; then + echo Post test exit with code ${POSTTEST_EXITCODE} + exit ${POSTTEST_EXITCODE} +else + exec "$@" +fi diff --git a/packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/kube.yaml b/packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/kube.yaml new file mode 100644 index 00000000..e663848f --- /dev/null +++ b/packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/kube.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +kind: Secret +metadata: + imagename: DOCKER_IMAGE +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: deployment-one-to-roll-back + labels: + ttl-hours: '66' +spec: + replicas: 1 + template: + metadata: + labels: + app: just-a-test-deployment + environment: dev + origin: new-branch + spec: + containers: + - name: just-a-test-deployment + image: DOCKER_IMAGE + imagePullPolicy: IfNotPresent + env: + - name: FEATURES_ON + value: 'true' + readinessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 15 + timeoutSeconds: 4 + ports: + - containerPort: 80 + name: httpport diff --git a/packages/test-images/integratedtest/testimages/test-migration-image-newformat/Dockerfile b/packages/test-images/integratedtest/testimages/test-migration-image-newformat/Dockerfile new file mode 100644 index 00000000..61a090d4 --- /dev/null +++ b/packages/test-images/integratedtest/testimages/test-migration-image-newformat/Dockerfile @@ -0,0 +1,8 @@ +FROM alpine:3.4 + +ADD entrypoint.sh ./entrypoint.sh + +ARG SHEPHERD_METADATA +LABEL shepherd.metadata=${SHEPHERD_METADATA} + +ENTRYPOINT ["./entrypoint.sh"] From fc9e10e3f5176dfb3157250d5ffb8db50e4ed0f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0laugur=20S=2E=20Egilsson?= Date: Mon, 11 Apr 2022 14:29:20 +0000 Subject: [PATCH 6/8] Ignore build folder --- .gitignore | 1 + .../docker-image-metadata-loader/build/.shepherd/registries.json | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 packages/docker-image-metadata-loader/build/.shepherd/registries.json diff --git a/.gitignore b/.gitignore index e1648110..1d839286 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules/ .build/ +build/ package-lock.json dist/ .testrun/ diff --git a/packages/docker-image-metadata-loader/build/.shepherd/registries.json b/packages/docker-image-metadata-loader/build/.shepherd/registries.json deleted file mode 100644 index 9b12b914..00000000 --- a/packages/docker-image-metadata-loader/build/.shepherd/registries.json +++ /dev/null @@ -1 +0,0 @@ -{"somewhere.else":{"protocol":"https","authToken":"badToken"},"another.registry":{"protocol":"https","authToken":"badToken"}} \ No newline at end of file From c0a51f71b19e73b0e814c4e59ca510e635032c65 Mon Sep 17 00:00:00 2001 From: jakob Date: Mon, 11 Apr 2022 14:39:24 +0000 Subject: [PATCH 7/8] refactor --- .../expand-templates-in-image-archive-files.ts | 14 +++++++++----- .../kubectl-deployment-action-factory.ts | 5 ----- .../folder-loader/folder-action-factory.ts | 8 +++----- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/packages/deployer/src/deployment-actions/kubectl-action/expand-templates-in-image-archive-files.ts b/packages/deployer/src/deployment-actions/kubectl-action/expand-templates-in-image-archive-files.ts index ddbdd952..39ab7c9d 100644 --- a/packages/deployer/src/deployment-actions/kubectl-action/expand-templates-in-image-archive-files.ts +++ b/packages/deployer/src/deployment-actions/kubectl-action/expand-templates-in-image-archive-files.ts @@ -2,16 +2,18 @@ import { TK8sDeploymentPlan, TShepherdMetadata } from "../../deployment-types" import { shepherdOptions } from "../../shepherd-options" import { kubeSupportedExtensions } from "./kube-supported-extensions" import * as path from "path" -import { expandEnvAndMustacheVariablesInFile } from "./kubectl-deployment-action-factory" +import { expandTemplate } from "@shepherdorg/hbs-template" import * as chalk from "chalk" -export function expandTemplatesInImageArchiveFiles(imageInformation: TShepherdMetadata & { dockerLabels: { [p: string]: any } }, plan: TK8sDeploymentPlan) { +export function expandTemplatesInImageArchiveFiles( + imageInformation: TShepherdMetadata & { dockerLabels: { [p: string]: any } }, + plan: TK8sDeploymentPlan +) { if (shepherdOptions.testRunMode()) { process.env.TPL_DOCKER_IMAGE = "fixed-for-testing-purposes" } else { process.env.TPL_DOCKER_IMAGE = imageInformation.imageDeclaration.image + ":" + imageInformation.imageDeclaration.imagetag - } if (!plan.files) { @@ -26,10 +28,12 @@ export function expandTemplatesInImageArchiveFiles(imageInformation: TShepherdMe try { if (archivedFile.content) { - archivedFile.content = expandEnvAndMustacheVariablesInFile(archivedFile.content) + archivedFile.content = expandTemplate(archivedFile.content) } } catch (e) { - let message = `When expanding templates in ${chalk.blueBright(imageInformation.imageDeclaration.image)} ${chalk.red(fileName)}:\n${e.message}` + let message = `When expanding templates in ${chalk.blueBright( + imageInformation.imageDeclaration.image + )} ${chalk.red(fileName)}:\n${e.message}` throw new Error(message) } }) diff --git a/packages/deployer/src/deployment-actions/kubectl-action/kubectl-deployment-action-factory.ts b/packages/deployer/src/deployment-actions/kubectl-action/kubectl-deployment-action-factory.ts index 8e09cb21..f20d9a3e 100644 --- a/packages/deployer/src/deployment-actions/kubectl-action/kubectl-deployment-action-factory.ts +++ b/packages/deployer/src/deployment-actions/kubectl-action/kubectl-deployment-action-factory.ts @@ -9,7 +9,6 @@ import { import { newProgrammerOops, Oops } from "oops-error" import { expandEnv } from "../../template/expandenv" import { processLine } from "../../template/base64-env-subst" -import { expandTemplate } from "@shepherdorg/hbs-template" import * as path from "path" import { writeFile } from "../../helpers/promisified" import { TK8sPartialDescriptor } from "./k8s-document-types" @@ -58,10 +57,6 @@ function expandEnvVariables(lines: string[]) { return lines.join("\n") } -export function expandEnvAndMustacheVariablesInFile(deploymentFileDescriptorContent: string) { - return expandTemplate(deploymentFileDescriptorContent) -} - export interface ICreateKubectlDeploymentAction { executeKubectlDeploymentAction: ( thisIsMe: IKubectlDeployAction, diff --git a/packages/deployer/src/herd-loading/folder-loader/folder-action-factory.ts b/packages/deployer/src/herd-loading/folder-loader/folder-action-factory.ts index a3614ee2..d0018c82 100644 --- a/packages/deployer/src/herd-loading/folder-loader/folder-action-factory.ts +++ b/packages/deployer/src/herd-loading/folder-loader/folder-action-factory.ts @@ -1,10 +1,8 @@ import * as fs from "fs" import * as path from "path" import { emptyArray } from "../../helpers/ts-functions" -import { - expandEnvAndMustacheVariablesInFile, - ICreateKubectlDeploymentAction, -} from "../../deployment-actions/kubectl-action/kubectl-deployment-action-factory" +import { expandTemplate } from "@shepherdorg/hbs-template" +import { ICreateKubectlDeploymentAction } from "../../deployment-actions/kubectl-action/kubectl-deployment-action-factory" import { IK8sDirDeploymentAction, IKubectlDeployAction, @@ -136,7 +134,7 @@ export function createFolderActionFactory( const kubeDeploymentRelativePath = path.relative(initialDir, resolvedPath) try { - data = expandEnvAndMustacheVariablesInFile(data) + data = expandTemplate(data) const deploymentAction: IKubectlDeployAction = injected.kubectlDeploymentActionFactory.createKubectlDeployAction( kubeDeploymentRelativePath, data, From 5562429e3e5f24896e4a7225406c4f4ccbe7a6cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0laugur=20S=2E=20Egilsson?= Date: Mon, 11 Apr 2022 16:36:03 +0000 Subject: [PATCH 8/8] Fix integration tests. Upgrade postgres driver (old one stopped working). Cleanup. --- .../integratedtest/shepherd.integratedtest.ts | 3 + .../deployer/src/test-tools/script-test.ts | 28 +- packages/deployer/testbin/test-shepherd.sh | 1 + packages/postgres-backend/package.json | 2 +- packages/postgres-backend/src/index.ts | 8 +- packages/storage-backend-tester/index.ts | 1 + .../apply-configmap_imageconf.yaml | 8 - ...p_www-icelandair-com-nginx-acls-test1.yaml | 9 - ...nfigmap_www-icelandair-com-nginx-acls.yaml | 9 - ...y-deployment_www-icelandair-com-test1.yaml | 67 ---- .../apply-deployment_www-icelandair-com.yaml | 66 ---- .../apply-service_www-fromdir.yaml | 43 --- ...ice_www-icelandair-com-internal-test1.yaml | 14 - ...y-service_www-icelandair-com-internal.yaml | 13 - ...pply-service_www-icelandair-com-test1.yaml | 49 --- .../apply-service_www-icelandair-com.yaml | 47 --- .../delete-configmap_image2-config.yaml | 9 - .../delete-deployment_image2.yaml | 66 ---- .../delete-namespace_monitors.yaml | 4 - .../delete-service_image2.yaml | 21 -- .../test-infrastructure-deployer.txt | 1 - ...est-migration-image-newformat-deployer.txt | 1 - .../testenvimage-migrations-deployer.txt | 1 - .../exported/apply-configmap_imageconf.yaml | 8 - ...p_www-icelandair-com-nginx-acls-test1.yaml | 9 - ...nfigmap_www-icelandair-com-nginx-acls.yaml | 9 - ...y-deployment_www-icelandair-com-test1.yaml | 67 ---- .../apply-deployment_www-icelandair-com.yaml | 66 ---- .../exported/apply-service_www-fromdir.yaml | 43 --- ...ice_www-icelandair-com-internal-test1.yaml | 14 - ...y-service_www-icelandair-com-internal.yaml | 13 - ...pply-service_www-icelandair-com-test1.yaml | 49 --- .../apply-service_www-icelandair-com.yaml | 47 --- .../delete-configmap_image2-config.yaml | 9 - .../exported/delete-deployment_image2.yaml | 66 ---- .../exported/delete-namespace_monitors.yaml | 4 - .../exported/delete-service_image2.yaml | 21 -- .../exported/test-infrastructure-deployer.txt | 1 - ...est-migration-image-newformat-deployer.txt | 1 - .../testenvimage-migrations-deployer.txt | 1 - .../apply-configmap_imageconf.yaml | 8 - ...p_www-icelandair-com-nginx-acls-test1.yaml | 9 - ...nfigmap_www-icelandair-com-nginx-acls.yaml | 9 - ...y-deployment_www-icelandair-com-test1.yaml | 67 ---- .../apply-deployment_www-icelandair-com.yaml | 66 ---- .../apply-service_www-fromdir.yaml | 43 --- ...ice_www-icelandair-com-internal-test1.yaml | 14 - ...y-service_www-icelandair-com-internal.yaml | 13 - ...pply-service_www-icelandair-com-test1.yaml | 49 --- .../apply-service_www-icelandair-com.yaml | 47 --- .../delete-configmap_image2-config.yaml | 9 - .../delete-deployment_image2.yaml | 66 ---- .../delete-namespace_monitors.yaml | 4 - .../delete-service_image2.yaml | 21 -- .../integratedtest/shepherd.integratedtest.ts | 335 ------------------ .../deployment/www-icelandair-com.config.yml | 2 +- yarn.lock | 62 ++-- 57 files changed, 54 insertions(+), 1669 deletions(-) delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-configmap_imageconf.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com-test1.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-service_www-fromdir.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal-test1.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-test1.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/delete-configmap_image2-config.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/delete-deployment_image2.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/delete-namespace_monitors.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/delete-service_image2.yaml delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/test-infrastructure-deployer.txt delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/test-migration-image-newformat-deployer.txt delete mode 100644 packages/test-images/integratedtest/expected/all-deployments/testenvimage-migrations-deployer.txt delete mode 100644 packages/test-images/integratedtest/expected/exported/apply-configmap_imageconf.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com-test1.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/apply-service_www-fromdir.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal-test1.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-test1.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/delete-configmap_image2-config.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/delete-deployment_image2.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/delete-namespace_monitors.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/delete-service_image2.yaml delete mode 100644 packages/test-images/integratedtest/expected/exported/test-infrastructure-deployer.txt delete mode 100644 packages/test-images/integratedtest/expected/exported/test-migration-image-newformat-deployer.txt delete mode 100644 packages/test-images/integratedtest/expected/exported/testenvimage-migrations-deployer.txt delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_imageconf.yaml delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com-test1.yaml delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com.yaml delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-fromdir.yaml delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal-test1.yaml delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal.yaml delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-test1.yaml delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com.yaml delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/delete-configmap_image2-config.yaml delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/delete-deployment_image2.yaml delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/delete-namespace_monitors.yaml delete mode 100644 packages/test-images/integratedtest/expected/k8s-deployments/delete-service_image2.yaml delete mode 100644 packages/test-images/integratedtest/shepherd.integratedtest.ts diff --git a/packages/deployer/src/integratedtest/shepherd.integratedtest.ts b/packages/deployer/src/integratedtest/shepherd.integratedtest.ts index 074fc8e5..3aa5440f 100644 --- a/packages/deployer/src/integratedtest/shepherd.integratedtest.ts +++ b/packages/deployer/src/integratedtest/shepherd.integratedtest.ts @@ -154,6 +154,9 @@ describe("running shepherd", function() { firstRun = script .execute(shepherdTestHarness, [], { env: _.extend(testEnv, process.env), + // stdoutLineHandler: (line: string) => { + // console.log(`DEBUG ${line}`) + // }, }) .done(function(_stdout) { // console.log(`stdout`, stdout) diff --git a/packages/deployer/src/test-tools/script-test.ts b/packages/deployer/src/test-tools/script-test.ts index 532657ee..c8c2192d 100644 --- a/packages/deployer/src/test-tools/script-test.ts +++ b/packages/deployer/src/test-tools/script-test.ts @@ -101,6 +101,7 @@ export interface TScriptTestExecution { expectExitCode: (expectedExitCode: number) => TScriptTestExecution done: (callback: FExecutionCallback) => TScriptTestExecution checkExpectations: () => void + unexpectedError?: string } function emptyArray(): Array { @@ -113,7 +114,6 @@ export type TExecuteOptions = { } export default { - // Pass in debug=true if you want to see output of subject under test. execute: function(command: string, args: string[], options: TExecuteOptions) { options.env = extend({}, options.env, { PATH: process.env.PATH }) @@ -132,19 +132,18 @@ export default { execution.checkExpectations() execution.callback && execution.callback(execError.stdout) } else { - console.error("Process error in test, error code:", execError.code, " stderr:", execError.stderr) - expect.fail( + console.error("Process error in test", execError) + execution.unexpectedError = "Error invoking : " + - command + - " with arguments " + - JSON.stringify(args) + - "\nStdout: \n" + - execError.stdout + - "\nError output:\n" + - execError.stderr + - "\n. ErrorCode:" + - execError.code - ) + command + + " with arguments " + + JSON.stringify(args) + + "\nStdout: \n" + + execError.stdout + + "\nError output:\n" + + execError.stderr + + "\n. ErrorCode:" + + execError.code } }) @@ -220,6 +219,9 @@ export default { return execution }, checkExpectations() { + if (execution.unexpectedError) { + expect.fail(execution.unexpectedError) + } if (execution.expectedExitCode) { expect(execution.actualExitCode).to.equal(execution.expectedExitCode, "Process exit code") } diff --git a/packages/deployer/testbin/test-shepherd.sh b/packages/deployer/testbin/test-shepherd.sh index a350271a..1b01321f 100755 --- a/packages/deployer/testbin/test-shepherd.sh +++ b/packages/deployer/testbin/test-shepherd.sh @@ -12,6 +12,7 @@ export PATH=$(pwd)/testbin:$(pwd)/bin:${PATH} if [ -z "${HERDFILE}" ]; then export HERDFILE="$(pwd)/src/herd-loading/testdata/happypath/herd.yaml" fi + echo Using HERDFILE: ${HERDFILE} if [ -z "${DRYRUN_OUTPUT_FOLDER}" ]; then diff --git a/packages/postgres-backend/package.json b/packages/postgres-backend/package.json index 92d4c7c7..019c8b55 100644 --- a/packages/postgres-backend/package.json +++ b/packages/postgres-backend/package.json @@ -10,7 +10,7 @@ "dependencies": { "bluebird": "^3.7.0", "lodash": "^4.17.15", - "pg": "^7.12.1" + "pg": "^8.7.3" }, "peerDependencies": { "@shepherdorg/metadata": "^5.0.0", diff --git a/packages/postgres-backend/src/index.ts b/packages/postgres-backend/src/index.ts index 75d29d1c..443faaf6 100644 --- a/packages/postgres-backend/src/index.ts +++ b/packages/postgres-backend/src/index.ts @@ -3,7 +3,7 @@ import { PGConnectionConfig } from "./pg-config" export { PgConfig } from "./pg-config" -import {Client} from "pg" +import { Client } from "pg" export interface IPostgresStorageBackend extends IStorageBackend { resetAllDeploymentStates() @@ -31,14 +31,14 @@ const StoreClient = (client: Client) => ({ export function PostgresStore(config: PGConnectionConfig): IPostgresStorageBackend { let client - const ensureDeploymentsTable= async function() { + const ensureDeploymentsTable = async function() { await client.query( - "CREATE TABLE IF NOT EXISTS deployments (identifier TEXT PRIMARY KEY, data JSONB, lastdeployment TIMESTAMP NOT NULL)", + "CREATE TABLE IF NOT EXISTS deployments (identifier TEXT PRIMARY KEY, data JSONB, lastdeployment TIMESTAMP NOT NULL)" ) } return { - async connect() { + async connect() { client = StoreClient(new Client(config)) await client.connect() if (config.schema) { diff --git a/packages/storage-backend-tester/index.ts b/packages/storage-backend-tester/index.ts index cb2a3ed3..02fa69c7 100644 --- a/packages/storage-backend-tester/index.ts +++ b/packages/storage-backend-tester/index.ts @@ -6,6 +6,7 @@ export default (backendName: string, createBackend: () => IStorageBackend) => { describe(`${backendName} store backend`, function() { let store + this.timeout(70000) beforeEach(function() { store = createBackend() }) diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_imageconf.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_imageconf.yaml deleted file mode 100644 index 354416f2..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_imageconf.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: imageconf - labels: - team: one -data: - somedata: svc.host.somewhere diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml deleted file mode 100644 index 2779c54b..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: www-icelandair-com-nginx-acls-test1 - labels: - team: flip - ttl-hours: '48' -data: - whitelist: teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml deleted file mode 100644 index 13956df0..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: www-icelandair-com-nginx-acls - labels: - team: flip -data: - whitelist: |- - teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com-test1.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com-test1.yaml deleted file mode 100644 index 80b13456..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com-test1.yaml +++ /dev/null @@ -1,67 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: www-icelandair-com-test1 - labels: - name: www-icelandair-com-test1 - tier: frontend - ttl-hours: '48' -spec: - replicas: 1 - template: - metadata: - labels: - name: www-icelandair-com-test1 - tier: frontend - spec: - imagePullSecrets: - - name: registry-pull-secret - containers: - - image: 'testenvimage:0.0.0' - name: www-icelandair-com-test1 - resources: - limits: - cpu: 0.8 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - ports: - - containerPort: 81 - name: http-proxy - protocol: TCP - - containerPort: 444 - name: https-proxy - protocol: TCP - volumeMounts: - - name: certs-volume - readOnly: true - mountPath: /volumes/certs - - name: nginx-acls - readOnly: true - mountPath: /etc/nginx/acls/ - env: - - name: RUNTIME_ENVIRONMENT - valueFrom: - configMapKeyRef: - name: nowhardcoded - key: ENV - - image: DOCKER_IMAGE_SSR - name: www-icelandair-com-ssr-test1 - resources: - limits: - cpu: 0.6 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - volumes: - - name: certs-volume - secret: - secretName: star-cert-secret - - name: nginx-acls - configMap: - name: www-icelandair-com-nginx-acls-test1 - items: - - key: whitelist - path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com.yaml deleted file mode 100644 index 1b2f58f6..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/apply-deployment_www-icelandair-com.yaml +++ /dev/null @@ -1,66 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: www-icelandair-com - labels: - name: www-icelandair-com - tier: frontend -spec: - replicas: 2 - template: - metadata: - labels: - name: www-icelandair-com - tier: frontend - spec: - imagePullSecrets: - - name: registry-pull-secret - containers: - - image: testenvimage:0.0.0 - name: www-icelandair-com - resources: - limits: - cpu: 0.8 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - ports: - - containerPort: 81 - name: http-proxy - protocol: TCP - - containerPort: 444 - name: https-proxy - protocol: TCP - volumeMounts: - - name: certs-volume - readOnly: true - mountPath: "/volumes/certs" - - name: nginx-acls - readOnly: true - mountPath: "/etc/nginx/acls/" - env: - - name: RUNTIME_ENVIRONMENT - valueFrom: - configMapKeyRef: - name: nowhardcoded - key: ENV - - image: DOCKER_IMAGE_SSR - name: www-icelandair-com-ssr - resources: - limits: - cpu: 0.6 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - volumes: - - name: certs-volume - secret: - secretName: star-cert-secret - - name: nginx-acls - configMap: - name: www-icelandair-com-nginx-acls - items: - - key: whitelist - path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-fromdir.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-fromdir.yaml deleted file mode 100644 index 34f646a4..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-fromdir.yaml +++ /dev/null @@ -1,43 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-fromdir - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: www - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com - tier: frontend ---- -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-part2 - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: www-com - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com - tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal-test1.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal-test1.yaml deleted file mode 100644 index 1a1a8f3b..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal-test1.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-internal-test1 - labels: - name: www-icelandair-com-internal-test1 - ttl-hours: '48' -spec: - ports: - - port: 10000 - name: http - selector: - name: www-icelandair-com-test1 - tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal.yaml deleted file mode 100644 index 9595938b..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-internal.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-internal - labels: - name: www-icelandair-com-internal -spec: - ports: - - port: 10000 - name: http - selector: - name: www-icelandair-com - tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-test1.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-test1.yaml deleted file mode 100644 index 22d7748a..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com-test1.yaml +++ /dev/null @@ -1,49 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-test1 - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*' - labels: - name: www-icelandair-com-test1 - subdomain: testSDPbeta - topdomain: testtopdomain - team: flip - ttl-hours: '48' -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com-test1 - tier: frontend ---- -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-test1 - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*' - labels: - name: www-icelandair-com-test1 - subdomain: testSDPbeta - topdomain: testtopdomain - team: flip - ttl-hours: '48' -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com-test1 - tier: frontend diff --git a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com.yaml b/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com.yaml deleted file mode 100644 index 83eac885..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/apply-service_www-icelandair-com.yaml +++ /dev/null @@ -1,47 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: www-icelandair-com - subdomain: 'testSDPbeta' - topdomain: testtopdomain - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com - tier: frontend ---- -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: www-icelandair-com - subdomain: testSDPbeta - topdomain: testtopdomain - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com - tier: frontend diff --git a/packages/test-images/integratedtest/expected/all-deployments/delete-configmap_image2-config.yaml b/packages/test-images/integratedtest/expected/all-deployments/delete-configmap_image2-config.yaml deleted file mode 100644 index 337c7d9e..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/delete-configmap_image2-config.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: image2-config - labels: - team: flip -data: - whitelist: |- - teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/delete-deployment_image2.yaml b/packages/test-images/integratedtest/expected/all-deployments/delete-deployment_image2.yaml deleted file mode 100644 index c4d58692..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/delete-deployment_image2.yaml +++ /dev/null @@ -1,66 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: image2 - labels: - name: image2 - tier: frontend -spec: - replicas: 2 - template: - metadata: - labels: - name: image2 - tier: frontend - spec: - imagePullSecrets: - - name: registry-pull-secret - containers: - - image: testenvimage2:999.999.99999 - name: image2 - resources: - limits: - cpu: 0.8 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - ports: - - containerPort: 81 - name: http-proxy - protocol: TCP - - containerPort: 444 - name: https-proxy - protocol: TCP - volumeMounts: - - name: certs-volume - readOnly: true - mountPath: "/volumes/certs" - - name: nginx-acls - readOnly: true - mountPath: "/etc/nginx/acls/" - env: - - name: RUNTIME_ENVIRONMENT - valueFrom: - configMapKeyRef: - name: nowhardcoded - key: ENV - - image: DOCKER_IMAGE_SSR - name: image2-ssr - resources: - limits: - cpu: 0.6 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - volumes: - - name: certs-volume - secret: - secretName: star-cert-secret - - name: nginx-acls - configMap: - name: image2-nginx-acls - items: - - key: whitelist - path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/all-deployments/delete-namespace_monitors.yaml b/packages/test-images/integratedtest/expected/all-deployments/delete-namespace_monitors.yaml deleted file mode 100644 index 9adc13b6..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/delete-namespace_monitors.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: monitors \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/delete-service_image2.yaml b/packages/test-images/integratedtest/expected/all-deployments/delete-service_image2.yaml deleted file mode 100644 index ec63fb4f..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/delete-service_image2.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: image2 - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: image2 - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: image2 - tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/all-deployments/test-infrastructure-deployer.txt b/packages/test-images/integratedtest/expected/all-deployments/test-infrastructure-deployer.txt deleted file mode 100644 index 7ada9e09..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/test-infrastructure-deployer.txt +++ /dev/null @@ -1 +0,0 @@ -docker run -i --rm -e ENV=testit -e INFRASTRUCTURE_IMPORTED_ENV=thatsme test-infrastructure:[image_version] deploy diff --git a/packages/test-images/integratedtest/expected/all-deployments/test-migration-image-newformat-deployer.txt b/packages/test-images/integratedtest/expected/all-deployments/test-migration-image-newformat-deployer.txt deleted file mode 100644 index 93c95a30..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/test-migration-image-newformat-deployer.txt +++ /dev/null @@ -1 +0,0 @@ -docker run -i --rm -e ENV=testit -e MIGRATION_ENV_VARIABLE_ONE=justAValue -e MIGRATION_ENV_VARIABLE_TWO=fixedValue test-migration-image-newformat:[image_version] ls diff --git a/packages/test-images/integratedtest/expected/all-deployments/testenvimage-migrations-deployer.txt b/packages/test-images/integratedtest/expected/all-deployments/testenvimage-migrations-deployer.txt deleted file mode 100644 index 74e22d33..00000000 --- a/packages/test-images/integratedtest/expected/all-deployments/testenvimage-migrations-deployer.txt +++ /dev/null @@ -1 +0,0 @@ -docker run -i --rm -e ENV=testit -e EXPORT1=nowhardcoded -e DB_HOST=postgres-local -e DB_PASS=somedbpass -e THIS_IS_DEPLOYER_ONE=true testenvimage-migrations:[image_version] ls diff --git a/packages/test-images/integratedtest/expected/exported/apply-configmap_imageconf.yaml b/packages/test-images/integratedtest/expected/exported/apply-configmap_imageconf.yaml deleted file mode 100644 index 354416f2..00000000 --- a/packages/test-images/integratedtest/expected/exported/apply-configmap_imageconf.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: imageconf - labels: - team: one -data: - somedata: svc.host.somewhere diff --git a/packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml b/packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml deleted file mode 100644 index 2779c54b..00000000 --- a/packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: www-icelandair-com-nginx-acls-test1 - labels: - team: flip - ttl-hours: '48' -data: - whitelist: teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls.yaml b/packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls.yaml deleted file mode 100644 index 13956df0..00000000 --- a/packages/test-images/integratedtest/expected/exported/apply-configmap_www-icelandair-com-nginx-acls.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: www-icelandair-com-nginx-acls - labels: - team: flip -data: - whitelist: |- - teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com-test1.yaml b/packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com-test1.yaml deleted file mode 100644 index 80b13456..00000000 --- a/packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com-test1.yaml +++ /dev/null @@ -1,67 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: www-icelandair-com-test1 - labels: - name: www-icelandair-com-test1 - tier: frontend - ttl-hours: '48' -spec: - replicas: 1 - template: - metadata: - labels: - name: www-icelandair-com-test1 - tier: frontend - spec: - imagePullSecrets: - - name: registry-pull-secret - containers: - - image: 'testenvimage:0.0.0' - name: www-icelandair-com-test1 - resources: - limits: - cpu: 0.8 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - ports: - - containerPort: 81 - name: http-proxy - protocol: TCP - - containerPort: 444 - name: https-proxy - protocol: TCP - volumeMounts: - - name: certs-volume - readOnly: true - mountPath: /volumes/certs - - name: nginx-acls - readOnly: true - mountPath: /etc/nginx/acls/ - env: - - name: RUNTIME_ENVIRONMENT - valueFrom: - configMapKeyRef: - name: nowhardcoded - key: ENV - - image: DOCKER_IMAGE_SSR - name: www-icelandair-com-ssr-test1 - resources: - limits: - cpu: 0.6 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - volumes: - - name: certs-volume - secret: - secretName: star-cert-secret - - name: nginx-acls - configMap: - name: www-icelandair-com-nginx-acls-test1 - items: - - key: whitelist - path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com.yaml b/packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com.yaml deleted file mode 100644 index 1b2f58f6..00000000 --- a/packages/test-images/integratedtest/expected/exported/apply-deployment_www-icelandair-com.yaml +++ /dev/null @@ -1,66 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: www-icelandair-com - labels: - name: www-icelandair-com - tier: frontend -spec: - replicas: 2 - template: - metadata: - labels: - name: www-icelandair-com - tier: frontend - spec: - imagePullSecrets: - - name: registry-pull-secret - containers: - - image: testenvimage:0.0.0 - name: www-icelandair-com - resources: - limits: - cpu: 0.8 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - ports: - - containerPort: 81 - name: http-proxy - protocol: TCP - - containerPort: 444 - name: https-proxy - protocol: TCP - volumeMounts: - - name: certs-volume - readOnly: true - mountPath: "/volumes/certs" - - name: nginx-acls - readOnly: true - mountPath: "/etc/nginx/acls/" - env: - - name: RUNTIME_ENVIRONMENT - valueFrom: - configMapKeyRef: - name: nowhardcoded - key: ENV - - image: DOCKER_IMAGE_SSR - name: www-icelandair-com-ssr - resources: - limits: - cpu: 0.6 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - volumes: - - name: certs-volume - secret: - secretName: star-cert-secret - - name: nginx-acls - configMap: - name: www-icelandair-com-nginx-acls - items: - - key: whitelist - path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/exported/apply-service_www-fromdir.yaml b/packages/test-images/integratedtest/expected/exported/apply-service_www-fromdir.yaml deleted file mode 100644 index 34f646a4..00000000 --- a/packages/test-images/integratedtest/expected/exported/apply-service_www-fromdir.yaml +++ /dev/null @@ -1,43 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-fromdir - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: www - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com - tier: frontend ---- -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-part2 - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: www-com - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com - tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal-test1.yaml b/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal-test1.yaml deleted file mode 100644 index 1a1a8f3b..00000000 --- a/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal-test1.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-internal-test1 - labels: - name: www-icelandair-com-internal-test1 - ttl-hours: '48' -spec: - ports: - - port: 10000 - name: http - selector: - name: www-icelandair-com-test1 - tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal.yaml b/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal.yaml deleted file mode 100644 index 9595938b..00000000 --- a/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-internal.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-internal - labels: - name: www-icelandair-com-internal -spec: - ports: - - port: 10000 - name: http - selector: - name: www-icelandair-com - tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-test1.yaml b/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-test1.yaml deleted file mode 100644 index 22d7748a..00000000 --- a/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com-test1.yaml +++ /dev/null @@ -1,49 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-test1 - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*' - labels: - name: www-icelandair-com-test1 - subdomain: testSDPbeta - topdomain: testtopdomain - team: flip - ttl-hours: '48' -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com-test1 - tier: frontend ---- -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-test1 - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*' - labels: - name: www-icelandair-com-test1 - subdomain: testSDPbeta - topdomain: testtopdomain - team: flip - ttl-hours: '48' -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com-test1 - tier: frontend diff --git a/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com.yaml b/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com.yaml deleted file mode 100644 index 83eac885..00000000 --- a/packages/test-images/integratedtest/expected/exported/apply-service_www-icelandair-com.yaml +++ /dev/null @@ -1,47 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: www-icelandair-com - subdomain: 'testSDPbeta' - topdomain: testtopdomain - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com - tier: frontend ---- -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: www-icelandair-com - subdomain: testSDPbeta - topdomain: testtopdomain - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com - tier: frontend diff --git a/packages/test-images/integratedtest/expected/exported/delete-configmap_image2-config.yaml b/packages/test-images/integratedtest/expected/exported/delete-configmap_image2-config.yaml deleted file mode 100644 index 337c7d9e..00000000 --- a/packages/test-images/integratedtest/expected/exported/delete-configmap_image2-config.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: image2-config - labels: - team: flip -data: - whitelist: |- - teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/delete-deployment_image2.yaml b/packages/test-images/integratedtest/expected/exported/delete-deployment_image2.yaml deleted file mode 100644 index c4d58692..00000000 --- a/packages/test-images/integratedtest/expected/exported/delete-deployment_image2.yaml +++ /dev/null @@ -1,66 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: image2 - labels: - name: image2 - tier: frontend -spec: - replicas: 2 - template: - metadata: - labels: - name: image2 - tier: frontend - spec: - imagePullSecrets: - - name: registry-pull-secret - containers: - - image: testenvimage2:999.999.99999 - name: image2 - resources: - limits: - cpu: 0.8 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - ports: - - containerPort: 81 - name: http-proxy - protocol: TCP - - containerPort: 444 - name: https-proxy - protocol: TCP - volumeMounts: - - name: certs-volume - readOnly: true - mountPath: "/volumes/certs" - - name: nginx-acls - readOnly: true - mountPath: "/etc/nginx/acls/" - env: - - name: RUNTIME_ENVIRONMENT - valueFrom: - configMapKeyRef: - name: nowhardcoded - key: ENV - - image: DOCKER_IMAGE_SSR - name: image2-ssr - resources: - limits: - cpu: 0.6 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - volumes: - - name: certs-volume - secret: - secretName: star-cert-secret - - name: nginx-acls - configMap: - name: image2-nginx-acls - items: - - key: whitelist - path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/exported/delete-namespace_monitors.yaml b/packages/test-images/integratedtest/expected/exported/delete-namespace_monitors.yaml deleted file mode 100644 index 9adc13b6..00000000 --- a/packages/test-images/integratedtest/expected/exported/delete-namespace_monitors.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: monitors \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/delete-service_image2.yaml b/packages/test-images/integratedtest/expected/exported/delete-service_image2.yaml deleted file mode 100644 index ec63fb4f..00000000 --- a/packages/test-images/integratedtest/expected/exported/delete-service_image2.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: image2 - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: image2 - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: image2 - tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/exported/test-infrastructure-deployer.txt b/packages/test-images/integratedtest/expected/exported/test-infrastructure-deployer.txt deleted file mode 100644 index 7ada9e09..00000000 --- a/packages/test-images/integratedtest/expected/exported/test-infrastructure-deployer.txt +++ /dev/null @@ -1 +0,0 @@ -docker run -i --rm -e ENV=testit -e INFRASTRUCTURE_IMPORTED_ENV=thatsme test-infrastructure:[image_version] deploy diff --git a/packages/test-images/integratedtest/expected/exported/test-migration-image-newformat-deployer.txt b/packages/test-images/integratedtest/expected/exported/test-migration-image-newformat-deployer.txt deleted file mode 100644 index 93c95a30..00000000 --- a/packages/test-images/integratedtest/expected/exported/test-migration-image-newformat-deployer.txt +++ /dev/null @@ -1 +0,0 @@ -docker run -i --rm -e ENV=testit -e MIGRATION_ENV_VARIABLE_ONE=justAValue -e MIGRATION_ENV_VARIABLE_TWO=fixedValue test-migration-image-newformat:[image_version] ls diff --git a/packages/test-images/integratedtest/expected/exported/testenvimage-migrations-deployer.txt b/packages/test-images/integratedtest/expected/exported/testenvimage-migrations-deployer.txt deleted file mode 100644 index 74e22d33..00000000 --- a/packages/test-images/integratedtest/expected/exported/testenvimage-migrations-deployer.txt +++ /dev/null @@ -1 +0,0 @@ -docker run -i --rm -e ENV=testit -e EXPORT1=nowhardcoded -e DB_HOST=postgres-local -e DB_PASS=somedbpass -e THIS_IS_DEPLOYER_ONE=true testenvimage-migrations:[image_version] ls diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_imageconf.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_imageconf.yaml deleted file mode 100644 index 354416f2..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_imageconf.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: imageconf - labels: - team: one -data: - somedata: svc.host.somewhere diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml deleted file mode 100644 index 2779c54b..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls-test1.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: www-icelandair-com-nginx-acls-test1 - labels: - team: flip - ttl-hours: '48' -data: - whitelist: teststring \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml deleted file mode 100644 index 1e75ca8b..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/apply-configmap_www-icelandair-com-nginx-acls.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: www-icelandair-com-nginx-acls - labels: - team: flip -data: - whitelist: |- - teststring diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com-test1.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com-test1.yaml deleted file mode 100644 index 80b13456..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com-test1.yaml +++ /dev/null @@ -1,67 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: www-icelandair-com-test1 - labels: - name: www-icelandair-com-test1 - tier: frontend - ttl-hours: '48' -spec: - replicas: 1 - template: - metadata: - labels: - name: www-icelandair-com-test1 - tier: frontend - spec: - imagePullSecrets: - - name: registry-pull-secret - containers: - - image: 'testenvimage:0.0.0' - name: www-icelandair-com-test1 - resources: - limits: - cpu: 0.8 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - ports: - - containerPort: 81 - name: http-proxy - protocol: TCP - - containerPort: 444 - name: https-proxy - protocol: TCP - volumeMounts: - - name: certs-volume - readOnly: true - mountPath: /volumes/certs - - name: nginx-acls - readOnly: true - mountPath: /etc/nginx/acls/ - env: - - name: RUNTIME_ENVIRONMENT - valueFrom: - configMapKeyRef: - name: nowhardcoded - key: ENV - - image: DOCKER_IMAGE_SSR - name: www-icelandair-com-ssr-test1 - resources: - limits: - cpu: 0.6 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - volumes: - - name: certs-volume - secret: - secretName: star-cert-secret - - name: nginx-acls - configMap: - name: www-icelandair-com-nginx-acls-test1 - items: - - key: whitelist - path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com.yaml deleted file mode 100644 index 1b2f58f6..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/apply-deployment_www-icelandair-com.yaml +++ /dev/null @@ -1,66 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: www-icelandair-com - labels: - name: www-icelandair-com - tier: frontend -spec: - replicas: 2 - template: - metadata: - labels: - name: www-icelandair-com - tier: frontend - spec: - imagePullSecrets: - - name: registry-pull-secret - containers: - - image: testenvimage:0.0.0 - name: www-icelandair-com - resources: - limits: - cpu: 0.8 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - ports: - - containerPort: 81 - name: http-proxy - protocol: TCP - - containerPort: 444 - name: https-proxy - protocol: TCP - volumeMounts: - - name: certs-volume - readOnly: true - mountPath: "/volumes/certs" - - name: nginx-acls - readOnly: true - mountPath: "/etc/nginx/acls/" - env: - - name: RUNTIME_ENVIRONMENT - valueFrom: - configMapKeyRef: - name: nowhardcoded - key: ENV - - image: DOCKER_IMAGE_SSR - name: www-icelandair-com-ssr - resources: - limits: - cpu: 0.6 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - volumes: - - name: certs-volume - secret: - secretName: star-cert-secret - - name: nginx-acls - configMap: - name: www-icelandair-com-nginx-acls - items: - - key: whitelist - path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-fromdir.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-fromdir.yaml deleted file mode 100644 index 34f646a4..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-fromdir.yaml +++ /dev/null @@ -1,43 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-fromdir - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: www - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com - tier: frontend ---- -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-part2 - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: www-com - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com - tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal-test1.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal-test1.yaml deleted file mode 100644 index 1a1a8f3b..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal-test1.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-internal-test1 - labels: - name: www-icelandair-com-internal-test1 - ttl-hours: '48' -spec: - ports: - - port: 10000 - name: http - selector: - name: www-icelandair-com-test1 - tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal.yaml deleted file mode 100644 index 9595938b..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-internal.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-internal - labels: - name: www-icelandair-com-internal -spec: - ports: - - port: 10000 - name: http - selector: - name: www-icelandair-com - tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-test1.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-test1.yaml deleted file mode 100644 index 22d7748a..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com-test1.yaml +++ /dev/null @@ -1,49 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-test1 - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*' - labels: - name: www-icelandair-com-test1 - subdomain: testSDPbeta - topdomain: testtopdomain - team: flip - ttl-hours: '48' -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com-test1 - tier: frontend ---- -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com-test1 - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*' - labels: - name: www-icelandair-com-test1 - subdomain: testSDPbeta - topdomain: testtopdomain - team: flip - ttl-hours: '48' -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com-test1 - tier: frontend diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com.yaml deleted file mode 100644 index 83eac885..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/apply-service_www-icelandair-com.yaml +++ /dev/null @@ -1,47 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: www-icelandair-com - subdomain: 'testSDPbeta' - topdomain: testtopdomain - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com - tier: frontend ---- -apiVersion: v1 -kind: Service -metadata: - name: www-icelandair-com - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: www-icelandair-com - subdomain: testSDPbeta - topdomain: testtopdomain - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: www-icelandair-com - tier: frontend diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/delete-configmap_image2-config.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/delete-configmap_image2-config.yaml deleted file mode 100644 index c75f0554..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/delete-configmap_image2-config.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: image2-config - labels: - team: flip -data: - whitelist: |- - teststring diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/delete-deployment_image2.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/delete-deployment_image2.yaml deleted file mode 100644 index c4d58692..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/delete-deployment_image2.yaml +++ /dev/null @@ -1,66 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: image2 - labels: - name: image2 - tier: frontend -spec: - replicas: 2 - template: - metadata: - labels: - name: image2 - tier: frontend - spec: - imagePullSecrets: - - name: registry-pull-secret - containers: - - image: testenvimage2:999.999.99999 - name: image2 - resources: - limits: - cpu: 0.8 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - ports: - - containerPort: 81 - name: http-proxy - protocol: TCP - - containerPort: 444 - name: https-proxy - protocol: TCP - volumeMounts: - - name: certs-volume - readOnly: true - mountPath: "/volumes/certs" - - name: nginx-acls - readOnly: true - mountPath: "/etc/nginx/acls/" - env: - - name: RUNTIME_ENVIRONMENT - valueFrom: - configMapKeyRef: - name: nowhardcoded - key: ENV - - image: DOCKER_IMAGE_SSR - name: image2-ssr - resources: - limits: - cpu: 0.6 - memory: 512M - requests: - cpu: 0.4 - memory: 256M - volumes: - - name: certs-volume - secret: - secretName: star-cert-secret - - name: nginx-acls - configMap: - name: image2-nginx-acls - items: - - key: whitelist - path: whitelist.conf diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/delete-namespace_monitors.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/delete-namespace_monitors.yaml deleted file mode 100644 index 9adc13b6..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/delete-namespace_monitors.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: monitors \ No newline at end of file diff --git a/packages/test-images/integratedtest/expected/k8s-deployments/delete-service_image2.yaml b/packages/test-images/integratedtest/expected/k8s-deployments/delete-service_image2.yaml deleted file mode 100644 index ec63fb4f..00000000 --- a/packages/test-images/integratedtest/expected/k8s-deployments/delete-service_image2.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: image2 - annotations: - service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" - labels: - name: image2 - team: flip -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 81 - name: http-proxy-protocol - - port: 443 - targetPort: 444 - name: https-proxy-protocol - selector: - name: image2 - tier: frontend \ No newline at end of file diff --git a/packages/test-images/integratedtest/shepherd.integratedtest.ts b/packages/test-images/integratedtest/shepherd.integratedtest.ts deleted file mode 100644 index 6eefea7c..00000000 --- a/packages/test-images/integratedtest/shepherd.integratedtest.ts +++ /dev/null @@ -1,335 +0,0 @@ -import * as _ from "lodash" - -import { PgConfig, PostgresStore as PgBackend } from "@shepherdorg/postgres-backend" - -import script, { TScriptTestExecution } from "@shepherdorg/deployer/dist/test-tools/script-test" -import { TFileSystemPath } from "@shepherdorg/deployer/dist/helpers/basic-types" -import { base64Encode } from "@shepherdorg/deployer/dist/template/base64-env-subst" -import { IPostgresStorageBackend } from "@shepherdorg/postgres-backend" -import { expect } from "chai" - -const fs = require("fs") -const path = require("path") -const cleanDir = require("@shepherdorg/deployer/dist/test-tools/clean-dir") - -function ensureCleanOutputFolder(firstRoundFolder: TFileSystemPath) { - if (!fs.existsSync(firstRoundFolder)) { - fs.mkdirSync(firstRoundFolder) - } - cleanDir(firstRoundFolder, false) -} - -describe("running shepherd", function() { - let shepherdTestHarness = path.join(process.cwd(), "testbin/test-shepherd.sh") - - this.timeout(40000) - - beforeEach(function() { - if (!fs.existsSync("./.build/.testdata")) { - fs.mkdirSync("./.build/.testdata") - } - if (!fs.existsSync("./.build/.testdata")) { - fs.mkdirSync("./.build/.testdata") - } - if (!fs.existsSync("./.build/.testdata/actual")) { - fs.mkdirSync("./.build/.testdata/actual") - } - cleanDir("./.build/.testdata/actual", false) - }) - - describe("using file state storage", function() { - beforeEach(() => { - delete process.env.SHEPHERD_UI_API_ENDPOINT - let shepherdStoreDir = "./.build/.shepherdstore" - cleanDir(shepherdStoreDir) - }) - - it("should deploy everything", function(done) { - script - .execute(shepherdTestHarness, ["--dryrun"], { - env: _.extend({}, process.env, { - SHEPHERD_PG_HOST: "", - INFRASTRUCTURE_IMPORTED_ENV: "thatsme", - SERVICE_HOST_NAME: "svc.host.somewhere", - }), - }) - .ignoreLinesWith(["buildDate", "lastCommits", "kubeConfigB64", "gitHash"]) - .output("./.build/.testdata/kubeapply") - .shouldEqual("./src/integratedtest/expected/all-deployments") - .done(function() { - done() - }) - }) - }) - - describe("adding to herd", function() { - let tempHerdFilePath = path.resolve("./.build/herd-for-editing.yaml") - - beforeEach(() => { - let shepherdStoreDir = "./.build/.shepherdstore" - cleanDir(shepherdStoreDir) - cleanDir("./.build/.testdata/testexport", false) - - fs.copyFileSync("./src/herd-loading/testdata/herd-editing/herd.yaml", tempHerdFilePath) - }) - - it("should add deployment to herd", done => { - script - .execute(shepherdTestHarness, ["--dryrun", tempHerdFilePath], { - env: _.extend({}, process.env, { - SHEPHERD_PG_HOST: "", - UPSTREAM_IMAGE_URL: "testenvimage:0.0.0", - UPSTREAM_HERD_KEY: "addedimage", - UPSTREAM_HERD_DESCRIPTION: "Just a casual e2e test", - }), - }) - .stdout() - .shouldContain("Adding addedimage") - .stdout() - .shouldContain("Deploying addedimage") - .stdout() - .shouldContain("Executing deployment plan dryrun...") - .stdout() - .shouldContain("...plan dryrun execution complete") - .done(function() { - done() - }) - }) - }) - - describe("use of state storage", function() { - const EXPECTED_STATE_STORE_KEYS = [ - "integratedtestenv-Service_image2", - "integratedtestenv-Service_www-fromdir", - "integratedtestenv-Service_www-icelandair-com-internal", - "integratedtestenv-Service_www-icelandair-com-internal-test1", - "integratedtestenv-Deployment_image2", - "integratedtestenv-Namespace_monitors", - "integratedtestenv-ConfigMap_www-icelandair-com-nginx-acls", - "integratedtestenv-ConfigMap_www-icelandair-com-nginx-acls-test1", - "integratedtestenv-ConfigMap_image2-config", - "integratedtestenv-Deployment_www-icelandair-com", - "integratedtestenv-Deployment_www-icelandair-com-test1", - "integratedtestenv-Service_www-icelandair-com", - "integratedtestenv-Service_www-icelandair-com-test1", - "integratedtestenv-test-migration-image-newformat", - "integratedtestenv-testenvimage-migrations:0.0.0", - "integratedtestenv-testInfrastructure", - ] - - const firstRoundFolder = path.join(process.cwd(), "./.build/kubeapply") - const secondRoundFolder = path.join(process.cwd(), "./.build/kubeapply-secondround") - let pgBackend: IPostgresStorageBackend - let firstRun: TScriptTestExecution - let secondRun: TScriptTestExecution - - before(function(done) { - if (!process.env.SHEPHERD_PG_HOST) { - process.env.SHEPHERD_PG_HOST = "localhost" - } - process.env.RESET_FOR_REAL = "yes-i-really-want-to-drop-deployments-table" - process.env.UPSTREAM_WAIT_FOR_ROLLOUT = "true" - let config = PgConfig() - pgBackend = PgBackend(config) - - ensureCleanOutputFolder(firstRoundFolder) - ensureCleanOutputFolder(secondRoundFolder) - - let postgresConnectionError = (err: Error) => { - throw new Error("Error connecting to postgres! Cause: " + err.message) - } - pgBackend - .connect() - .catch(postgresConnectionError) - .then(() => { - pgBackend.resetAllDeploymentStates().catch((resetError: Error) => { - console.error(`RESET ERROR !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!`, resetError) - return resetError - }) - }) - .then(() => { - process.env.KUBECTL_OUTPUT_FOLDER = firstRoundFolder - - let testEnv = { INFRASTRUCTURE_IMPORTED_ENV: "thatsme", SERVICE_HOST_NAME: "svc.host.somewhere" } - firstRun = script - .execute(shepherdTestHarness, [], { - env: _.extend(testEnv, process.env), - }) - .done(function(_stdout) { - // console.log(`stdout`, stdout) - process.env.KUBECTL_OUTPUT_FOLDER = secondRoundFolder - - secondRun = script - .execute(shepherdTestHarness, [], { - env: _.extend(testEnv, process.env), - }) - .done(function(_stdout) { - done() - }) - }) - }) - .catch((setupError: Error) => { - console.error(`Error setting up for test!`, setupError) - }) - }) - - it("should deploy once in two runs", function() { - firstRun - .output(firstRoundFolder) - .shouldEqual(process.cwd() + "/src/integratedtest/expected/k8s-deployments") - .checkExpectations() - secondRun - .output(secondRoundFolder) - .shouldBeEmptyDir() - .checkExpectations() - }) - - EXPECTED_STATE_STORE_KEYS.forEach(expectedKey => { - it(`should store ${expectedKey} in backend`, () => { - return pgBackend.get(expectedKey).then(resultingState => { - expect(resultingState.value).not.to.equal(undefined) - }) - }) - }) - }) - - describe("postDeployTest support", function() { - beforeEach(() => { - const firstRoundFolder = path.join(process.cwd(), "./.build/kubeapply") - ensureCleanOutputFolder(firstRoundFolder) - - process.env.KUBECTL_OUTPUT_FOLDER = firstRoundFolder - delete process.env.SHEPHERD_UI_API_ENDPOINT - let shepherdStoreDir = "./.build/.shepherdstore" - cleanDir(shepherdStoreDir) - }) - - it(" should fail on post tests and attempt to rollback to previous version, independently on deployment plans, and exit with number of failing plans", function(done) { - script - .execute(shepherdTestHarness, ["--fakerun", "src/herd-loading/testdata/deploytestherd/herd.yaml"], { - env: _.extend({}, process.env, { - SHEPHERD_PG_HOST: "", - FAIL_POSTDEPLOY_TEST: true, - PRETEST_EXITCODE: "0", - POSTTEST_EXITCODE: "1", - }), - }) - .expectExitCode(1) - .stdout() - .shouldContain("Executing docker command pretest") - .stdout() - .shouldContain("Executing docker command pretest") - .stdout() - .shouldContain("Post test exit with code 1") - .stdout() - .shouldContain("Executing docker command deploy") - .stdout() - .shouldContain("Yessir, deploying now") - .stdout() - .shouldContain("Executing docker command posttest") - .stdout() - .shouldContain("Test run failed, rolling back to last good version.") - .stdout() - .shouldContain("Rollback complete.") - .stdout() - .shouldContain("Execution of 1 deployment plan(s) resulted in failure") - .stdout() - .shouldNotContain("not found") - .done(function(_output, _code) { - done() - }) - }) - }) - - xit("should execute infrastructure deployers first to completion", () => {}) - - describe("with state storage", function() { - beforeEach(function() { - if (!process.env.SHEPHERD_PG_HOST) { - process.env.SHEPHERD_PG_HOST = "localhost" - } - - process.env.RESET_FOR_REAL = "yes-i-really-want-to-drop-deployments-table" - let pgBackend = PgBackend(PgConfig()) - - cleanDir("./.build/.testdata/testexport", false) - - return pgBackend - .connect() - .then(() => pgBackend.resetAllDeploymentStates()) - .catch((err: Error) => { - throw new Error("Error connecting to postgres! Cause: " + err.message) - }) - }) - - it("should modify branch deployment", function(done) { - script - .execute(shepherdTestHarness, ["--dryrun"], { - env: _.extend( - { - INFRASTRUCTURE_IMPORTED_ENV: "thatsme", - SERVICE_HOST_NAME: "svc.host.somewhere", - }, - process.env - ), - }) - .done(function() { - done() - }) - }) - - const testEnv = { - www_icelandair_com_image: "www-image:99", - PREFIXED_TOP_DOMAIN_NAME: "testtopdomain", - SUB_DOMAIN_PREFIX: "testSDP", - WWW_ICELANDAIR_IP_WHITELIST: base64Encode("teststring"), - DEBUG_MODE: "false", - PERFORMANCE_LOG: "false", - MICROSERVICES_POSTGRES_RDS_HOST: "postgres-local", - MICRO_SITES_DB_PASSWORD: "somedbpass", - ENV: "testit", - EXPORT1: "nowhardcoded", - SERVICE_HOST_NAME: "svc.host.somewhere", - } - - beforeEach(function() { - if (!fs.existsSync(".build")) { - fs.mkdirSync(".build") - } - if (!fs.existsSync(".build/testexport")) { - fs.mkdirSync(".build/testexport") - } - cleanDir(".build/testexport", false) - }) - - it("should export deployment documents directly", function(done) { - let expectedOutputFileOrDir = process.cwd() + "/src/integratedtest/expected/exported" - script - .execute( - "./dist/shepherd.js", - [ - "./src/herd-loading/testdata/happypath/herd.yaml", - "integratedtestenv", - "--export", - "--outputDir", - ".build/testexport", - ], - { - env: _.extend( - { - GLOBAL_MIGRATION_ENV_VARIABLE_ONE: "justAValue", - INFRASTRUCTURE_IMPORTED_ENV: "thatsme", - }, - testEnv, - process.env - ), - } - ) - .output(".build/testexport") - .shouldEqual(expectedOutputFileOrDir) - .done(function() { - done() - }) - }) - }) -}) diff --git a/packages/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml b/packages/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml index 42a70d9f..95985369 100644 --- a/packages/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml +++ b/packages/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com.config.yml @@ -6,4 +6,4 @@ metadata: team: flip data: whitelist: |- - {{Base64Encode WWW_ICELANDAIR_IP_WHITELIST}} + {{Base64Decode WWW_ICELANDAIR_IP_WHITELIST}} diff --git a/yarn.lock b/yarn.lock index 19ab4971..fef4a691 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4951,41 +4951,41 @@ performance-now@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" -pg-connection-string@0.1.3: - version "0.1.3" - resolved "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-0.1.3.tgz#da1847b20940e42ee1492beaf65d49d91b245df7" - integrity sha1-2hhHsglA5C7hSSvq9l1J2RskXfc= - pg-connection-string@^2.4.0: version "2.4.0" resolved "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.4.0.tgz#c979922eb47832999a204da5dbe1ebf2341b6a10" integrity sha512-3iBXuv7XKvxeMrIgym7njT+HlZkwZqqGX4Bu9cci8xHZNT+Um1gWKqCsAzcC0d95rcKMU5WBg6YRUcHyV0HZKQ== +pg-connection-string@^2.5.0: + version "2.5.0" + resolved "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.5.0.tgz#538cadd0f7e603fc09a12590f3b8a452c2c0cf34" + integrity sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ== + pg-int8@1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c" integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw== -pg-packet-stream@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/pg-packet-stream/-/pg-packet-stream-1.1.0.tgz#e45c3ae678b901a2873af1e17b92d787962ef914" - integrity sha512-kRBH0tDIW/8lfnnOyTwKD23ygJ/kexQVXZs7gEyBljw4FYqimZFxnMMx50ndZ8In77QgfGuItS5LLclC2TtjYg== - -pg-pool@^2.0.10: - version "2.0.10" - resolved "https://registry.npmjs.org/pg-pool/-/pg-pool-2.0.10.tgz#842ee23b04e86824ce9d786430f8365082d81c4a" - integrity sha512-qdwzY92bHf3nwzIUcj+zJ0Qo5lpG/YxchahxIN8+ZVmXqkahKXsnl2aiJPHLYN9o5mB/leG+Xh6XKxtP7e0sjg== - pg-pool@^3.2.2: version "3.2.2" resolved "https://registry.npmjs.org/pg-pool/-/pg-pool-3.2.2.tgz#a560e433443ed4ad946b84d774b3f22452694dff" integrity sha512-ORJoFxAlmmros8igi608iVEbQNNZlp89diFVx6yV5v+ehmpMY9sK6QgpmgoXbmkNaBAx8cOOZh9g80kJv1ooyA== +pg-pool@^3.5.1: + version "3.5.1" + resolved "https://registry.npmjs.org/pg-pool/-/pg-pool-3.5.1.tgz#f499ce76f9bf5097488b3b83b19861f28e4ed905" + integrity sha512-6iCR0wVrro6OOHFsyavV+i6KYL4lVNyYAB9RD18w66xSzN+d8b66HiwuP30Gp1SH5O9T82fckkzsRjlrhD0ioQ== + pg-protocol@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.4.0.tgz#43a71a92f6fe3ac559952555aa3335c8cb4908be" integrity sha512-El+aXWcwG/8wuFICMQjM5ZSAm6OWiJicFdNYo+VY3QP+8vI4SvLIWVe51PppTzMhikUJR+PsyIFKqfdXPz/yxA== +pg-protocol@^1.5.0: + version "1.5.0" + resolved "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.5.0.tgz#b5dd452257314565e2d54ab3c132adc46565a6a0" + integrity sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ== + pg-types@^2.1.0: version "2.2.0" resolved "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz#2d0250d636454f7cfa3b6ae0382fdfa8063254a3" @@ -4997,20 +4997,6 @@ pg-types@^2.1.0: postgres-date "~1.0.4" postgres-interval "^1.1.0" -pg@^7.12.1: - version "7.18.2" - resolved "https://registry.npmjs.org/pg/-/pg-7.18.2.tgz#4e219f05a00aff4db6aab1ba02f28ffa4513b0bb" - integrity sha512-Mvt0dGYMwvEADNKy5PMQGlzPudKcKKzJds/VbOeZJpb6f/pI3mmoXX0JksPgI3l3JPP/2Apq7F36O63J7mgveA== - dependencies: - buffer-writer "2.0.0" - packet-reader "1.0.0" - pg-connection-string "0.1.3" - pg-packet-stream "^1.1.0" - pg-pool "^2.0.10" - pg-types "^2.1.0" - pgpass "1.x" - semver "4.3.2" - pg@^8.0.3: version "8.5.1" resolved "https://registry.npmjs.org/pg/-/pg-8.5.1.tgz#34dcb15f6db4a29c702bf5031ef2e1e25a06a120" @@ -5024,6 +5010,19 @@ pg@^8.0.3: pg-types "^2.1.0" pgpass "1.x" +pg@^8.7.3: + version "8.7.3" + resolved "https://registry.npmjs.org/pg/-/pg-8.7.3.tgz#8a5bdd664ca4fda4db7997ec634c6e5455b27c44" + integrity sha512-HPmH4GH4H3AOprDJOazoIcpI49XFsHCe8xlrjHkWiapdbHK+HLtbm/GQzXYAZwmPju/kzKhjaSfMACG+8cgJcw== + dependencies: + buffer-writer "2.0.0" + packet-reader "1.0.0" + pg-connection-string "^2.5.0" + pg-pool "^3.5.1" + pg-protocol "^1.5.0" + pg-types "^2.1.0" + pgpass "1.x" + pgpass@1.x: version "1.0.4" resolved "https://registry.npmjs.org/pgpass/-/pgpass-1.0.4.tgz#85eb93a83800b20f8057a2b029bf05abaf94ea9c" @@ -5612,11 +5611,6 @@ semver-compare@^1.0.0: version "5.7.1" resolved "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" -semver@4.3.2: - version "4.3.2" - resolved "https://registry.npmjs.org/semver/-/semver-4.3.2.tgz#c7a07158a80bedd052355b770d82d6640f803be7" - integrity sha1-x6BxWKgL7dBSNVt3DYLWZA+AO+c= - semver@^6.0.0, semver@^6.2.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"