@payfit/nx-core 4.11.1-beta-fix-path-conformance.3 → 4.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/executors/publisher/docker.js +2 -1
- package/dist/src/executors/publisher/docker.js.map +1 -1
- package/dist/src/utils/docker.d.ts +6 -4
- package/dist/src/utils/docker.js +7 -5
- package/dist/src/utils/docker.js.map +1 -1
- package/dist/src/utils/github.d.ts +8 -0
- package/dist/src/utils/github.js +22 -0
- package/dist/src/utils/github.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ const fs = require("node:fs");
|
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const aws_auth_1 = require("../../utils/aws-auth");
|
|
7
7
|
const docker_1 = require("../../utils/docker");
|
|
8
|
+
const github_1 = require("../../utils/github");
|
|
8
9
|
async function publishDocker(options, context, version) {
|
|
9
10
|
await (0, aws_auth_1.checkAwsAuth)();
|
|
10
11
|
await (0, aws_auth_1.loginToEcr)();
|
|
@@ -14,7 +15,7 @@ async function publishDocker(options, context, version) {
|
|
|
14
15
|
throw new Error('Dockerfile not found in project root');
|
|
15
16
|
}
|
|
16
17
|
console.log('Building docker image with version ' + version);
|
|
17
|
-
await (0, docker_1.buildDockerImage)(options.ecrRegistry, projectDockerfile, version);
|
|
18
|
+
await (0, docker_1.buildDockerImage)(options.ecrRegistry, projectDockerfile, version, await (0, github_1.getSanitizedCurrentGitRepoUrl)(), await (0, github_1.getCurrentGitCommitSha)());
|
|
18
19
|
console.log(`Publishing docker image to ${options.ecrRegistry} with version ${version}`);
|
|
19
20
|
return await (0, aws_auth_1.pushImageToEcr)(options.ecrRegistry, version);
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.js","sourceRoot":"","sources":["../../../../src/executors/publisher/docker.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"docker.js","sourceRoot":"","sources":["../../../../src/executors/publisher/docker.ts"],"names":[],"mappings":";;AAaA,sCA8BC;AA3CD,8BAA6B;AAC7B,+BAA2B;AAI3B,mDAA+E;AAC/E,+CAAqD;AACrD,+CAG2B;AAGpB,KAAK,UAAU,aAAa,CACjC,OAAiC,EACjC,OAAwB,EACxB,OAAe;IAIf,MAAM,IAAA,uBAAY,GAAE,CAAA;IACpB,MAAM,IAAA,qBAAU,GAAE,CAAA;IAElB,MAAM,WAAW,GACf,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAA;IACnE,MAAM,iBAAiB,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,YAAY,CAAC,CAAA;IAEzD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;IACzD,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,qCAAqC,GAAG,OAAO,CAAC,CAAA;IAC5D,MAAM,IAAA,yBAAgB,EACpB,OAAO,CAAC,WAAW,EACnB,iBAAiB,EACjB,OAAO,EACP,MAAM,IAAA,sCAA6B,GAAE,EACrC,MAAM,IAAA,+BAAsB,GAAE,CAC/B,CAAA;IAED,OAAO,CAAC,GAAG,CACT,8BAA8B,OAAO,CAAC,WAAW,iBAAiB,OAAO,EAAE,CAC5E,CAAA;IACD,OAAO,MAAM,IAAA,yBAAc,EAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;AAC3D,CAAC"}
|
|
@@ -7,12 +7,14 @@ export declare function getDockerOrPodman(): Promise<string>;
|
|
|
7
7
|
/**
|
|
8
8
|
* Builds a Docker image using the provided Dockerfile.
|
|
9
9
|
*
|
|
10
|
-
* @param imageName
|
|
11
|
-
* @param dockerfilePath
|
|
12
|
-
* @param version
|
|
10
|
+
* @param imageName
|
|
11
|
+
* @param dockerfilePath
|
|
12
|
+
* @param version
|
|
13
|
+
* @param gitRepoUrl
|
|
14
|
+
* @param commitSha
|
|
13
15
|
* @return {Promise<{success: boolean, stdout: string, stderr: string}>} A promise that resolves to an object containing the success status, stdout, and stderr of the command.
|
|
14
16
|
*/
|
|
15
|
-
export declare function buildDockerImage(imageName: string, dockerfilePath: string, version: string): Promise<{
|
|
17
|
+
export declare function buildDockerImage(imageName: string, dockerfilePath: string, version: string, gitRepoUrl: string, commitSha: string): Promise<{
|
|
16
18
|
success: boolean;
|
|
17
19
|
stdout: string;
|
|
18
20
|
stderr: string;
|
package/dist/src/utils/docker.js
CHANGED
|
@@ -21,13 +21,15 @@ async function getDockerOrPodman() {
|
|
|
21
21
|
/**
|
|
22
22
|
* Builds a Docker image using the provided Dockerfile.
|
|
23
23
|
*
|
|
24
|
-
* @param imageName
|
|
25
|
-
* @param dockerfilePath
|
|
26
|
-
* @param version
|
|
24
|
+
* @param imageName
|
|
25
|
+
* @param dockerfilePath
|
|
26
|
+
* @param version
|
|
27
|
+
* @param gitRepoUrl
|
|
28
|
+
* @param commitSha
|
|
27
29
|
* @return {Promise<{success: boolean, stdout: string, stderr: string}>} A promise that resolves to an object containing the success status, stdout, and stderr of the command.
|
|
28
30
|
*/
|
|
29
|
-
async function buildDockerImage(imageName, dockerfilePath, version) {
|
|
31
|
+
async function buildDockerImage(imageName, dockerfilePath, version, gitRepoUrl, commitSha) {
|
|
30
32
|
const dockerOrPodman = await getDockerOrPodman();
|
|
31
|
-
return (0, exec_1.exec_command)(`${dockerOrPodman} buildx build -t ${process.env.AWS_ECR_REGISTRY}/${imageName}:${version} -f ${dockerfilePath} --secret id=NPM_TOKEN
|
|
33
|
+
return (0, exec_1.exec_command)(`${dockerOrPodman} buildx build -t ${process.env.AWS_ECR_REGISTRY}/${imageName}:${version} -f ${dockerfilePath} --secret id=NPM_TOKEN . --build-arg DD_GIT_REPOSITORY_URL=${gitRepoUrl} --build-arg DD_GIT_COMMIT_SHA=${commitSha}`);
|
|
32
34
|
}
|
|
33
35
|
//# sourceMappingURL=docker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.js","sourceRoot":"","sources":["../../../src/utils/docker.ts"],"names":[],"mappings":";;AAOA,8CAQC;
|
|
1
|
+
{"version":3,"file":"docker.js","sourceRoot":"","sources":["../../../src/utils/docker.ts"],"names":[],"mappings":";;AAOA,8CAQC;AAYD,4CAWC;AAtCD,iCAAqC;AAErC;;;;GAIG;AACI,KAAK,UAAU,iBAAiB;IACrC,IAAI,CAAC;QACH,MAAM,IAAA,mBAAY,EAAC,kBAAkB,CAAC,CAAA;QACtC,OAAO,QAAQ,CAAA;IACjB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAA;QAC9C,OAAO,QAAQ,CAAA;IACjB,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACI,KAAK,UAAU,gBAAgB,CACpC,SAAiB,EACjB,cAAsB,EACtB,OAAe,EACf,UAAkB,EAClB,SAAiB;IAEjB,MAAM,cAAc,GAAG,MAAM,iBAAiB,EAAE,CAAA;IAChD,OAAO,IAAA,mBAAY,EACjB,GAAG,cAAc,oBAAoB,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,SAAS,IAAI,OAAO,OAAO,cAAc,8DAA8D,UAAU,kCAAkC,SAAS,EAAE,CACpO,CAAA;AACH,CAAC"}
|
|
@@ -2,3 +2,11 @@
|
|
|
2
2
|
* Get sanitized current git branch name
|
|
3
3
|
*/
|
|
4
4
|
export declare function getSanitizedCurrentGitBranch(): Promise<string>;
|
|
5
|
+
/**
|
|
6
|
+
* Get current commit sha
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCurrentGitCommitSha(): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Get sanitized current repo url
|
|
11
|
+
*/
|
|
12
|
+
export declare function getSanitizedCurrentGitRepoUrl(): Promise<string>;
|
package/dist/src/utils/github.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSanitizedCurrentGitBranch = getSanitizedCurrentGitBranch;
|
|
4
|
+
exports.getCurrentGitCommitSha = getCurrentGitCommitSha;
|
|
5
|
+
exports.getSanitizedCurrentGitRepoUrl = getSanitizedCurrentGitRepoUrl;
|
|
4
6
|
const exec_1 = require("./exec");
|
|
5
7
|
/**
|
|
6
8
|
* Get sanitized current git branch name
|
|
@@ -14,4 +16,24 @@ async function getSanitizedCurrentGitBranch() {
|
|
|
14
16
|
.replace(/[^a-z0-9]/g, '')
|
|
15
17
|
: '';
|
|
16
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Get current commit sha
|
|
21
|
+
*/
|
|
22
|
+
async function getCurrentGitCommitSha() {
|
|
23
|
+
const commitSha = await (0, exec_1.exec_command)(`git rev-parse HEAD`);
|
|
24
|
+
return commitSha.success ? commitSha.stdout : '';
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get sanitized current repo url
|
|
28
|
+
*/
|
|
29
|
+
async function getSanitizedCurrentGitRepoUrl() {
|
|
30
|
+
const repoUrlExec = await (0, exec_1.exec_command)(`git config --get remote.origin.url`);
|
|
31
|
+
if (repoUrlExec.success) {
|
|
32
|
+
const repoUrlMatching = repoUrlExec.stdout.match(/github\.com[:/]PayFit\/[^/]+/);
|
|
33
|
+
if (repoUrlMatching && repoUrlMatching.length > 0) {
|
|
34
|
+
return `https://${repoUrlMatching[0].trim().replace(':', '/').replace('.git', '')}`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
17
39
|
//# sourceMappingURL=github.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../../src/utils/github.ts"],"names":[],"mappings":";;AAKA,oEAQC;
|
|
1
|
+
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../../src/utils/github.ts"],"names":[],"mappings":";;AAKA,oEAQC;AAKD,wDAGC;AAKD,sEAWC;AArCD,iCAAqC;AAErC;;GAEG;AACI,KAAK,UAAU,4BAA4B;IAChD,MAAM,UAAU,GAAG,MAAM,IAAA,mBAAY,EAAC,2BAA2B,CAAC,CAAA;IAClE,OAAO,UAAU,CAAC,OAAO;QACvB,CAAC,CAAC,UAAU,CAAC,MAAM;aACd,IAAI,EAAE;aACN,WAAW,EAAE;aACb,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;QAC9B,CAAC,CAAC,EAAE,CAAA;AACR,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,sBAAsB;IAC1C,MAAM,SAAS,GAAG,MAAM,IAAA,mBAAY,EAAC,oBAAoB,CAAC,CAAA;IAC1D,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;AAClD,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,6BAA6B;IACjD,MAAM,WAAW,GAAG,MAAM,IAAA,mBAAY,EAAC,oCAAoC,CAAC,CAAA;IAC5E,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;QACxB,MAAM,eAAe,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAC9C,8BAA8B,CAC/B,CAAA;QACD,IAAI,eAAe,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClD,OAAO,WAAW,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAA;QACrF,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC"}
|