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/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-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 4c8df989..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(expandEnvVariables(deploymentFileDescriptorContent.split("\n"))) -} - export interface ICreateKubectlDeploymentAction { executeKubectlDeploymentAction: ( thisIsMe: IKubectlDeployAction, 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/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, 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/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 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/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/entrypoint.sh b/packages/test-images/integratedtest/testimages/test-image-json-metadata/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-image-json-metadata/entrypoint.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 59% 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 index 770c1302..ac33201b 100644 --- a/packages/deployer/src/integratedtest/testimages/test-image-json-metadata/kube.yaml +++ b/packages/test-images/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-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 72% 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 index c1e3d1c5..95985369 100644 --- 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 @@ -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-image/deployment/www-icelandair-com.deployment.yml b/packages/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com.deployment.yml similarity index 95% 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 index 806cd50b..dd763bce 100644 --- 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 @@ -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/test-images/integratedtest/testimages/test-image/deployment/www-icelandair-com.service.yml similarity index 83% 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 index ef5872aa..ab516527 100644 --- 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 @@ -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-image/entrypoint.sh b/packages/test-images/integratedtest/testimages/test-image/entrypoint.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image/entrypoint.sh rename to packages/test-images/integratedtest/testimages/test-image/entrypoint.sh 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-image3/deployment/image2.deployment.yml b/packages/test-images/integratedtest/testimages/test-image2/deployment/image2.deployment.yml similarity index 95% rename from packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.deployment.yml rename to packages/test-images/integratedtest/testimages/test-image2/deployment/image2.deployment.yml index df0a0130..9b8a2b44 100644 --- a/packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.deployment.yml +++ b/packages/test-images/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-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-image2/entrypoint.sh b/packages/test-images/integratedtest/testimages/test-image2/entrypoint.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image2/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 69% 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 index 7bbeb119..edd4a371 100644 --- a/packages/deployer/src/integratedtest/testimages/test-image3/deployment/image2.config.yml +++ b/packages/test-images/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-image2/deployment/image2.deployment.yml b/packages/test-images/integratedtest/testimages/test-image3/deployment/image2.deployment.yml similarity index 95% rename from packages/deployer/src/integratedtest/testimages/test-image2/deployment/image2.deployment.yml rename to packages/test-images/integratedtest/testimages/test-image3/deployment/image2.deployment.yml index df0a0130..9b8a2b44 100644 --- a/packages/deployer/src/integratedtest/testimages/test-image2/deployment/image2.deployment.yml +++ b/packages/test-images/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/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-image3/entrypoint.sh b/packages/test-images/integratedtest/testimages/test-image3/entrypoint.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-image3/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/entrypoint.sh b/packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/entrypoint.sh similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/entrypoint.sh rename to packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/entrypoint.sh diff --git a/packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/kube.yaml b/packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/kube.yaml similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-k8s-image-with-deployment-tests/kube.yaml rename to packages/test-images/integratedtest/testimages/test-k8s-image-with-deployment-tests/kube.yaml 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/Dockerfile b/packages/test-images/integratedtest/testimages/test-migration-image-newformat/Dockerfile similarity index 100% rename from packages/deployer/src/integratedtest/testimages/test-migration-image-newformat/Dockerfile rename to packages/test-images/integratedtest/testimages/test-migration-image-newformat/Dockerfile 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..32253aa4 --- /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", 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"