diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe1d8661..6fbfee5c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,11 @@ jobs: java-version: '17' distribution: 'temurin' + - name: Install clojure tools + uses: DeLaGuardo/setup-clojure@13.0 + with: + lein: 2.11.2 + - name: Install Dependencies env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/cdk/bin/cdk.ts b/cdk/bin/cdk.ts index 8525aff4..85453d2b 100644 --- a/cdk/bin/cdk.ts +++ b/cdk/bin/cdk.ts @@ -1,49 +1,63 @@ #!/usr/bin/env node -import { App } from 'aws-cdk-lib' +import { App } from "aws-cdk-lib"; import { HeratepalveluAMISStack } from "../lib/amis"; import { HeratepalveluTEPStack } from "../lib/tep"; import { HeratepalveluTPKStack } from "../lib/tpk"; import { HeratepalveluTEPRAHOITUSStack } from "../lib/teprah"; +import { simpleGit, SimpleGitOptions } from "simple-git"; + +const checkGitStatus = async () => { + const options: Partial = { + baseDir: process.cwd(), + binary: 'git', + maxConcurrentProcesses: 6, + trimmed: false, + }; + const git = simpleGit(options); + + const status = await git.status(); + const gitLog = await git.log(); + const upstreamBranch = await git.getRemotes(); + + if (upstreamBranch.length === 0) { + throw new Error("No upstream branch"); + } -const git = require("git-utils"); -const repo = git.open("."); - -const status = repo.getStatus(); -const aheadBehindCount = repo.getAheadBehindCount(); -const upstreamBranch = repo.getUpstreamBranch(); - -if (!upstreamBranch) { - throw new Error("No upstream branch"); -} - -const canDeploy = (Object.entries(status).length === 0 && aheadBehindCount.ahead === 0 && aheadBehindCount.behind === 0); - -const version = canDeploy ? repo.getReferenceTarget(repo.getHead()) : "uncommitted"; - -const app = new App(); - -new HeratepalveluAMISStack(app, "sieni-services-heratepalvelu", 'sieni', version); -const tepSieni = new HeratepalveluTEPStack(app, "sieni-services-heratepalvelu-tep", 'sieni', version); -new HeratepalveluTEPRAHOITUSStack(app, "sieni-services-heratepalvelu-teprah", 'sieni', version, tepSieni.jaksotunnusTable); -new HeratepalveluTPKStack(app, "sieni-services-heratepalvelu-tpk", 'sieni', version, tepSieni.jaksotunnusTable); - -if (canDeploy) { - new HeratepalveluAMISStack(app, "pallero-services-heratepalvelu", 'pallero', version); - const tepPallero = new HeratepalveluTEPStack(app, "pallero-services-heratepalvelu-tep", 'pallero', version); - new HeratepalveluTEPRAHOITUSStack(app, "pallero-services-heratepalvelu-teprah", 'pallero', version, tepPallero.jaksotunnusTable); - new HeratepalveluTPKStack(app, "pallero-services-heratepalvelu-tpk", 'pallero', version, tepPallero.jaksotunnusTable); - - if (upstreamBranch === "refs/remotes/origin/master") { - new HeratepalveluAMISStack(app, "sade-services-heratepalvelu", 'sade', version); - const tepSade = new HeratepalveluTEPStack(app, "sade-services-heratepalvelu-tep", 'sade', version); - new HeratepalveluTEPRAHOITUSStack(app, "sade-services-heratepalvelu-teprah", 'sade', version, tepSade.jaksotunnusTable); - new HeratepalveluTPKStack(app, "sade-services-heratepalvelu-tpk", 'sade', version, tepSade.jaksotunnusTable); + const version = status.isClean() ? gitLog.latest?.hash ?? "uncommitted" : "uncommitted"; + + const app = new App(); + + new HeratepalveluAMISStack(app, "sieni-services-heratepalvelu", 'sieni', version); + const tepSieni = new HeratepalveluTEPStack(app, "sieni-services-heratepalvelu-tep", 'sieni', version); + new HeratepalveluTEPRAHOITUSStack(app, "sieni-services-heratepalvelu-teprah", 'sieni', version, tepSieni.jaksotunnusTable); + new HeratepalveluTPKStack(app, "sieni-services-heratepalvelu-tpk", 'sieni', version, tepSieni.jaksotunnusTable); + + if (status.isClean() && status.ahead === 0 && status.behind === 0) { + new HeratepalveluAMISStack(app, "pallero-services-heratepalvelu", 'pallero', version); + const tepPallero = new HeratepalveluTEPStack(app, "pallero-services-heratepalvelu-tep", 'pallero', version); + new HeratepalveluTEPRAHOITUSStack(app, "pallero-services-heratepalvelu-teprah", 'pallero', version, tepPallero.jaksotunnusTable); + new HeratepalveluTPKStack(app, "pallero-services-heratepalvelu-tpk", 'pallero', version, tepPallero.jaksotunnusTable); + + if (status.tracking === "origin/master") { + new HeratepalveluAMISStack(app, "sade-services-heratepalvelu", 'sade', version); + const tepSade = new HeratepalveluTEPStack(app, "sade-services-heratepalvelu-tep", 'sade', version); + new HeratepalveluTEPRAHOITUSStack(app, "sade-services-heratepalvelu-teprah", 'sade', version, tepSade.jaksotunnusTable); + new HeratepalveluTPKStack(app, "sade-services-heratepalvelu-tpk", 'sade', version, tepSade.jaksotunnusTable); + } else { + console.log("\nNOT IN MASTER BRANCH!!!\n") + } } else { - console.log("\nNOT IN MASTER BRANCH!!!\n") + console.log("\nUncommited changes or local is ahead/behind of remote, so not doing anything:\n"); + console.log(status); + console.log("\n"); } -} else { - console.log("\nUncommited changes or local is ahead/behind of remote, so not doing anything:\n"); - console.log(status); - console.log(aheadBehindCount); - console.log("\n"); -} +}; + +checkGitStatus() + .then(() => { + console.log("Done checking git status."); + }) + .catch((e) => { + console.log("Error in git status check:", e); + process.exit(1); + }); diff --git a/cdk/package-lock.json b/cdk/package-lock.json index f944e1ac..036fdc7b 100644 --- a/cdk/package-lock.json +++ b/cdk/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "aws-cdk-lib": "^2.150.0", "constructs": "^10.3.0", - "git-utils": "^5.7.3", + "simple-git": "^3.27.0", "source-map-support": "^0.5.21" }, "bin": { @@ -1001,6 +1001,21 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@kwsites/file-exists": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", + "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==", + "license": "MIT", + "dependencies": { + "debug": "^4.1.1" + } + }, + "node_modules/@kwsites/promise-deferred": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz", + "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==", + "license": "MIT" + }, "node_modules/@sinclair/typebox": { "version": "0.25.21", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz", @@ -1254,11 +1269,6 @@ "sprintf-js": "~1.0.2" } }, - "node_modules/async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w==" - }, "node_modules/aws-cdk": { "version": "2.150.0", "resolved": "https://registry.npmjs.org/aws-cdk/-/aws-cdk-2.150.0.tgz", @@ -1710,12 +1720,14 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1918,7 +1930,8 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "node_modules/constructs": { "version": "10.3.0", @@ -1955,12 +1968,12 @@ } }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -2147,21 +2160,11 @@ "node": ">=8" } }, - "node_modules/fs-plus": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fs-plus/-/fs-plus-3.1.1.tgz", - "integrity": "sha512-Se2PJdOWXqos1qVTkvqqjb0CSnfBnwwD+pq+z4ksT+e97mEShod/hrNg0TRCCsXPbJzcIq+NuzQhigunMWMJUA==", - "dependencies": { - "async": "^1.5.2", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.2", - "underscore-plus": "1.x" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true }, "node_modules/fsevents": { "version": "2.3.2", @@ -2222,20 +2225,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/git-utils": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/git-utils/-/git-utils-5.7.3.tgz", - "integrity": "sha512-in1hjFfmzY86gKBt+YMTaVyCGtX2WTnN0uPj37bI5HsrnU2oj8OFcWOEzOI5PxQXPMxFxtvRebOHAOGB8M125w==", - "hasInstallScript": true, - "dependencies": { - "fs-plus": "^3.0.0", - "nan": "^2.14.2" - } - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -2334,6 +2328,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -2342,7 +2337,8 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "node_modules/is-arrayish": { "version": "0.2.1", @@ -3303,6 +3299,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -3310,35 +3307,11 @@ "node": "*" } }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", - "dependencies": { - "minimist": "^1.2.6" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/nan": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", - "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" }, "node_modules/natural-compare": { "version": "1.4.0", @@ -3383,6 +3356,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "dependencies": { "wrappy": "1" } @@ -3484,6 +3458,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -3643,17 +3618,6 @@ "node": ">=10" } }, - "node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -3690,6 +3654,21 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "node_modules/simple-git": { + "version": "3.27.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.27.0.tgz", + "integrity": "sha512-ivHoFS9Yi9GY49ogc6/YAi3Fl9ROnF4VyubNylgCkA+RVqLaKWnDSzXOVzya8csELIaWaYNutsEuAhZrtOjozA==", + "license": "MIT", + "dependencies": { + "@kwsites/file-exists": "^1.1.1", + "@kwsites/promise-deferred": "^1.1.1", + "debug": "^4.3.5" + }, + "funding": { + "type": "github", + "url": "https://github.com/steveukx/git-js?sponsor=1" + } + }, "node_modules/sisteransi": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", @@ -4036,19 +4015,6 @@ "node": ">=4.2.0" } }, - "node_modules/underscore": { - "version": "1.13.6", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", - "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==" - }, - "node_modules/underscore-plus": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/underscore-plus/-/underscore-plus-1.7.0.tgz", - "integrity": "sha512-A3BEzkeicFLnr+U/Q3EyWwJAQPbA19mtZZ4h+lLq3ttm9kn8WC4R3YpuJZEXmWdLjYP47Zc8aLZm9kwdv+zzvA==", - "dependencies": { - "underscore": "^1.9.1" - } - }, "node_modules/update-browserslist-db": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", @@ -4145,7 +4111,8 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true }, "node_modules/write-file-atomic": { "version": "4.0.2", @@ -4984,6 +4951,19 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "@kwsites/file-exists": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", + "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==", + "requires": { + "debug": "^4.1.1" + } + }, + "@kwsites/promise-deferred": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz", + "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==" + }, "@sinclair/typebox": { "version": "0.25.21", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz", @@ -5210,11 +5190,6 @@ "sprintf-js": "~1.0.2" } }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w==" - }, "aws-cdk": { "version": "2.150.0", "resolved": "https://registry.npmjs.org/aws-cdk/-/aws-cdk-2.150.0.tgz", @@ -5510,12 +5485,14 @@ "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5652,7 +5629,8 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "constructs": { "version": "10.3.0", @@ -5683,12 +5661,11 @@ } }, "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "requires": { - "ms": "2.1.2" + "ms": "^2.1.3" } }, "dedent": { @@ -5824,21 +5801,11 @@ "path-exists": "^4.0.0" } }, - "fs-plus": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fs-plus/-/fs-plus-3.1.1.tgz", - "integrity": "sha512-Se2PJdOWXqos1qVTkvqqjb0CSnfBnwwD+pq+z4ksT+e97mEShod/hrNg0TRCCsXPbJzcIq+NuzQhigunMWMJUA==", - "requires": { - "async": "^1.5.2", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.2", - "underscore-plus": "1.x" - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true }, "fsevents": { "version": "2.3.2", @@ -5877,19 +5844,11 @@ "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true }, - "git-utils": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/git-utils/-/git-utils-5.7.3.tgz", - "integrity": "sha512-in1hjFfmzY86gKBt+YMTaVyCGtX2WTnN0uPj37bI5HsrnU2oj8OFcWOEzOI5PxQXPMxFxtvRebOHAOGB8M125w==", - "requires": { - "fs-plus": "^3.0.0", - "nan": "^2.14.2" - } - }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -5958,6 +5917,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -5966,7 +5926,8 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "is-arrayish": { "version": "0.2.1", @@ -6710,33 +6671,15 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "requires": { "brace-expansion": "^1.1.7" } }, - "minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==" - }, - "mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", - "requires": { - "minimist": "^1.2.6" - } - }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "nan": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", - "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "natural-compare": { "version": "1.4.0", @@ -6775,6 +6718,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "requires": { "wrappy": "1" } @@ -6844,7 +6788,8 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true }, "path-key": { "version": "3.1.1", @@ -6958,14 +6903,6 @@ "integrity": "sha512-6K/gDlqgQscOlg9fSRpWstA8sYe8rbELsSTNpx+3kTrsVCzvSl0zIvRErM7fdl9ERWDsKnrLnwB+Ne89918XOg==", "dev": true }, - "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "requires": { - "glob": "^7.1.3" - } - }, "semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -6993,6 +6930,16 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "simple-git": { + "version": "3.27.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.27.0.tgz", + "integrity": "sha512-ivHoFS9Yi9GY49ogc6/YAi3Fl9ROnF4VyubNylgCkA+RVqLaKWnDSzXOVzya8csELIaWaYNutsEuAhZrtOjozA==", + "requires": { + "@kwsites/file-exists": "^1.1.1", + "@kwsites/promise-deferred": "^1.1.1", + "debug": "^4.3.5" + } + }, "sisteransi": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", @@ -7218,19 +7165,6 @@ "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true }, - "underscore": { - "version": "1.13.6", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", - "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==" - }, - "underscore-plus": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/underscore-plus/-/underscore-plus-1.7.0.tgz", - "integrity": "sha512-A3BEzkeicFLnr+U/Q3EyWwJAQPbA19mtZZ4h+lLq3ttm9kn8WC4R3YpuJZEXmWdLjYP47Zc8aLZm9kwdv+zzvA==", - "requires": { - "underscore": "^1.9.1" - } - }, "update-browserslist-db": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", @@ -7298,7 +7232,8 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true }, "write-file-atomic": { "version": "4.0.2", diff --git a/cdk/package.json b/cdk/package.json index 54dd60f4..f9c8de6d 100644 --- a/cdk/package.json +++ b/cdk/package.json @@ -22,7 +22,7 @@ "dependencies": { "aws-cdk-lib": "^2.150.0", "constructs": "^10.3.0", - "git-utils": "^5.7.3", + "simple-git": "^3.27.0", "source-map-support": "^0.5.21" } } diff --git a/src/oph/heratepalvelu/external/elisa.clj b/src/oph/heratepalvelu/external/elisa.clj index 19940e79..9d7c06d2 100644 --- a/src/oph/heratepalvelu/external/elisa.clj +++ b/src/oph/heratepalvelu/external/elisa.clj @@ -21,23 +21,21 @@ "Työpaikkaohjaajakysely - Enkät till arbetsplatshandledaren - " "Survey to workplace instructors" "\n\n" + linkki + "\n\n" "Kiitos koulutussopimus-/oppisopimusopiskelijoiden ohjaamisesta! " - "Kerro, miten yhteistyömme onnistui. " - "Kyselyssä arvioidaan oppilaitosta (ei opiskelijaa). " - "Palautteella kehitämme toimintaamme." + "Pyydämme arvioimaan oppilaitoksemme toimintaa ja yhteistyömme " + "onnistumista." "\n\n" "Tack för att du handleder studerande på utbildningsavtal/läroavtal! " - "Berätta gärna hur vårt samarbete fungerade. " - "I enkäten utvärderas läroanstalten (inte den studerande). " - "Responsen använder vi för att utveckla vår verksamhet." + "Utvärdera gärna vår läroanstalts verksamhet och hur vårt samarbete " + "har lyckats." "\n\n" "Thank you for guiding students with a training " - "agreement/apprenticeship! Please, tell us how our co-operation " - "worked. The survey assesses the institution, not the student." + "agreement/apprenticeship! Please evaluate the activities of our " + "institution and the success of our co-operation." "\n\n" - linkki - "\n\n" - "Osoitelähde Opetushallituksen (OPH) eHOKS-rekisteri")) + "Osoitelähde: Opetushallitus, eHOKS-rekisteri")) (defn tep-muistutus-msg-body "Luo työpaikkaohjaajakyselyn muistutuksen viestin tekstin." @@ -47,35 +45,33 @@ "Påminnelse: Enkät till arbetsplatshandledaren - " "Reminder: Survey to workplace instructors" "\n\n" - "Hyvä työpaikkaohjaaja, muistathan antaa palautetta oppilaitokselle. " - "Kiitos, että vastaat! - " - "Bästa arbetsplatshandledare, kom ihåg att ge din respons till " - "läroanstalten. Tack för att du svarar! - " - "Dear workplace instructor, please give your feedback to the " - "institution. Thank you for responding!" - "\n\n" linkki "\n\n" - "Osoitelähde Opetushallituksen (OPH) eHOKS-rekisteri")) + "Muistathan antaa meille palautetta. Kiitos, kun vastaat!" + "\n\n" + "Kom ihåg att ge din respons till läroanstalten. Tack för att du svarar!" + "\n\n" + "Please give your feedback to the institution. Thank you for responding!" + "\n\n" + "Osoitelähde: Opetushallitus, eHOKS-rekisteri")) (defn amis-msg-body "Luo opiskelijapalauteviestin tekstin." [linkki oppilaitos] - (str oppilaitos ": Palautetta oppilaitokselle - " - "Respons till läroanstalten - Feedback to educational institution." + (str oppilaitos ": Päättökysely - Slutenkät - VET-feedback survey" "\n\n" - "Arvostamme näkemyksiäsi. Kerro, missä onnistuimme ja mitä voisimme " - "tehdä paremmin. Palaute annetaan nimettömänä." + linkki "\n\n" - "Vi uppskattar dina synpunkter. Berätta gärna för oss vad vi gjorde " - "bra och vad vi skulle kunna göra bättre. Responsen samlas in anonymt." + "Missä onnistuimme ja mitä voisimme tehdä paremmin? " + "Kiitos, kun vastaat! Palaute annetaan nimettömänä." "\n\n" - "We appreciate your opinions. Please tell us, where we did well, " - "and what could we do better. Your feedback is collected anonymously." + "Vad har vi lyckats med och vad kan vi göra bättre? " + "Tack för att du svarar! Responsen ges anonymt." "\n\n" - linkki + "Where did we succeed? What could we do better? " + "Thank you for replying! All feedback is anonymous." "\n\n" - "Osoitelähde Opetushallituksen (OPH) eHOKS-rekisteri")) + "Osoitelähde: Opetushallitus, eHOKS-rekisteri")) (defn send-sms "Lähettää SMS-viestin viestintäpalveluun." diff --git a/test/oph/heratepalvelu/external/elisa_test.clj b/test/oph/heratepalvelu/external/elisa_test.clj index 68a336d0..5b512d2c 100644 --- a/test/oph/heratepalvelu/external/elisa_test.clj +++ b/test/oph/heratepalvelu/external/elisa_test.clj @@ -10,18 +10,15 @@ (def mock-tep-msg-body (str "Testilaitos, Testilaitos 2: Työpaikkaohjaajakysely - " "Enkät till arbetsplatshandledaren - Survey to workplace instructors" - "\n\nKiitos koulutussopimus-/oppisopimusopiskelijoiden ohjaamisesta! " - "Kerro, miten yhteistyömme onnistui. Kyselyssä arvioidaan " - "oppilaitosta (ei opiskelijaa). Palautteella kehitämme " - "toimintaamme.\n\nTack för att du handleder studerande på " - "utbildningsavtal/läroavtal! Berätta gärna hur vårt samarbete " - "fungerade. I enkäten utvärderas läroanstalten (inte den studerande). " - "Responsen använder vi för att utveckla vår verksamhet.\n\n" - "Thank you for guiding students with a training " - "agreement/apprenticeship! Please, tell us how our co-operation worked. " - "The survey assesses the institution, not the student.\n\n" - "kysely.linkki/123\n\nOsoitelähde Opetushallituksen (OPH) " - "eHOKS-rekisteri")) + "\n\nkysely.linkki/123\n\nKiitos koulutussopimus-/" + "oppisopimusopiskelijoiden ohjaamisesta! Pyydämme arvioimaan " + "oppilaitoksemme toimintaa ja yhteistyömme onnistumista.\n\n" + "Tack för att du handleder studerande på utbildningsavtal/läroavtal! " + "Utvärdera gärna vår läroanstalts verksamhet och hur vårt samarbete " + "har lyckats.\n\nThank you for guiding students with a training " + "agreement/apprenticeship! Please evaluate the activities of our " + "institution and the success of our co-operation." + "\n\nOsoitelähde: Opetushallitus, eHOKS-rekisteri")) (deftest test-tep-msg-body (testing "Varmista, että msg-body tekee formatointia oikein" @@ -31,15 +28,12 @@ (def mock-tep-muistutus-msg-body (str "Testilaitos, Testilaitos 2: Muistutus: Työpaikkaohjaajakysely - " - "Påminnelse: Enkät till arbetsplatshandledaren - " - "Reminder: Survey to workplace instructors\n\nHyvä " - "työpaikkaohjaaja, muistathan antaa palautetta oppilaitokselle. " - "Kiitos, että vastaat! - Bästa arbetsplatshandledare, kom ihåg att " - "ge din respons till läroanstalten. Tack för att du svarar!" - " - Dear workplace instructor, please give your feedback to the " - "institution. Thank you for responding!\n\n" - "kysely.linkki/123\n\nOsoitelähde Opetushallituksen (OPH) " - "eHOKS-rekisteri")) + "Påminnelse: Enkät till arbetsplatshandledaren - Reminder: Survey to " + "workplace instructors\n\nkysely.linkki/123\n\nMuistathan antaa meille " + "palautetta. Kiitos, kun vastaat!\n\nKom ihåg att ge din respons till " + "läroanstalten. Tack för att du svarar!\n\nPlease give your feedback to " + "the institution. Thank you for responding!" + "\n\nOsoitelähde: Opetushallitus, eHOKS-rekisteri")) (deftest test-tep-muistutus-msg-body (testing "Varmista, että muistutus-msg-body tekee formatointia oikein"