@payfit/nx-core 0.0.0-e2e → 0.0.0-semver

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.
Files changed (149) hide show
  1. package/README.md +10 -163
  2. package/dist/src/executors/publisher/docker.d.ts +3 -1
  3. package/dist/src/executors/publisher/docker.js +12 -57
  4. package/dist/src/executors/publisher/docker.js.map +1 -1
  5. package/dist/src/executors/publisher/executor.js +12 -9
  6. package/dist/src/executors/publisher/executor.js.map +1 -1
  7. package/dist/src/executors/publisher/helm.d.ts +5 -1
  8. package/dist/src/executors/publisher/helm.js +11 -40
  9. package/dist/src/executors/publisher/helm.js.map +1 -1
  10. package/dist/src/executors/publisher/schema.d.ts +5 -0
  11. package/dist/src/executors/publisher/schema.json +0 -44
  12. package/dist/src/index.d.ts +1 -24
  13. package/dist/src/index.js +11 -67
  14. package/dist/src/index.js.map +1 -1
  15. package/dist/src/scripts/version-actions.d.ts +20 -3
  16. package/dist/src/scripts/version-actions.js +41 -23
  17. package/dist/src/scripts/version-actions.js.map +1 -1
  18. package/dist/src/utils/{common/aws-auth.d.ts → aws-auth.d.ts} +8 -16
  19. package/dist/src/utils/aws-auth.js +84 -0
  20. package/dist/src/utils/aws-auth.js.map +1 -0
  21. package/dist/src/utils/docker.d.ts +16 -12
  22. package/dist/src/utils/docker.js +23 -63
  23. package/dist/src/utils/docker.js.map +1 -1
  24. package/dist/src/utils/exec.d.ts +7 -0
  25. package/dist/src/utils/exec.js +25 -0
  26. package/dist/src/utils/exec.js.map +1 -0
  27. package/dist/src/utils/get-version.d.ts +6 -0
  28. package/dist/src/utils/get-version.js +14 -0
  29. package/dist/src/utils/get-version.js.map +1 -0
  30. package/dist/src/utils/github.d.ts +4 -0
  31. package/dist/src/utils/github.js +17 -0
  32. package/dist/src/utils/github.js.map +1 -0
  33. package/dist/src/utils/helm.d.ts +16 -32
  34. package/dist/src/utils/helm.js +15 -83
  35. package/dist/src/utils/helm.js.map +1 -1
  36. package/dist/src/utils/import-esm.js.map +1 -0
  37. package/dist/src/utils/{common/tsh.d.ts → tsh.d.ts} +0 -1
  38. package/dist/src/utils/{common/tsh.js → tsh.js} +15 -20
  39. package/dist/src/utils/tsh.js.map +1 -0
  40. package/executors.json +2 -12
  41. package/package.json +18 -42
  42. package/dist/src/codegen.d.ts +0 -3
  43. package/dist/src/codegen.js +0 -25
  44. package/dist/src/codegen.js.map +0 -1
  45. package/dist/src/executors/preview-deploy/README.md +0 -5
  46. package/dist/src/executors/preview-deploy/argocdOverride.d.ts +0 -4
  47. package/dist/src/executors/preview-deploy/argocdOverride.js +0 -22
  48. package/dist/src/executors/preview-deploy/argocdOverride.js.map +0 -1
  49. package/dist/src/executors/preview-deploy/executor.d.ts +0 -4
  50. package/dist/src/executors/preview-deploy/executor.js +0 -143
  51. package/dist/src/executors/preview-deploy/executor.js.map +0 -1
  52. package/dist/src/executors/preview-deploy/kargoPolicy.d.ts +0 -14
  53. package/dist/src/executors/preview-deploy/kargoPolicy.js +0 -69
  54. package/dist/src/executors/preview-deploy/kargoPolicy.js.map +0 -1
  55. package/dist/src/executors/preview-deploy/schema.json +0 -28
  56. package/dist/src/executors/publisher/README.md +0 -3
  57. package/dist/src/executors/publisher/lambda.d.ts +0 -18
  58. package/dist/src/executors/publisher/lambda.js +0 -86
  59. package/dist/src/executors/publisher/lambda.js.map +0 -1
  60. package/dist/src/executors/release/README.md +0 -15
  61. package/dist/src/executors/release/executor.d.ts +0 -4
  62. package/dist/src/executors/release/executor.js +0 -104
  63. package/dist/src/executors/release/executor.js.map +0 -1
  64. package/dist/src/executors/release/schema.json +0 -37
  65. package/dist/src/generators/init/README.md +0 -5
  66. package/dist/src/generators/init/files/.circleci/config.yml.template +0 -232
  67. package/dist/src/generators/init/files/.circleci/teleport/shared-charts.conf.template +0 -24
  68. package/dist/src/generators/init/files/.npmrc.template +0 -1
  69. package/dist/src/generators/init/init.d.ts +0 -13
  70. package/dist/src/generators/init/init.js +0 -278
  71. package/dist/src/generators/init/init.js.map +0 -1
  72. package/dist/src/generators/init/schema.json +0 -7
  73. package/dist/src/scripts/codegen-with-auth.js +0 -55
  74. package/dist/src/scripts/version-actions.mock.d.ts +0 -6
  75. package/dist/src/scripts/version-actions.mock.js +0 -61
  76. package/dist/src/scripts/version-actions.mock.js.map +0 -1
  77. package/dist/src/utils/common/aws-auth.js +0 -145
  78. package/dist/src/utils/common/aws-auth.js.map +0 -1
  79. package/dist/src/utils/common/circleci.d.ts +0 -2
  80. package/dist/src/utils/common/circleci.js +0 -20
  81. package/dist/src/utils/common/circleci.js.map +0 -1
  82. package/dist/src/utils/common/exec.d.ts +0 -4
  83. package/dist/src/utils/common/exec.js +0 -52
  84. package/dist/src/utils/common/exec.js.map +0 -1
  85. package/dist/src/utils/common/github.d.ts +0 -20
  86. package/dist/src/utils/common/github.js +0 -60
  87. package/dist/src/utils/common/github.js.map +0 -1
  88. package/dist/src/utils/common/import-esm.js.map +0 -1
  89. package/dist/src/utils/common/logger.d.ts +0 -1
  90. package/dist/src/utils/common/logger.js +0 -8
  91. package/dist/src/utils/common/logger.js.map +0 -1
  92. package/dist/src/utils/common/nx.d.ts +0 -22
  93. package/dist/src/utils/common/nx.js +0 -174
  94. package/dist/src/utils/common/nx.js.map +0 -1
  95. package/dist/src/utils/common/s3.d.ts +0 -1
  96. package/dist/src/utils/common/s3.js +0 -18
  97. package/dist/src/utils/common/s3.js.map +0 -1
  98. package/dist/src/utils/common/tsh.js.map +0 -1
  99. package/dist/src/utils/datadog.d.ts +0 -1
  100. package/dist/src/utils/datadog.js +0 -33
  101. package/dist/src/utils/datadog.js.map +0 -1
  102. package/dist/src/utils/helm.mock.d.ts +0 -85
  103. package/dist/src/utils/helm.mock.js +0 -100
  104. package/dist/src/utils/helm.mock.js.map +0 -1
  105. package/dist/src/utils/lambda/aws-lambda.d.ts +0 -47
  106. package/dist/src/utils/lambda/aws-lambda.js +0 -231
  107. package/dist/src/utils/lambda/aws-lambda.js.map +0 -1
  108. package/dist/src/utils/lambda/lambda.d.ts +0 -7
  109. package/dist/src/utils/lambda/lambda.js +0 -20
  110. package/dist/src/utils/lambda/lambda.js.map +0 -1
  111. package/dist/src/utils/lambda/oci.d.ts +0 -8
  112. package/dist/src/utils/lambda/oci.js +0 -22
  113. package/dist/src/utils/lambda/oci.js.map +0 -1
  114. package/dist/src/utils/lambda/publish.d.ts +0 -14
  115. package/dist/src/utils/lambda/publish.js +0 -44
  116. package/dist/src/utils/lambda/publish.js.map +0 -1
  117. package/dist/src/utils/lambda/spacelift.d.ts +0 -3
  118. package/dist/src/utils/lambda/spacelift.js +0 -55
  119. package/dist/src/utils/lambda/spacelift.js.map +0 -1
  120. package/dist/src/utils/spacelift/lib/__generated__/fragment-masking.d.ts +0 -19
  121. package/dist/src/utils/spacelift/lib/__generated__/fragment-masking.js +0 -22
  122. package/dist/src/utils/spacelift/lib/__generated__/fragment-masking.js.map +0 -1
  123. package/dist/src/utils/spacelift/lib/__generated__/gql.d.ts +0 -15
  124. package/dist/src/utils/spacelift/lib/__generated__/gql.js +0 -8
  125. package/dist/src/utils/spacelift/lib/__generated__/gql.js.map +0 -1
  126. package/dist/src/utils/spacelift/lib/__generated__/graphql.d.ts +0 -9426
  127. package/dist/src/utils/spacelift/lib/__generated__/graphql.js +0 -819
  128. package/dist/src/utils/spacelift/lib/__generated__/graphql.js.map +0 -1
  129. package/dist/src/utils/spacelift/lib/__generated__/index.d.ts +0 -2
  130. package/dist/src/utils/spacelift/lib/__generated__/index.js +0 -6
  131. package/dist/src/utils/spacelift/lib/__generated__/index.js.map +0 -1
  132. package/dist/src/utils/spacelift/lib/graphql.service.d.ts +0 -18
  133. package/dist/src/utils/spacelift/lib/graphql.service.js +0 -186
  134. package/dist/src/utils/spacelift/lib/graphql.service.js.map +0 -1
  135. package/dist/src/utils/spacelift/lib/query/spacelift.queries.d.ts +0 -34
  136. package/dist/src/utils/spacelift/lib/query/spacelift.queries.js +0 -48
  137. package/dist/src/utils/spacelift/lib/query/spacelift.queries.js.map +0 -1
  138. package/dist/src/utils/spacelift/lib/spacelift.error.d.ts +0 -43
  139. package/dist/src/utils/spacelift/lib/spacelift.error.js +0 -63
  140. package/dist/src/utils/spacelift/lib/spacelift.error.js.map +0 -1
  141. package/dist/src/utils/spacelift/lib/spacelift.service.d.ts +0 -16
  142. package/dist/src/utils/spacelift/lib/spacelift.service.js +0 -58
  143. package/dist/src/utils/spacelift/lib/spacelift.service.js.map +0 -1
  144. package/dist/src/utils/spacelift/lib/utils.d.ts +0 -4
  145. package/dist/src/utils/spacelift/lib/utils.js +0 -32
  146. package/dist/src/utils/spacelift/lib/utils.js.map +0 -1
  147. package/generators.json +0 -9
  148. /package/dist/src/utils/{common/import-esm.d.ts → import-esm.d.ts} +0 -0
  149. /package/dist/src/utils/{common/import-esm.js → import-esm.js} +0 -0
package/README.md CHANGED
@@ -1,173 +1,20 @@
1
- # @payfit/nx-core
1
+ # nx-core package
2
2
 
3
- A Nx plugin that simplifies Docker image and Helm chart packaging and releases using Nx's versionActions feature.
4
-
5
- ## Features
6
-
7
- - Automated Docker image building and publishing
8
- - Helm chart packaging and versioning
9
- - AWS Lambda function packaging and deployment
10
- - Transparent version management through Nx's versionActions
11
- - Seamless integration with your Nx workspace
12
- - Auto setup using init generator to update your repository at plugin installation
13
-
14
- ## Prerequisites
15
-
16
- - yarn v4
17
- - Nx up-to-date https://github.com/nrwl/nx/releases
18
-
19
- ## Installation
20
-
21
- ```shell
22
- npx nx add @payfit/nx-core
23
- ```
24
-
25
- This command will:
26
-
27
- - Install the package as a dev dependency
28
- - Run the [init generator](./src/generators/init) to set up the necessary configuration
29
- - Update your workspace configuration automatically
30
-
31
- ### Init generator
32
-
33
- Using the above command will setup your repo with the default recommended configuration. You are free to edit this configuration to your needs.
34
-
35
- It will also generate the CircleCI config file & Teleport file needed.
36
-
37
- The plugin uses Nx's versionActions to handle versioning transparently. [We only override the semver calculation to switch it to calver (which you can opt out)](./src/scripts/version-actions.ts).
3
+ This library was generated with [Nx](https://nx.dev).
38
4
 
39
5
  ## Usage
40
6
 
41
- ### Docker Image Release
42
-
43
- The plugin automatically handles:
44
-
45
- - Building Docker images
46
- - Tagging with appropriate versions
47
- - Publishing to your container registry
48
-
49
- ### Helm Chart Release
50
-
51
- The plugin manages:
52
-
53
- - Chart version updates
54
- - Chart packaging
55
- - Chart publishing
56
- - Automatic image tag patching in values.yaml files
57
-
58
- #### Image Tag Patching Behavior
59
-
60
- When releasing a new version, the plugin automatically updates Docker image tags in your Helm chart's `values.yaml` file. The patching behavior handles three scenarios:
61
-
62
- 1. **Dependencies Only**: If your `values.yaml` contains service entries that match the dependencies in your `Chart.yaml`, the plugin will update the image tags for these services.
63
-
64
- 2. **Global Tag Only**: If your `values.yaml` contains a global image tag (at `image.tag`), the plugin will update this tag with the new version.
65
-
66
- 3. **Both Dependencies and Global Tag**: If both dependency-specific tags and a global tag are present, the plugin will update all of them to maintain consistency.
67
-
68
- This ensures that all relevant image tags are updated to the new version during the release process, regardless of your Helm chart's structure.
69
-
70
- ### Lambda Function Release
71
-
72
- The plugin automates the process of packaging and deploying AWS Lambda functions:
7
+ Install the package as dev dependency of your project:
73
8
 
74
- - Creating a zip archive from your Lambda function code
75
- - Uploading the archive to an S3 bucket
76
- - Creating an empty OCI artifact and pushing it to ECR for versioning
77
-
78
- #### Lambda Configuration Parameters
79
-
80
- When using Lambda functions, you can configure the following parameters in your project's `project.json` file:
81
-
82
- ```json
83
- {
84
- "metadata": {
85
- "lambdaFunctions": ["your-lambda-registry"],
86
- "lambdaStacks": ["your-lambda-stack"],
87
- "lambdaBucket": "your-lambda-bucket",
88
- "lambdaHealthCheckPayload": "your-lambda-payload-json-string-formatted"
89
- }
90
- }
91
- ```
92
-
93
- These fields are used to:
94
-
95
- - `lambdaFunctions`: Lambda functions to deploy
96
- - `lambdaStacks`: Spacelift stacks deploying lambdas
97
- - `lambdaBucket`: the S3 bucket where Lambda function zip archives are stored
98
- - `lambdaHealthCheckPayload`: Payload used for smoke tests invocation
99
-
100
- If `lambdaBucket` is not specified, the plugin will fall back to the default bucket: `payfit-shared-lambda-artifacts`.
101
-
102
- #### Lambda Detection
103
-
104
- The plugin automatically detects Lambda functions by looking for a `lambdaFunctions` metadata in your project root. When this metadata is present, the plugin will configure the necessary targets for packaging and deploying your Lambda function.
105
-
106
- ## Configuration
107
-
108
- You'll need to add the following metadata to your project's `project.json` file:
109
-
110
- ```json
111
- {
112
- "metadata": {
113
- "ecrRegistry": "your-app-name",
114
- "chartRegistry": "your-chart-registry",
115
- "ociEcrRegistry": "your-app-name",
116
- "helmChartFolder": "your-helm-folder",
117
- "lambdaFunctions": ["your-lambda-registry"],
118
- "lambdaStacks": ["your-lambda-stack"],
119
- "lambdaBucket": "your-lambda-bucket",
120
- "lambdaHealthCheckPayload": "your-lambda-payload-json-string-formatted"
121
- }
122
- }
9
+ ```shell
10
+ yarn add -D @payfit/nx-core
123
11
  ```
124
12
 
125
- These fields are used to:
13
+ ## Building
126
14
 
127
- - `ecrRegistry`: the ECR repository name for Docker images
128
- - `chartRegistry`: the Helm chart registry
129
- - `ociEcrRegistry`: the OCI registry for container images
130
- - `helmChartFolder`: the folder containing Helm chart files (Chart.yaml, values.yaml, etc.), defaults to `.deploy`
131
- - `lambdaStacks`: the spacelift stacks containing lambda to deploy
132
- - `lambdaFunctions`: the lambda functions to deploy
133
- - `lambdaBucket`: the S3 bucket where Lambda function zip archives are stored (defaults to `payfit-shared-lambda-artifacts`)
134
- - `lambdaHealthCheckPayload`: Payload used for smoke tests invocation before lambda being released
15
+ Run `nx build nx-core` to build the library.
16
+ The build artifacts will be stored in the `dist/packages/nx-core` directory.
135
17
 
136
- ## Automatic Release Target Inference
137
-
138
- The plugin automatically infers release targets for your projects based on the presence of deployment files:
139
-
140
- 1. **Docker Image Release**: If a `Dockerfile` exists in your project root, the plugin will automatically:
141
- - Configure Docker image building and publishing
142
- - Set up version management for the image
143
- - Handle ECR repository integration
144
-
145
- 2. **Helm Chart Release**: If a `Chart.yaml` exists in your Helm chart folder (defaults to `.deploy/Chart.yaml`), the plugin will automatically:
146
- - Configure Helm chart packaging and versioning
147
- - Set up chart publishing to your registry
148
- - Handle chart dependencies and updates
149
-
150
- 3. **Lambda Function Release**: If a `.lambda` file exists in your project root, the plugin will automatically:
151
- - Configure Lambda function packaging (zip archive creation)
152
- - Set up S3 bucket uploading for the Lambda artifact
153
- - Create and push an empty OCI artifact to ECR for versioning
154
-
155
- The inference of the `nx-release-publish` target is handled through Nx's plugin system, which automatically adds the necessary targets and version actions to your project configuration. You don't need to manually configure these targets.
156
-
157
- ---
158
-
159
- # Debug locally
160
-
161
- 1. Build everything:
162
-
163
- ```bash
164
- npx nx run-many -t build
165
- ```
166
-
167
- 2. Trigger a new release using the local plugin version:
168
-
169
- ```bash
170
- npx nx run @payfit/nx-common-packages:release --dry-run
171
- ```
18
+ ## Running unit tests
172
19
 
173
- Make sure you pushed a change to your branch to actually trigger a release, otherwise it will say something like `No project to publish`
20
+ Run `nx test nx-core` to execute the unit tests via [Vitest](https://vitest.dev/).
@@ -1,3 +1,5 @@
1
1
  import { ExecutorContext } from '@nx/devkit';
2
2
  import { PublisherExecutorOptions } from './schema';
3
- export declare function publishDocker(options: PublisherExecutorOptions, context: ExecutorContext, version: string, projectRoot: string, isDryRun: boolean): Promise<void>;
3
+ export declare function publishDocker(options: PublisherExecutorOptions, context: ExecutorContext, version: string): Promise<{
4
+ success: boolean;
5
+ }>;
@@ -2,65 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.publishDocker = publishDocker;
4
4
  const fs = require("node:fs");
5
- const aws_auth_1 = require("../../utils/common/aws-auth");
6
- const github_1 = require("../../utils/common/github");
7
- const logger_1 = require("../../utils/common/logger");
8
- const datadog_1 = require("../../utils/datadog");
5
+ const path_1 = require("path");
6
+ const aws_auth_1 = require("../../utils/aws-auth");
9
7
  const docker_1 = require("../../utils/docker");
10
- async function publishDocker(options, context, version, projectRoot, isDryRun) {
11
- const projectDockerfile = `${projectRoot}/Dockerfile`;
12
- if (!fs.existsSync(projectDockerfile)) {
13
- logger_1.consola.warn(`Dockerfile not found at ${projectDockerfile}, skipping`);
14
- return;
15
- }
16
- if (!options.ecrRegistry) {
17
- logger_1.consola.error('Dockerfile detected but No ECR registry provided, add "ecrRegistry" to your project.json metadata');
18
- return;
19
- }
20
- const registry = {
21
- url: options.isPublicRegistry
22
- ? 'public.ecr.aws/payfit'
23
- : process.env.AWS_ECR_REGISTRY,
24
- name: options.isPublicRegistry
25
- ? 'public.ecr.aws'
26
- : process.env.AWS_ECR_REGISTRY,
27
- };
28
- if (isDryRun) {
29
- logger_1.consola.box(`Would have published docker image located at ${projectDockerfile} to registry ${options.ecrRegistry} with version ${version} but --dry-run is enabled`);
30
- return;
31
- }
8
+ async function publishDocker(options, context, version) {
32
9
  await (0, aws_auth_1.checkAwsAuth)();
33
- await (0, aws_auth_1.loginToEcr)(registry.name, options.isPublicRegistry);
34
- // Verify that we have valid ECR credentials before proceeding
35
- const hasValidCredentials = await (0, aws_auth_1.verifyEcrCredentials)(registry.name);
36
- if (!hasValidCredentials) {
37
- logger_1.consola.warn('ECR credentials verification failed. Attempting to login again...');
38
- // Try logging in again
39
- await (0, aws_auth_1.loginToEcr)(registry.name, options.isPublicRegistry);
40
- // Verify credentials again
41
- const retryCredentials = await (0, aws_auth_1.verifyEcrCredentials)(registry.name);
42
- if (!retryCredentials) {
43
- throw new Error('No valid ECR credentials available for pushing Docker image');
44
- }
45
- }
46
- logger_1.consola.box(`Publishing docker image to ${registry.url}/${options.ecrRegistry} with version ${version}`);
47
- const extraTags = !version.includes('ephemeral') && options.extraReleaseTags
48
- ? options.extraReleaseTags
49
- : [];
50
- const sanitizedRepoUrl = await (0, github_1.getSanitizedCurrentGitRepoUrl)();
51
- const commitSha = await (0, github_1.getCurrentGitCommitSha)();
52
- const appName = context.projectName || 'unknown-app';
53
- try {
54
- logger_1.consola.start('Building and pushing docker image');
55
- await (0, docker_1.buildAndPushDockerImage)(options.ecrRegistry, projectDockerfile, version, sanitizedRepoUrl, commitSha, registry.url, extraTags, appName);
56
- logger_1.consola.success('Docker image built and pushed successfully!');
57
- if (!version.includes('ephemeral')) {
58
- await (0, datadog_1.correlateDeploymentImage)(`${registry.url}/${options.ecrRegistry}:${version}`, sanitizedRepoUrl, commitSha);
59
- }
60
- }
61
- catch (error) {
62
- logger_1.consola.error('Failed to build and push Docker image:', error);
63
- throw error;
10
+ await (0, aws_auth_1.loginToEcr)();
11
+ const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
12
+ const projectDockerfile = (0, path_1.join)(projectRoot, 'Dockerfile');
13
+ if (!fs.existsSync(projectDockerfile)) {
14
+ throw new Error('Dockerfile not found in project root');
64
15
  }
16
+ console.log('Building docker image with version ' + version);
17
+ await (0, docker_1.buildDockerImage)(options.ecrRegistry, projectDockerfile, version);
18
+ console.log(`Publishing docker image to ${options.ecrRegistry} with version ${version}`);
19
+ return await (0, aws_auth_1.pushImageToEcr)(options.ecrRegistry, version);
65
20
  }
66
21
  //# sourceMappingURL=docker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"docker.js","sourceRoot":"","sources":["../../../../src/executors/publisher/docker.ts"],"names":[],"mappings":";;AAuBA,sCA+FC;AAtHD,8BAA6B;AAI7B,0DAIoC;AACpC,sDAGkC;AAClC,sDAAmD;AACnD,iDAA8D;AAC9D,+CAA4D;AAQrD,KAAK,UAAU,aAAa,CACjC,OAAiC,EACjC,OAAwB,EACxB,OAAe,EACf,WAAmB,EACnB,QAAiB;IAEjB,MAAM,iBAAiB,GAAG,GAAG,WAAW,aAAa,CAAA;IAErD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACtC,gBAAO,CAAC,IAAI,CAAC,2BAA2B,iBAAiB,YAAY,CAAC,CAAA;QACtE,OAAM;IACR,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACzB,gBAAO,CAAC,KAAK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A;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,EAAC,OAAO,CAAC,WAAW,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAA;IAEvE,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"}
@@ -1,17 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const nx_1 = require("../../utils/common/nx");
3
+ const get_version_1 = require("../../utils/get-version");
4
4
  const docker_1 = require("./docker");
5
5
  const helm_1 = require("./helm");
6
- const lambda_1 = require("./lambda");
7
6
  const runExecutor = async (options, context) => {
8
- const isDryRun = process.env.NX_DRY_RUN === 'true' || options.dryRun || false;
9
- const projectRoot = context.projectGraph.nodes[context.projectName].data.root;
10
- const projectDist = await (0, nx_1.getDistForApp)(context);
11
- const version = (0, nx_1.getVersion)(context);
12
- await (0, docker_1.publishDocker)(options, context, version, projectRoot, isDryRun);
13
- await (0, helm_1.publishHelm)(options, context, version, projectRoot, projectDist, isDryRun);
14
- await (0, lambda_1.publishLambda)(options, context, version, projectRoot, projectDist, isDryRun);
7
+ try {
8
+ const version = (0, get_version_1.getVersion)(context.projectName);
9
+ await (0, docker_1.publishDocker)(options, context, version);
10
+ await (0, helm_1.publishHelm)(options, context, version);
11
+ }
12
+ catch (error) {
13
+ console.error(error);
14
+ return {
15
+ success: false,
16
+ };
17
+ }
15
18
  return {
16
19
  success: true,
17
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../src/executors/publisher/executor.ts"],"names":[],"mappings":";;AAEA,8CAAiE;AACjE,qCAAwC;AACxC,iCAAoC;AACpC,qCAAwC;AAGxC,MAAM,WAAW,GAGuB,KAAK,EAC3C,OAAiC,EACjC,OAAwB,EACxB,EAAE;IACF,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,MAAM,IAAI,OAAO,CAAC,MAAM,IAAI,KAAK,CAAA;IAC7E,MAAM,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;IAC7E,MAAM,WAAW,GAAG,MAAM,IAAA,kBAAa,EAAC,OAAO,CAAC,CAAA;IAChD,MAAM,OAAO,GAAG,IAAA,eAAU,EAAC,OAAO,CAAC,CAAA;IAEnC,MAAM,IAAA,sBAAa,EAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAA;IACrE,MAAM,IAAA,kBAAW,EACf,OAAO,EACP,OAAO,EACP,OAAO,EACP,WAAW,EACX,WAAW,EACX,QAAQ,CACT,CAAA;IACD,MAAM,IAAA,sBAAa,EACjB,OAAO,EACP,OAAO,EACP,OAAO,EACP,WAAW,EACX,WAAW,EACX,QAAQ,CACT,CAAA;IAED,OAAO;QACL,OAAO,EAAE,IAAI;KACd,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../src/executors/publisher/executor.ts"],"names":[],"mappings":";;AAEA,yDAAoD;AACpD,qCAAwC;AACxC,iCAAoC;AAGpC,MAAM,WAAW,GAGuB,KAAK,EAC3C,OAAiC,EACjC,OAAwB,EACxB,EAAE;IACF,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAA,wBAAU,EAAC,OAAO,CAAC,WAAW,CAAC,CAAA;QAC/C,MAAM,IAAA,sBAAa,EAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;QAC9C,MAAM,IAAA,kBAAW,EAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO;YACL,OAAO,EAAE,KAAK;SACf,CAAA;IACH,CAAC;IACD,OAAO;QACL,OAAO,EAAE,IAAI;KACd,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -1,3 +1,7 @@
1
1
  import { ExecutorContext } from '@nx/devkit';
2
2
  import { PublisherExecutorOptions } from './schema';
3
- export declare function publishHelm(options: PublisherExecutorOptions, context: ExecutorContext, version: string, projectRoot: string, projectDist: string, isDryRun: boolean): Promise<void>;
3
+ export declare function publishHelm(options: PublisherExecutorOptions, context: ExecutorContext, version: string): Promise<{
4
+ success: boolean;
5
+ stdout: any;
6
+ stderr: any;
7
+ }>;
@@ -3,60 +3,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.publishHelm = publishHelm;
4
4
  const tslib_1 = require("tslib");
5
5
  const fs = require("node:fs");
6
- const aws_auth_1 = require("../../utils/common/aws-auth");
7
- const github_1 = require("../../utils/common/github");
8
- const logger_1 = require("../../utils/common/logger");
9
- const tsh_1 = require("../../utils/common/tsh");
6
+ const aws_auth_1 = require("../../utils/aws-auth");
7
+ const github_1 = require("../../utils/github");
10
8
  const helm_1 = require("../../utils/helm");
11
- async function publishHelm(options, context, version, projectRoot, projectDist, isDryRun) {
9
+ const tsh_1 = require("../../utils/tsh");
10
+ async function publishHelm(options, context, version) {
12
11
  const env_1 = { stack: [], error: void 0, hasError: false };
13
12
  try {
14
- const helmChartFolder = options.helmChartFolder || '.deploy';
15
- const projectHelmFolder = `${projectRoot}/${helmChartFolder}`;
16
- const valuesConfigPath = `${projectHelmFolder}/values.yaml`;
17
- const chartConfigPath = `${projectHelmFolder}/Chart.yaml`;
18
- const destinationHelmFolder = `${projectDist}/chart/`;
13
+ const projectHelmFolder = `apps/${context.projectName}/.deploy`;
14
+ const destinationHelmFolder = `dist/apps/${context.projectName}/chart/`;
19
15
  const gitBranchName = await (0, github_1.getSanitizedCurrentGitBranch)();
20
16
  if (!gitBranchName)
21
17
  throw new Error('Unable to get current Git branch');
22
- if (!fs.existsSync(chartConfigPath)) {
23
- logger_1.consola.warn(`No helm chart found in project ${context.projectName}, searching ${chartConfigPath}, skipping`);
24
- return;
25
- }
26
- if (!options.chartRegistry) {
27
- logger_1.consola.error('Helm chart detected but no chart registry provided, add "chartRegistry" to your project.json metadata');
28
- return;
29
- }
30
- if (isDryRun) {
31
- logger_1.consola.box(`Would have published Helm chart located at ${projectHelmFolder} to ${options.ociEcrRegistry ? options.ociEcrRegistry : options.chartRegistry}/${gitBranchName} with version ${version} but --dry-run is enabled`);
32
- return;
33
- }
34
18
  await (0, aws_auth_1.checkAwsAuth)();
35
- logger_1.consola.box(`Publishing Helm chart to ${options.chartRegistry}/${gitBranchName} with version ${version}`);
19
+ if (!fs.existsSync(projectHelmFolder)) {
20
+ throw new Error(`.deploy folder not found for project ${context.projectName}`);
21
+ }
22
+ console.log(`Publishing Helm chart to ${options.chartRegistry}/${gitBranchName} with version ${version}`);
36
23
  // connect to the chartmuseum through teleport
37
24
  const proxyData = tslib_1.__addDisposableResource(env_1, await (0, tsh_1.getLocalPortForChartMuseum)(), false);
38
25
  await proxyData.isReady();
39
- logger_1.consola.start('Building Helm chart');
40
26
  await (0, helm_1.setupTeleportProxyHelmChartFile)(projectHelmFolder, proxyData.port);
41
27
  await (0, helm_1.installHelmRepo)(projectHelmFolder);
42
- await (0, helm_1.patchImageTag)(valuesConfigPath, chartConfigPath, version);
43
28
  await (0, helm_1.packageHelm)(projectHelmFolder, version, destinationHelmFolder);
44
29
  await (0, helm_1.resetTeleportProxyHelmChartFile)(projectHelmFolder, proxyData.port);
45
- logger_1.consola.success('Helm chart packaged!');
46
- const chartConfig = await (0, helm_1.getHelmChartFile)(projectHelmFolder);
47
- const packagedHelmChartName = `${chartConfig.name}-${version}.tgz`;
48
- const packagedHelmChartPath = `${destinationHelmFolder}${packagedHelmChartName}`;
49
- logger_1.consola.start('Publishing Helm chart');
50
- // If ociEcrRegistry is provided, push to ECR using OCI format
51
- if (options.ociEcrRegistry) {
52
- logger_1.consola.log(`Publishing Helm chart to OCI registry ${options.ociEcrRegistry}`);
53
- await (0, helm_1.pushOciPackagedHelm)(packagedHelmChartPath, options.ociEcrRegistry);
54
- }
55
- else {
56
- // Otherwise, push to the chartmuseum as before
57
- await (0, helm_1.pushPackagedHelm)(packagedHelmChartPath, packagedHelmChartName, options.chartRegistry, gitBranchName);
58
- }
59
- logger_1.consola.success('Helm chart published successfully!');
30
+ return (0, helm_1.pushPackagedHelm)(`${destinationHelmFolder}${context.projectName}-${version}.tgz`, options.chartRegistry, gitBranchName);
60
31
  }
61
32
  catch (e_1) {
62
33
  env_1.error = e_1;
@@ -1 +1 @@
1
- {"version":3,"file":"helm.js","sourceRoot":"","sources":["../../../../src/executors/publisher/helm.ts"],"names":[],"mappings":";;AAoBA,kCA6EC;;AAjGD,8BAA6B;AAI7B,0DAA0D;AAC1D,sDAAwE;AACxE,sDAAmD;AACnD,gDAAmE;AACnE,2CASyB;AAGlB,KAAK,UAAU,WAAW,CAC/B,OAAiC,EACjC,OAAwB,EACxB,OAAe,EACf,WAAmB,EACnB,WAAmB,EACnB,QAAiB;;;QAEjB,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,SAAS,CAAA;QAC5D,MAAM,iBAAiB,G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
+ export interface PublisherExecutorOptions {
3
+ chartRegistry: string
4
+ ecrRegistry: string
5
+ }
@@ -12,50 +12,6 @@
12
12
  "ecrRegistry": {
13
13
  "type": "string",
14
14
  "description": "The docker registry"
15
- },
16
- "ociEcrRegistry": {
17
- "type": "string",
18
- "description": "The docker registry in oci format (AWS ECR)"
19
- },
20
- "isPublicRegistry": {
21
- "type": "boolean",
22
- "description": "Whether to use the public ECR registry",
23
- "default": false
24
- },
25
- "helmChartFolder": {
26
- "type": "string",
27
- "description": "The folder containing the Helm chart files (Chart.yaml, values.yaml, etc.)",
28
- "default": ".deploy"
29
- },
30
- "extraReleaseTags": {
31
- "type": "array",
32
- "items": {
33
- "type": "string"
34
- },
35
- "description": "Additional tags to add to the Docker image during a release",
36
- "default": []
37
- },
38
- "dryRun": {
39
- "type": "boolean",
40
- "description": "Whether to run in dry run mode. When true, shows what would be published without actually publishing.",
41
- "default": false
42
- },
43
- "lambdaBucket": {
44
- "type": "string",
45
- "description": "The S3 bucket for lambda",
46
- "default": "payfit-shared-lambda-artifacts"
47
- },
48
- "lambdaStacks": {
49
- "type": "array",
50
- "description": "The list of stacks to publish the lambda to"
51
- },
52
- "lambdaFunctions": {
53
- "type": "array",
54
- "description": "The list of lambda functions inside the workload"
55
- },
56
- "lambdaHealthCheckPayload": {
57
- "type": "string",
58
- "description": "Health check payload for the lambda functions. Must be in JSON string format"
59
15
  }
60
16
  },
61
17
  "required": []
@@ -1,27 +1,4 @@
1
- import { CreateNodesContextV2, CreateNodesV2 } from '@nx/devkit';
1
+ import { CreateNodesV2 } from '@nx/devkit';
2
2
  export interface MyPluginOptions {
3
3
  }
4
4
  export declare const createNodesV2: CreateNodesV2<MyPluginOptions>;
5
- export declare function createNodesInternal(configFilePath: string, options: MyPluginOptions, context: CreateNodesContextV2): Promise<{
6
- projects: {
7
- [x: string]: {
8
- targets: {};
9
- release: any;
10
- name?: string;
11
- root: string;
12
- sourceRoot?: string;
13
- projectType?: import("@nx/devkit").ProjectType;
14
- generators?: {
15
- [collectionName: string]: {
16
- [generatorName: string]: any;
17
- };
18
- };
19
- implicitDependencies?: string[];
20
- namedInputs?: {
21
- [inputName: string]: (string | import("nx/src/config/workspace-json-project-json").InputDefinition)[];
22
- };
23
- tags?: string[];
24
- metadata?: import("nx/src/config/workspace-json-project-json").ProjectMetadata;
25
- };
26
- };
27
- }>;
package/dist/src/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createNodesV2 = void 0;
4
- exports.createNodesInternal = createNodesInternal;
5
4
  const fs_1 = require("fs");
6
5
  const path_1 = require("path");
7
6
  const devkit_1 = require("@nx/devkit");
@@ -15,93 +14,38 @@ async function createNodesInternal(configFilePath, options, context) {
15
14
  const projectConfiguration = (0, devkit_1.readJsonFile)(configFilePath);
16
15
  const projectRoot = (0, path_1.dirname)(configFilePath);
17
16
  const isDockerProject = (0, fs_1.existsSync)((0, path_1.join)(projectRoot, 'Dockerfile'));
18
- // Get the Helm chart folder from metadata, default to .deploy
19
- const helmChartFolder = projectConfiguration?.metadata?.['helmChartFolder'] || '.deploy';
20
- const isHelmProject = (0, fs_1.existsSync)((0, path_1.join)(projectRoot, helmChartFolder, 'Chart.yaml'));
21
- const isLambdaProject = !!(projectConfiguration.metadata &&
22
- projectConfiguration.metadata['lambdaFunctions']);
17
+ const isHelmProject = (0, fs_1.existsSync)((0, path_1.join)(projectRoot, '.deploy/Chart.yaml'));
23
18
  const targets = {};
24
19
  const ecrRegistry = isDockerProject
25
20
  ? projectConfiguration.metadata &&
26
- projectConfiguration.metadata['ecrRegistry']
21
+ projectConfiguration.metadata['ecrRepository']
27
22
  : undefined;
28
23
  const chartRegistry = isHelmProject
29
24
  ? projectConfiguration.metadata &&
30
25
  projectConfiguration.metadata['chartRegistry']
31
26
  : undefined;
32
- const isPublicRegistry = isDockerProject
33
- ? projectConfiguration.metadata &&
34
- projectConfiguration.metadata['isPublicRegistry'] == true
35
- : false;
36
- const extraReleaseTags = isDockerProject
37
- ? projectConfiguration.metadata &&
38
- projectConfiguration.metadata['extraReleaseTags']
39
- : undefined;
40
- const lambdaBucket = isLambdaProject
41
- ? projectConfiguration.metadata &&
42
- projectConfiguration.metadata['lambdaBucket']
43
- : undefined;
44
- const lambdaStacks = isLambdaProject
45
- ? projectConfiguration.metadata &&
46
- projectConfiguration.metadata['lambdaStacks']
47
- : undefined;
48
- const lambdaFunctions = isLambdaProject
49
- ? projectConfiguration.metadata &&
50
- projectConfiguration.metadata['lambdaFunctions']
51
- : undefined;
52
- const lambdaHealthCheckPayload = isLambdaProject
53
- ? projectConfiguration.metadata &&
54
- projectConfiguration.metadata['lambdaHealthCheckPayload']
55
- : undefined;
56
- const isRootProject = projectRoot === '.';
57
27
  let release = null;
58
- if (isHelmProject || isDockerProject || isLambdaProject) {
28
+ if (isHelmProject || isDockerProject) {
59
29
  const publisherConfig = (0, devkit_1.readJsonFile)((0, path_1.join)(__dirname, '/executors/publisher/schema.json'));
60
30
  targets['nx-release-publish'] = {
61
31
  // infer the custom publisher target to handle publishing docker & helm artefacts
62
32
  executor: '@payfit/nx-core:publisher',
63
- cache: false,
64
33
  options: {
65
34
  ecrRegistry,
66
35
  chartRegistry,
67
- isPublicRegistry,
68
- helmChartFolder,
69
- extraReleaseTags,
70
- lambdaBucket,
71
- lambdaStacks,
72
- lambdaFunctions,
73
- lambdaHealthCheckPayload,
74
36
  },
37
+ cache: true,
38
+ inputs: ['production', '^production'],
39
+ outputs: [`{workspaceRoot}/dist/apps/${projectConfiguration.name}/chart`],
75
40
  metadata: {
76
- technologies: ['helm', 'docker', 'lambda'],
41
+ technologies: ['helm', 'docker'],
77
42
  description: publisherConfig.description,
78
43
  },
79
44
  };
80
- if (!projectConfiguration?.release?.version
81
- ?.versionActions) {
82
- release = {
83
- // infer the version actions to handle the custom versioning
84
- version: {
85
- versionActions: '@payfit/nx-core/versionActions',
86
- },
87
- };
88
- }
89
- }
90
- if (isRootProject) {
91
- const previewDeployConfig = (0, devkit_1.readJsonFile)((0, path_1.join)(__dirname, '/executors/preview-deploy/schema.json'));
92
- targets['preview-deploy'] = {
93
- executor: '@payfit/nx-core:preview-deploy',
94
- cache: false,
95
- metadata: {
96
- description: previewDeployConfig.description,
97
- },
98
- };
99
- const releaseConfig = (0, devkit_1.readJsonFile)((0, path_1.join)(__dirname, '/executors/release/schema.json'));
100
- targets['release'] = {
101
- executor: '@payfit/nx-core:release',
102
- cache: false,
103
- metadata: {
104
- description: releaseConfig.description,
45
+ release = {
46
+ // infer the version actions to handle the custom versioning
47
+ version: {
48
+ versionActions: '@payfit/nx-core/versionActions',
105
49
  },
106
50
  };
107
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AA4BA,kDAgIC;AA5JD,2BAA+B;AAC/B,+BAAoC;AAEpC,uCAMmB;AAMN,QAAA,aAAa,GAAmC;IAC3D,iBAAiB;IACjB,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACtC,OAAO,MAAM,IAAA,6BAAoB,EAC/B,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAC/B,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,EACnD,WAAW,EACX,OAAO,EACP,OAAO,CACR,CAAA;IACH,CAAC;CACF,CAAA;AAEM,KAAK,UAAU,mBAAmB,CACvC,cAAsB,EACtB,OAAwB,EACxB,OAA6B;IAE7B,MAAM,oBAAoB,GACxB,IAAA,qBAAY,EAAC,cAAc,CAAC,CAAA;IAC9B,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,cAAc,CAAC,CAAA;IAE3C,MAAM,eAAe,GAAG,IAAA,eAAU,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAA;IACnE,8DAA8D;IAC9D,MAAM,eAAe,GACnB,oBAAoB,EAAE,QAAQ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