@payfit/nx-core 4.42.3 → 4.42.4-ephemeral-bundle-nx-core-7fdfd20.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/README.md +201 -0
- package/dist/_virtual/rolldown_runtime.js +39 -0
- package/dist/executors/publisher/docker.js +54 -0
- package/{src → dist}/executors/publisher/executor.d.ts +6 -3
- package/dist/executors/publisher/executor.js +20 -0
- package/dist/executors/publisher/helm.js +62 -0
- package/dist/executors/publisher/lambda.js +55 -0
- package/dist/executors/publisher/schema.d.ts +17 -0
- package/{src → dist}/executors/publisher/schema.json +17 -0
- package/dist/executors/release/executor.d.ts +7 -0
- package/dist/executors/release/executor.js +77 -0
- package/dist/executors/release/schema.d.ts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +62 -0
- package/dist/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js +68 -0
- package/dist/node_modules/@wry/caches/lib/bundle.js +201 -0
- package/dist/node_modules/@wry/context/lib/bundle.js +158 -0
- package/dist/node_modules/@wry/equality/lib/bundle.js +114 -0
- package/dist/node_modules/@wry/trie/lib/bundle.js +84 -0
- package/dist/node_modules/cross-fetch/dist/node-ponyfill.js +27 -0
- package/dist/node_modules/encoding/lib/encoding.js +63 -0
- package/dist/node_modules/graphql/error/GraphQLError.js +162 -0
- package/dist/node_modules/graphql/error/index.js +50 -0
- package/dist/node_modules/graphql/error/locatedError.js +39 -0
- package/dist/node_modules/graphql/error/syntaxError.js +27 -0
- package/dist/node_modules/graphql/execution/collectFields.js +110 -0
- package/dist/node_modules/graphql/execution/execute.js +477 -0
- package/dist/node_modules/graphql/execution/index.js +82 -0
- package/dist/node_modules/graphql/execution/mapAsyncIterator.js +55 -0
- package/dist/node_modules/graphql/execution/subscribe.js +148 -0
- package/dist/node_modules/graphql/execution/values.js +155 -0
- package/dist/node_modules/graphql/graphql.js +66 -0
- package/dist/node_modules/graphql/index.js +1296 -0
- package/dist/node_modules/graphql/jsutils/Path.js +38 -0
- package/dist/node_modules/graphql/jsutils/devAssert.js +19 -0
- package/dist/node_modules/graphql/jsutils/didYouMean.js +33 -0
- package/dist/node_modules/graphql/jsutils/groupBy.js +28 -0
- package/dist/node_modules/graphql/jsutils/identityFunc.js +21 -0
- package/dist/node_modules/graphql/jsutils/inspect.js +70 -0
- package/dist/node_modules/graphql/jsutils/instanceOf.js +52 -0
- package/dist/node_modules/graphql/jsutils/invariant.js +19 -0
- package/dist/node_modules/graphql/jsutils/isAsyncIterable.js +22 -0
- package/dist/node_modules/graphql/jsutils/isIterableObject.js +35 -0
- package/dist/node_modules/graphql/jsutils/isObjectLike.js +22 -0
- package/dist/node_modules/graphql/jsutils/isPromise.js +22 -0
- package/dist/node_modules/graphql/jsutils/keyMap.js +47 -0
- package/dist/node_modules/graphql/jsutils/keyValMap.js +37 -0
- package/dist/node_modules/graphql/jsutils/mapValue.js +24 -0
- package/dist/node_modules/graphql/jsutils/memoize3.js +40 -0
- package/dist/node_modules/graphql/jsutils/naturalCompare.js +57 -0
- package/dist/node_modules/graphql/jsutils/printPathArray.js +21 -0
- package/dist/node_modules/graphql/jsutils/promiseForObject.js +29 -0
- package/dist/node_modules/graphql/jsutils/promiseReduce.js +29 -0
- package/dist/node_modules/graphql/jsutils/suggestionList.js +101 -0
- package/dist/node_modules/graphql/jsutils/toError.js +30 -0
- package/dist/node_modules/graphql/jsutils/toObjMap.js +22 -0
- package/dist/node_modules/graphql/language/ast.js +280 -0
- package/dist/node_modules/graphql/language/blockString.js +114 -0
- package/dist/node_modules/graphql/language/characterClasses.js +76 -0
- package/dist/node_modules/graphql/language/directiveLocation.js +46 -0
- package/dist/node_modules/graphql/language/index.js +224 -0
- package/dist/node_modules/graphql/language/kinds.js +70 -0
- package/dist/node_modules/graphql/language/lexer.js +523 -0
- package/dist/node_modules/graphql/language/location.js +39 -0
- package/dist/node_modules/graphql/language/parser.js +1162 -0
- package/dist/node_modules/graphql/language/predicates.js +56 -0
- package/dist/node_modules/graphql/language/printLocation.js +62 -0
- package/dist/node_modules/graphql/language/printString.js +188 -0
- package/dist/node_modules/graphql/language/printer.js +198 -0
- package/dist/node_modules/graphql/language/source.js +54 -0
- package/dist/node_modules/graphql/language/tokenKind.js +50 -0
- package/dist/node_modules/graphql/language/visitor.js +267 -0
- package/dist/node_modules/graphql/type/assertName.js +42 -0
- package/dist/node_modules/graphql/type/definition.js +894 -0
- package/dist/node_modules/graphql/type/directives.js +191 -0
- package/dist/node_modules/graphql/type/index.js +562 -0
- package/dist/node_modules/graphql/type/introspection.js +485 -0
- package/dist/node_modules/graphql/type/scalars.js +167 -0
- package/dist/node_modules/graphql/type/schema.js +263 -0
- package/dist/node_modules/graphql/type/validate.js +310 -0
- package/dist/node_modules/graphql/utilities/TypeInfo.js +243 -0
- package/dist/node_modules/graphql/utilities/assertValidName.js +46 -0
- package/dist/node_modules/graphql/utilities/astFromValue.js +134 -0
- package/dist/node_modules/graphql/utilities/buildASTSchema.js +83 -0
- package/dist/node_modules/graphql/utilities/buildClientSchema.js +230 -0
- package/dist/node_modules/graphql/utilities/coerceInputValue.js +109 -0
- package/dist/node_modules/graphql/utilities/concatAST.js +30 -0
- package/dist/node_modules/graphql/utilities/extendSchema.js +441 -0
- package/dist/node_modules/graphql/utilities/findBreakingChanges.js +285 -0
- package/dist/node_modules/graphql/utilities/getIntrospectionQuery.js +145 -0
- package/dist/node_modules/graphql/utilities/getOperationAST.js +33 -0
- package/dist/node_modules/graphql/utilities/getOperationRootType.js +40 -0
- package/dist/node_modules/graphql/utilities/index.js +242 -0
- package/dist/node_modules/graphql/utilities/introspectionFromSchema.js +49 -0
- package/dist/node_modules/graphql/utilities/lexicographicSortSchema.js +146 -0
- package/dist/node_modules/graphql/utilities/printSchema.js +177 -0
- package/dist/node_modules/graphql/utilities/separateOperations.js +63 -0
- package/dist/node_modules/graphql/utilities/sortValueNode.js +51 -0
- package/dist/node_modules/graphql/utilities/stripIgnoredCharacters.js +108 -0
- package/dist/node_modules/graphql/utilities/typeComparators.js +64 -0
- package/dist/node_modules/graphql/utilities/typeFromAST.js +32 -0
- package/dist/node_modules/graphql/utilities/valueFromAST.js +115 -0
- package/dist/node_modules/graphql/utilities/valueFromASTUntyped.js +48 -0
- package/dist/node_modules/graphql/validation/ValidationContext.js +172 -0
- package/dist/node_modules/graphql/validation/index.js +340 -0
- package/dist/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js +38 -0
- package/dist/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js +87 -0
- package/dist/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js +53 -0
- package/dist/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js +79 -0
- package/dist/node_modules/graphql/validation/rules/KnownDirectivesRule.js +96 -0
- package/dist/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js +32 -0
- package/dist/node_modules/graphql/validation/rules/KnownTypeNamesRule.js +57 -0
- package/dist/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js +38 -0
- package/dist/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js +36 -0
- package/dist/node_modules/graphql/validation/rules/MaxIntrospectionDepthRule.js +56 -0
- package/dist/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js +60 -0
- package/dist/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js +45 -0
- package/dist/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js +47 -0
- package/dist/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js +47 -0
- package/dist/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js +314 -0
- package/dist/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js +62 -0
- package/dist/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js +99 -0
- package/dist/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js +88 -0
- package/dist/node_modules/graphql/validation/rules/ScalarLeafsRule.js +50 -0
- package/dist/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js +56 -0
- package/dist/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js +58 -0
- package/dist/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js +40 -0
- package/dist/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js +36 -0
- package/dist/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js +56 -0
- package/dist/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js +49 -0
- package/dist/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js +56 -0
- package/dist/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js +36 -0
- package/dist/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js +49 -0
- package/dist/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js +36 -0
- package/dist/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js +48 -0
- package/dist/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js +44 -0
- package/dist/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js +33 -0
- package/dist/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js +140 -0
- package/dist/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js +41 -0
- package/dist/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js +79 -0
- package/dist/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js +75 -0
- package/dist/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +37 -0
- package/dist/node_modules/graphql/validation/specifiedRules.js +148 -0
- package/dist/node_modules/graphql/validation/validate.js +106 -0
- package/dist/node_modules/graphql/version.js +30 -0
- package/dist/node_modules/graphql-tag/lib/graphql-tag.umd.js +126 -0
- package/dist/node_modules/graphql-tag/main.js +15 -0
- package/dist/node_modules/iconv-lite/encodings/dbcs-codec.js +352 -0
- package/dist/node_modules/iconv-lite/encodings/dbcs-data.js +197 -0
- package/dist/node_modules/iconv-lite/encodings/index.js +37 -0
- package/dist/node_modules/iconv-lite/encodings/internal.js +144 -0
- package/dist/node_modules/iconv-lite/encodings/sbcs-codec.js +56 -0
- package/dist/node_modules/iconv-lite/encodings/sbcs-data-generated.js +461 -0
- package/dist/node_modules/iconv-lite/encodings/sbcs-data.js +157 -0
- package/dist/node_modules/iconv-lite/encodings/tables/big5-added.js +175 -0
- package/dist/node_modules/iconv-lite/encodings/tables/cp936.js +2590 -0
- package/dist/node_modules/iconv-lite/encodings/tables/cp949.js +2226 -0
- package/dist/node_modules/iconv-lite/encodings/tables/cp950.js +233 -0
- package/dist/node_modules/iconv-lite/encodings/tables/eucjp.js +431 -0
- package/dist/node_modules/iconv-lite/encodings/tables/gb18030-ranges.js +433 -0
- package/dist/node_modules/iconv-lite/encodings/tables/gbk-added.js +236 -0
- package/dist/node_modules/iconv-lite/encodings/tables/shiftjis.js +298 -0
- package/dist/node_modules/iconv-lite/encodings/utf16.js +129 -0
- package/dist/node_modules/iconv-lite/encodings/utf32.js +201 -0
- package/dist/node_modules/iconv-lite/encodings/utf7.js +186 -0
- package/dist/node_modules/iconv-lite/lib/bom-handling.js +48 -0
- package/dist/node_modules/iconv-lite/lib/index.js +113 -0
- package/dist/node_modules/iconv-lite/lib/streams.js +96 -0
- package/dist/node_modules/node-fetch/lib/index.js +1184 -0
- package/dist/node_modules/optimism/lib/bundle.js +374 -0
- package/dist/node_modules/safer-buffer/safer.js +51 -0
- package/dist/node_modules/symbol-observable/lib/index.js +28 -0
- package/dist/node_modules/symbol-observable/lib/ponyfill.js +29 -0
- package/dist/node_modules/tr46/index.js +148 -0
- package/dist/node_modules/tr46/lib/mappingTable.js +35566 -0
- package/dist/node_modules/ts-invariant/lib/invariant.js +68 -0
- package/dist/node_modules/tslib/tslib.js +581 -0
- package/dist/node_modules/whatwg-url/lib/URL-impl.js +148 -0
- package/dist/node_modules/whatwg-url/lib/URL.js +177 -0
- package/dist/node_modules/whatwg-url/lib/public-api.js +24 -0
- package/dist/node_modules/whatwg-url/lib/url-state-machine.js +884 -0
- package/dist/node_modules/whatwg-url/lib/utils.js +25 -0
- package/dist/node_modules/whatwg-url/node_modules/webidl-conversions/lib/index.js +127 -0
- package/dist/node_modules/zen-observable/index.js +15 -0
- package/dist/node_modules/zen-observable/lib/Observable.js +531 -0
- package/dist/node_modules/zen-observable-ts/index.js +15 -0
- package/dist/packages/spacelift/node_modules/@apollo/client/cache/cache.js +2097 -0
- package/dist/packages/spacelift/node_modules/@apollo/client/core/core.js +2195 -0
- package/dist/packages/spacelift/node_modules/@apollo/client/errors/errors.js +56 -0
- package/dist/packages/spacelift/node_modules/@apollo/client/link/context/context.js +44 -0
- package/dist/packages/spacelift/node_modules/@apollo/client/link/core/core.js +118 -0
- package/dist/packages/spacelift/node_modules/@apollo/client/link/error/error.js +97 -0
- package/dist/packages/spacelift/node_modules/@apollo/client/link/http/http.js +539 -0
- package/dist/packages/spacelift/node_modules/@apollo/client/link/utils/utils.js +120 -0
- package/dist/packages/spacelift/node_modules/@apollo/client/utilities/globals/globals.js +102 -0
- package/dist/packages/spacelift/node_modules/@apollo/client/utilities/utilities.js +1425 -0
- package/dist/packages/spacelift/src/index.js +4 -0
- package/dist/packages/spacelift/src/lib/__generated__/graphql.js +65 -0
- package/dist/packages/spacelift/src/lib/graphql.service.js +141 -0
- package/dist/packages/spacelift/src/lib/query/spacelift.queries.js +54 -0
- package/dist/packages/spacelift/src/lib/spacelift.error.js +71 -0
- package/dist/packages/spacelift/src/lib/spacelift.service.js +52 -0
- package/dist/packages/spacelift/src/lib/utils.js +32 -0
- package/dist/scripts/version-actions.d.ts +11 -0
- package/dist/scripts/version-actions.js +37 -0
- package/dist/utils/common/aws-auth.js +127 -0
- package/dist/utils/common/circleci.js +17 -0
- package/dist/utils/common/exec.js +33 -0
- package/dist/utils/common/github.js +33 -0
- package/dist/utils/common/import-esm.js +12 -0
- package/dist/utils/common/logger.js +8 -0
- package/dist/utils/common/nx.js +71 -0
- package/dist/utils/common/s3.js +15 -0
- package/dist/utils/common/tsh.js +90 -0
- package/dist/utils/datadog.js +31 -0
- package/dist/utils/docker.js +60 -0
- package/dist/utils/helm.js +128 -0
- package/dist/utils/lambda/aws-lambda.js +165 -0
- package/dist/utils/lambda/lambda.js +14 -0
- package/dist/utils/lambda/oci.js +17 -0
- package/dist/utils/lambda/publish.js +31 -0
- package/dist/utils/lambda/spacelift.js +53 -0
- package/package.json +14 -15
- package/src/executors/publisher/docker.d.ts +0 -3
- package/src/executors/publisher/docker.js +0 -66
- package/src/executors/publisher/docker.js.map +0 -1
- package/src/executors/publisher/executor.js +0 -18
- package/src/executors/publisher/executor.js.map +0 -1
- package/src/executors/publisher/helm.d.ts +0 -3
- package/src/executors/publisher/helm.js +0 -69
- package/src/executors/publisher/helm.js.map +0 -1
- package/src/executors/release/executor.d.ts +0 -4
- package/src/executors/release/executor.js +0 -95
- package/src/executors/release/executor.js.map +0 -1
- package/src/generators/init/files/.circleci/config.yml.template +0 -222
- package/src/generators/init/files/.circleci/teleport/shared-charts.conf.template +0 -24
- package/src/generators/init/files/.npmrc.template +0 -1
- package/src/generators/init/init.d.ts +0 -13
- package/src/generators/init/init.js +0 -292
- package/src/generators/init/init.js.map +0 -1
- package/src/index.d.ts +0 -9
- package/src/index.js +0 -75
- package/src/index.js.map +0 -1
- package/src/scripts/version-actions.d.ts +0 -7
- package/src/scripts/version-actions.js +0 -42
- package/src/scripts/version-actions.js.map +0 -1
- package/src/scripts/version-actions.mock.d.ts +0 -6
- package/src/scripts/version-actions.mock.js +0 -61
- package/src/scripts/version-actions.mock.js.map +0 -1
- package/src/utils/aws-auth.d.ts +0 -46
- package/src/utils/aws-auth.js +0 -144
- package/src/utils/aws-auth.js.map +0 -1
- package/src/utils/circleci.d.ts +0 -2
- package/src/utils/circleci.js +0 -20
- package/src/utils/circleci.js.map +0 -1
- package/src/utils/datadog.d.ts +0 -1
- package/src/utils/datadog.js +0 -33
- package/src/utils/datadog.js.map +0 -1
- package/src/utils/docker.d.ts +0 -15
- package/src/utils/docker.js +0 -73
- package/src/utils/docker.js.map +0 -1
- package/src/utils/exec.d.ts +0 -4
- package/src/utils/exec.js +0 -50
- package/src/utils/exec.js.map +0 -1
- package/src/utils/github.d.ts +0 -16
- package/src/utils/github.js +0 -53
- package/src/utils/github.js.map +0 -1
- package/src/utils/helm.d.ts +0 -64
- package/src/utils/helm.js +0 -159
- package/src/utils/helm.js.map +0 -1
- package/src/utils/helm.mock.d.ts +0 -85
- package/src/utils/helm.mock.js +0 -100
- package/src/utils/helm.mock.js.map +0 -1
- package/src/utils/import-esm.d.ts +0 -2
- package/src/utils/import-esm.js +0 -12
- package/src/utils/import-esm.js.map +0 -1
- package/src/utils/logger.d.ts +0 -1
- package/src/utils/logger.js +0 -8
- package/src/utils/logger.js.map +0 -1
- package/src/utils/nx.d.ts +0 -8
- package/src/utils/nx.js +0 -95
- package/src/utils/nx.js.map +0 -1
- package/src/utils/tsh.d.ts +0 -11
- package/src/utils/tsh.js +0 -112
- package/src/utils/tsh.js.map +0 -1
- /package/{src → dist}/executors/release/schema.json +0 -0
- /package/{src → dist}/generators/init/schema.json +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# @payfit/nx-core
|
|
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
|
+
To make sure we are able to cache packages correctly, monorepo should be using yarn v4
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```shell
|
|
21
|
+
npx nx add @payfit/nx-core
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This command will:
|
|
25
|
+
|
|
26
|
+
- Install the package as a dev dependency
|
|
27
|
+
- Run the [init generator](./src/generators/init) to set up the necessary configuration
|
|
28
|
+
- Update your workspace configuration automatically
|
|
29
|
+
|
|
30
|
+
### Init generator
|
|
31
|
+
|
|
32
|
+
Using the above command will setup your repo with the default recommended configuration. You are free to edit this configuration to your needs.
|
|
33
|
+
|
|
34
|
+
In the `nx.json` file:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
"release": {
|
|
38
|
+
"projectsRelationship": "independent",
|
|
39
|
+
"projects": ["*"],
|
|
40
|
+
"releaseTagPattern": "{projectName}-{version}",
|
|
41
|
+
"changelog": {
|
|
42
|
+
"projectChangelogs": {
|
|
43
|
+
"createRelease": "github",
|
|
44
|
+
"file": false,
|
|
45
|
+
"git": {
|
|
46
|
+
"commit": false,
|
|
47
|
+
"tag": true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"automaticFromRef": true
|
|
51
|
+
},
|
|
52
|
+
"version": {
|
|
53
|
+
"useLegacyVersioning": false,
|
|
54
|
+
"currentVersionResolver": "git-tag",
|
|
55
|
+
"fallbackCurrentVersionResolver": "disk",
|
|
56
|
+
"specifierSource": "conventional-commits",
|
|
57
|
+
"manifestRootsToUpdate": ["{workspaceRoot}/dist/{projectRoot}"],
|
|
58
|
+
"preserveLocalDependencyProtocols": false
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"plugins": ["@payfit/nx-core"]
|
|
62
|
+
"targetDefaults": [
|
|
63
|
+
"nx-release-publish": {
|
|
64
|
+
"options": {
|
|
65
|
+
"packageRoot": "{workspaceRoot}/dist/{projectRoot}",
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
It will also generate the CircleCI config file & Teleport file needed.
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
### Docker Image Release
|
|
76
|
+
|
|
77
|
+
The plugin automatically handles:
|
|
78
|
+
|
|
79
|
+
- Building Docker images
|
|
80
|
+
- Tagging with appropriate versions
|
|
81
|
+
- Publishing to your container registry
|
|
82
|
+
|
|
83
|
+
### Helm Chart Release
|
|
84
|
+
|
|
85
|
+
The plugin manages:
|
|
86
|
+
|
|
87
|
+
- Chart version updates
|
|
88
|
+
- Chart packaging
|
|
89
|
+
- Chart publishing
|
|
90
|
+
- Automatic image tag patching in values.yaml files
|
|
91
|
+
|
|
92
|
+
#### Image Tag Patching Behavior
|
|
93
|
+
|
|
94
|
+
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:
|
|
95
|
+
|
|
96
|
+
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.
|
|
97
|
+
|
|
98
|
+
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.
|
|
99
|
+
|
|
100
|
+
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.
|
|
101
|
+
|
|
102
|
+
This ensures that all relevant image tags are updated to the new version during the release process, regardless of your Helm chart's structure.
|
|
103
|
+
|
|
104
|
+
### Lambda Function Release
|
|
105
|
+
|
|
106
|
+
The plugin automates the process of packaging and deploying AWS Lambda functions:
|
|
107
|
+
|
|
108
|
+
- Creating a zip archive from your Lambda function code
|
|
109
|
+
- Uploading the archive to an S3 bucket
|
|
110
|
+
- Creating an empty OCI artifact and pushing it to ECR for versioning
|
|
111
|
+
|
|
112
|
+
#### Lambda Configuration Parameters
|
|
113
|
+
|
|
114
|
+
When using Lambda functions, you can configure the following parameters in your project's `project.json` file:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"metadata": {
|
|
119
|
+
"lambdaRegistry": "your-lambda-registry",
|
|
120
|
+
"lambdaBucket": "your-lambda-bucket"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
These fields are used to:
|
|
126
|
+
|
|
127
|
+
- `lambdaRegistry`: the ECR repository name for Lambda function artifacts (this is used to create an empty OCI artifact for versioning)
|
|
128
|
+
- `lambdaBucket`: the S3 bucket where Lambda function zip archives are stored
|
|
129
|
+
|
|
130
|
+
If `lambdaBucket` is not specified, the plugin will fall back to the default bucket: `payfit-shared-lambda-artifacts`.
|
|
131
|
+
|
|
132
|
+
#### Lambda Detection
|
|
133
|
+
|
|
134
|
+
The plugin automatically detects Lambda functions by looking for a `lambdaRegistry` metadata in your project root. When this metadata is present, the plugin will configure the necessary targets for packaging and deploying your Lambda function.
|
|
135
|
+
|
|
136
|
+
## Configuration
|
|
137
|
+
|
|
138
|
+
The plugin uses Nx's versionActions to handle versioning transparently. The init generator will set up the required configuration automatically.
|
|
139
|
+
|
|
140
|
+
You'll need to add the following metadata to your project's `project.json` file:
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"metadata": {
|
|
145
|
+
"ecrRegistry": "your-app-name",
|
|
146
|
+
"chartRegistry": "your-chart-registry",
|
|
147
|
+
"ociEcrRegistry": "your-app-name",
|
|
148
|
+
"helmChartFolder": "your-helm-folder",
|
|
149
|
+
"lambdaRegistry": "your-lambda-registry",
|
|
150
|
+
"lambdaBucket": "your-lambda-bucket"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
These fields are used to:
|
|
156
|
+
|
|
157
|
+
- `ecrRegistry`: the ECR repository name for Docker images
|
|
158
|
+
- `chartRegistry`: the Helm chart registry
|
|
159
|
+
- `ociEcrRegistry`: the OCI registry for container images
|
|
160
|
+
- `helmChartFolder`: the folder containing Helm chart files (Chart.yaml, values.yaml, etc.), defaults to `.deploy`
|
|
161
|
+
- `lambdaRegistry`: the ECR repository name for Lambda function artifacts
|
|
162
|
+
- `lambdaBucket`: the S3 bucket where Lambda function zip archives are stored (defaults to `payfit-shared-lambda-artifacts`)
|
|
163
|
+
|
|
164
|
+
## Automatic Release Target Inference
|
|
165
|
+
|
|
166
|
+
The plugin automatically infers release targets for your projects based on the presence of deployment files:
|
|
167
|
+
|
|
168
|
+
1. **Docker Image Release**: If a `Dockerfile` exists in your project root, the plugin will automatically:
|
|
169
|
+
- Configure Docker image building and publishing
|
|
170
|
+
- Set up version management for the image
|
|
171
|
+
- Handle ECR repository integration
|
|
172
|
+
|
|
173
|
+
2. **Helm Chart Release**: If a `Chart.yaml` exists in your Helm chart folder (defaults to `.deploy/Chart.yaml`), the plugin will automatically:
|
|
174
|
+
- Configure Helm chart packaging and versioning
|
|
175
|
+
- Set up chart publishing to your registry
|
|
176
|
+
- Handle chart dependencies and updates
|
|
177
|
+
|
|
178
|
+
3. **Lambda Function Release**: If a `.lambda` file exists in your project root, the plugin will automatically:
|
|
179
|
+
- Configure Lambda function packaging (zip archive creation)
|
|
180
|
+
- Set up S3 bucket uploading for the Lambda artifact
|
|
181
|
+
- Create and push an empty OCI artifact to ECR for versioning
|
|
182
|
+
|
|
183
|
+
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.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
# Debug locally
|
|
188
|
+
|
|
189
|
+
1. Build everything:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npx nx run-many -t build
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
2. Trigger a new release using the local plugin version:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
npx nx run @payfit/nx-common-packages:release --dry-run=true
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Make sure you pushed a change to your branch to actually trigger a release, otherwise it will say something like `No project to publish`
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
13
|
+
key = keys[i];
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
+
value: mod,
|
|
23
|
+
enumerable: true
|
|
24
|
+
}) : target, mod));
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
|
|
28
|
+
Object.defineProperty(exports, '__commonJS', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return __commonJS;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, '__toESM', {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return __toESM;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_logger = require('../../utils/common/logger.js');
|
|
3
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_aws_auth = require('../../utils/common/aws-auth.js');
|
|
4
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_github = require('../../utils/common/github.js');
|
|
5
|
+
const require__home_circleci_project_packages_nx_core_src_utils_datadog = require('../../utils/datadog.js');
|
|
6
|
+
const require__home_circleci_project_packages_nx_core_src_utils_docker = require('../../utils/docker.js');
|
|
7
|
+
const node_fs = require_rolldown_runtime.__toESM(require("node:fs"));
|
|
8
|
+
|
|
9
|
+
//#region src/executors/publisher/docker.ts
|
|
10
|
+
async function publishDocker(options, context, version, projectRoot, isDryRun) {
|
|
11
|
+
const projectDockerfile = `${projectRoot}/Dockerfile`;
|
|
12
|
+
if (!node_fs.existsSync(projectDockerfile)) {
|
|
13
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.warn(`Dockerfile not found at ${projectDockerfile}, skipping`);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!options.ecrRegistry) {
|
|
17
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.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 ? "public.ecr.aws/payfit" : process.env.AWS_ECR_REGISTRY,
|
|
22
|
+
name: options.isPublicRegistry ? "public.ecr.aws" : process.env.AWS_ECR_REGISTRY
|
|
23
|
+
};
|
|
24
|
+
if (isDryRun) {
|
|
25
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.box(`Would have published docker image located at ${projectDockerfile} to registry ${options.ecrRegistry} with version ${version} but --dry-run is enabled`);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
await require__home_circleci_project_packages_nx_core_src_utils_common_aws_auth.checkAwsAuth();
|
|
29
|
+
await require__home_circleci_project_packages_nx_core_src_utils_common_aws_auth.loginToEcr(registry.name, options.isPublicRegistry);
|
|
30
|
+
const hasValidCredentials = await require__home_circleci_project_packages_nx_core_src_utils_common_aws_auth.verifyEcrCredentials(registry.name);
|
|
31
|
+
if (!hasValidCredentials) {
|
|
32
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.warn("ECR credentials verification failed. Attempting to login again...");
|
|
33
|
+
await require__home_circleci_project_packages_nx_core_src_utils_common_aws_auth.loginToEcr(registry.name, options.isPublicRegistry);
|
|
34
|
+
const retryCredentials = await require__home_circleci_project_packages_nx_core_src_utils_common_aws_auth.verifyEcrCredentials(registry.name);
|
|
35
|
+
if (!retryCredentials) throw new Error("No valid ECR credentials available for pushing Docker image");
|
|
36
|
+
}
|
|
37
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.box(`Publishing docker image to ${registry.url}/${options.ecrRegistry} with version ${version}`);
|
|
38
|
+
const extraTags = !version.includes("ephemeral") && options.extraReleaseTags ? options.extraReleaseTags : [];
|
|
39
|
+
const sanitizedRepoUrl = await require__home_circleci_project_packages_nx_core_src_utils_common_github.getSanitizedCurrentGitRepoUrl();
|
|
40
|
+
const commitSha = await require__home_circleci_project_packages_nx_core_src_utils_common_github.getCurrentGitCommitSha();
|
|
41
|
+
const appName = context.projectName || "unknown-app";
|
|
42
|
+
try {
|
|
43
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.start("Building and pushing docker image");
|
|
44
|
+
await require__home_circleci_project_packages_nx_core_src_utils_docker.buildAndPushDockerImage(options.ecrRegistry, projectDockerfile, version, sanitizedRepoUrl, commitSha, registry.url, extraTags, appName);
|
|
45
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.success("Docker image built and pushed successfully!");
|
|
46
|
+
if (!version.includes("ephemeral")) await require__home_circleci_project_packages_nx_core_src_utils_datadog.correlateDeploymentImage(`${registry.url}/${options.ecrRegistry}:${version}`, sanitizedRepoUrl, commitSha);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.error("Failed to build and push Docker image:", error);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
exports.publishDocker = publishDocker;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PublisherExecutorOptions, PublisherExecutorSchema } from "./schema.js";
|
|
2
|
+
import { ExecutorContext } from "@nx/devkit";
|
|
3
|
+
|
|
4
|
+
//#region src/executors/publisher/executor.d.ts
|
|
3
5
|
declare const runExecutor: (options: PublisherExecutorOptions, context: ExecutorContext) => Promise<PublisherExecutorSchema>;
|
|
4
|
-
|
|
6
|
+
//#endregion
|
|
7
|
+
export { runExecutor as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_nx = require('../../utils/common/nx.js');
|
|
2
|
+
const require__home_circleci_project_packages_nx_core_src_executors_publisher_docker = require('./docker.js');
|
|
3
|
+
const require__home_circleci_project_packages_nx_core_src_executors_publisher_helm = require('./helm.js');
|
|
4
|
+
const require__home_circleci_project_packages_nx_core_src_executors_publisher_lambda = require('./lambda.js');
|
|
5
|
+
|
|
6
|
+
//#region src/executors/publisher/executor.ts
|
|
7
|
+
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 require__home_circleci_project_packages_nx_core_src_utils_common_nx.getDistForApp(context);
|
|
11
|
+
const version = require__home_circleci_project_packages_nx_core_src_utils_common_nx.getVersion(context);
|
|
12
|
+
await require__home_circleci_project_packages_nx_core_src_executors_publisher_docker.publishDocker(options, context, version, projectRoot, isDryRun);
|
|
13
|
+
await require__home_circleci_project_packages_nx_core_src_executors_publisher_helm.publishHelm(options, context, version, projectRoot, projectDist, isDryRun);
|
|
14
|
+
await require__home_circleci_project_packages_nx_core_src_executors_publisher_lambda.publishLambda(options, context, version, projectRoot, projectDist, isDryRun);
|
|
15
|
+
return { success: true };
|
|
16
|
+
};
|
|
17
|
+
var executor_default = runExecutor;
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
module.exports = executor_default;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_logger = require('../../utils/common/logger.js');
|
|
3
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_aws_auth = require('../../utils/common/aws-auth.js');
|
|
4
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_github = require('../../utils/common/github.js');
|
|
5
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_tsh = require('../../utils/common/tsh.js');
|
|
6
|
+
const require__home_circleci_project_packages_nx_core_src_utils_helm = require('../../utils/helm.js');
|
|
7
|
+
const require__home_circleci_project_node_modules__oxc_project_runtime_src_helpers_usingCtx = require('../../node_modules/@oxc-project/runtime/src/helpers/usingCtx.js');
|
|
8
|
+
const node_fs = require_rolldown_runtime.__toESM(require("node:fs"));
|
|
9
|
+
|
|
10
|
+
//#region src/executors/publisher/helm.ts
|
|
11
|
+
var import_usingCtx = require_rolldown_runtime.__toESM(require__home_circleci_project_node_modules__oxc_project_runtime_src_helpers_usingCtx.require_usingCtx());
|
|
12
|
+
async function publishHelm(options, context, version, projectRoot, projectDist, isDryRun) {
|
|
13
|
+
try {
|
|
14
|
+
var _usingCtx = (0, import_usingCtx.default)();
|
|
15
|
+
const helmChartFolder = options.helmChartFolder || ".deploy";
|
|
16
|
+
const projectHelmFolder = `${projectRoot}/${helmChartFolder}`;
|
|
17
|
+
const valuesConfigPath = `${projectHelmFolder}/values.yaml`;
|
|
18
|
+
const chartConfigPath = `${projectHelmFolder}/Chart.yaml`;
|
|
19
|
+
const destinationHelmFolder = `${projectDist}/chart/`;
|
|
20
|
+
const gitBranchName = await require__home_circleci_project_packages_nx_core_src_utils_common_github.getSanitizedCurrentGitBranch();
|
|
21
|
+
if (!gitBranchName) throw new Error("Unable to get current Git branch");
|
|
22
|
+
if (!node_fs.existsSync(chartConfigPath)) {
|
|
23
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.warn(`No helm chart found in project ${context.projectName}, searching ${chartConfigPath}, skipping`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!options.chartRegistry) {
|
|
27
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.error("Helm chart detected but no chart registry provided, add \"chartRegistry\" to your project.json metadata");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (isDryRun) {
|
|
31
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.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
|
+
await require__home_circleci_project_packages_nx_core_src_utils_common_aws_auth.checkAwsAuth();
|
|
35
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.box(`Publishing Helm chart to ${options.chartRegistry}/${gitBranchName} with version ${version}`);
|
|
36
|
+
const proxyData = _usingCtx.u(await require__home_circleci_project_packages_nx_core_src_utils_common_tsh.getLocalPortForChartMuseum());
|
|
37
|
+
await proxyData.isReady();
|
|
38
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.start("Building Helm chart");
|
|
39
|
+
await require__home_circleci_project_packages_nx_core_src_utils_helm.setupTeleportProxyHelmChartFile(projectHelmFolder, proxyData.port);
|
|
40
|
+
await require__home_circleci_project_packages_nx_core_src_utils_helm.installHelmRepo(projectHelmFolder);
|
|
41
|
+
await require__home_circleci_project_packages_nx_core_src_utils_helm.patchImageTag(valuesConfigPath, chartConfigPath, version);
|
|
42
|
+
await require__home_circleci_project_packages_nx_core_src_utils_helm.packageHelm(projectHelmFolder, version, destinationHelmFolder);
|
|
43
|
+
await require__home_circleci_project_packages_nx_core_src_utils_helm.resetTeleportProxyHelmChartFile(projectHelmFolder, proxyData.port);
|
|
44
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.success("Helm chart packaged!");
|
|
45
|
+
const chartConfig = await require__home_circleci_project_packages_nx_core_src_utils_helm.getHelmChartFile(projectHelmFolder);
|
|
46
|
+
const packagedHelmChartName = `${chartConfig.name}-${version}.tgz`;
|
|
47
|
+
const packagedHelmChartPath = `${destinationHelmFolder}${packagedHelmChartName}`;
|
|
48
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.start("Publishing Helm chart");
|
|
49
|
+
if (options.ociEcrRegistry) {
|
|
50
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.log(`Publishing Helm chart to OCI registry ${options.ociEcrRegistry}`);
|
|
51
|
+
await require__home_circleci_project_packages_nx_core_src_utils_helm.pushOciPackagedHelm(packagedHelmChartPath, options.ociEcrRegistry);
|
|
52
|
+
} else await require__home_circleci_project_packages_nx_core_src_utils_helm.pushPackagedHelm(packagedHelmChartPath, packagedHelmChartName, options.chartRegistry, gitBranchName);
|
|
53
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.success("Helm chart published successfully!");
|
|
54
|
+
} catch (_) {
|
|
55
|
+
_usingCtx.e = _;
|
|
56
|
+
} finally {
|
|
57
|
+
_usingCtx.d();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.publishHelm = publishHelm;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_logger = require('../../utils/common/logger.js');
|
|
3
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_aws_auth = require('../../utils/common/aws-auth.js');
|
|
4
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_github = require('../../utils/common/github.js');
|
|
5
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_s3 = require('../../utils/common/s3.js');
|
|
6
|
+
const require__home_circleci_project_packages_nx_core_src_utils_lambda_lambda = require('../../utils/lambda/lambda.js');
|
|
7
|
+
const require__home_circleci_project_packages_nx_core_src_utils_lambda_oci = require('../../utils/lambda/oci.js');
|
|
8
|
+
const require__home_circleci_project_packages_nx_core_src_utils_lambda_publish = require('../../utils/lambda/publish.js');
|
|
9
|
+
const path = require_rolldown_runtime.__toESM(require("path"));
|
|
10
|
+
|
|
11
|
+
//#region src/executors/publisher/lambda.ts
|
|
12
|
+
async function publishLambda(options, context, version, projectRoot, projectDist, isDryRun) {
|
|
13
|
+
const gitBranchName = await require__home_circleci_project_packages_nx_core_src_utils_common_github.getSanitizedCurrentGitBranch();
|
|
14
|
+
const repoUrl = await require__home_circleci_project_packages_nx_core_src_utils_common_github.getSanitizedCurrentGitRepoUrl();
|
|
15
|
+
const repoName = repoUrl.split("/").pop() ?? "unknown-repo";
|
|
16
|
+
const sanitizedProjectName = context.projectName.replace(/^@payfit\//, "").replace(/[^a-zA-Z0-9-_]/g, "-");
|
|
17
|
+
const zipName = `${version}.zip`;
|
|
18
|
+
const zipFileNameS3 = `${options.lambdaBucket}/${repoName}/${sanitizedProjectName}/${zipName}`;
|
|
19
|
+
if (!gitBranchName) throw new Error("Unable to get current Git branch");
|
|
20
|
+
if (!options.lambdaRegistry) {
|
|
21
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.warn("No lambda registry provided, add \"lambdaRegistry\" to your project.json metadata if this app is a lambda function, otherwise ignore this warning. skipping.");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (!options.lambdaStacks) {
|
|
25
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.error("No lambda spacelift stacks provided, add \"lambdaStacks\" to your project.json metadata");
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!options.lambdaFunctions) {
|
|
29
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.error("No lambda functions provided, add \"lambdaFunctions\" to your project.json metadata");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (isDryRun) {
|
|
33
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.box(`Would have published lambda artefact to S3 ${zipFileNameS3} and ECR ${process.env.AWS_ECR_REGISTRY}/${options.lambdaRegistry}:${version} but --dry-run is enabled`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
await require__home_circleci_project_packages_nx_core_src_utils_common_aws_auth.checkAwsAuth();
|
|
37
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.box(`Publishing the lambda artefact ${zipFileNameS3}`);
|
|
38
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.info(`Zipping ${zipName} from ${projectDist}`);
|
|
39
|
+
await require__home_circleci_project_packages_nx_core_src_utils_lambda_lambda.createZip(projectDist, zipName);
|
|
40
|
+
const zipPath = (0, path.join)(projectDist, zipName);
|
|
41
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.info(`Uploading ${zipPath} to S3 at ${zipFileNameS3}`);
|
|
42
|
+
await require__home_circleci_project_packages_nx_core_src_utils_common_s3.pushToS3(zipPath, zipFileNameS3);
|
|
43
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.success(`Lambda artefact successfully pushed to S3 at ${zipFileNameS3}`);
|
|
44
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.box(`Creating new Lambda version and running smoke tests`);
|
|
45
|
+
await require__home_circleci_project_packages_nx_core_src_utils_lambda_publish.createLambdaVersion(options.lambdaStacks, options.lambdaFunctions, version);
|
|
46
|
+
const packageJsonPath = (0, path.join)(projectDist, "package.json");
|
|
47
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.info(`Pushing empty image to ECR ${process.env.AWS_ECR_REGISTRY}/${options.lambdaRegistry}:${version}`);
|
|
48
|
+
await require__home_circleci_project_packages_nx_core_src_utils_common_aws_auth.loginToEcr(process.env.AWS_ECR_REGISTRY);
|
|
49
|
+
await require__home_circleci_project_packages_nx_core_src_utils_lambda_oci.pushImageToEcr(options.lambdaRegistry, version, packageJsonPath);
|
|
50
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.success("Lambda artifact successfully pushed to S3!");
|
|
51
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.success(`Lambda version ${version} successfully created and smoke tests passed, you're lambda is ready to be promoted in Kargo !`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
exports.publishLambda = publishLambda;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/executors/publisher/schema.d.ts
|
|
2
|
+
interface PublisherExecutorSchema {} // eslint-disable-line
|
|
3
|
+
interface PublisherExecutorOptions {
|
|
4
|
+
chartRegistry: string;
|
|
5
|
+
ecrRegistry: string;
|
|
6
|
+
ociEcrRegistry?: string;
|
|
7
|
+
isPublicRegistry?: boolean;
|
|
8
|
+
helmChartFolder?: string;
|
|
9
|
+
extraReleaseTags?: string[];
|
|
10
|
+
dryRun?: boolean;
|
|
11
|
+
lambdaBucket?: string;
|
|
12
|
+
lambdaRegistry?: string;
|
|
13
|
+
lambdaStacks?: string[];
|
|
14
|
+
lambdaFunctions?: string[];
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { PublisherExecutorOptions, PublisherExecutorSchema };
|
|
@@ -39,6 +39,23 @@
|
|
|
39
39
|
"type": "boolean",
|
|
40
40
|
"description": "Whether to run in dry run mode. When true, shows what would be published without actually publishing.",
|
|
41
41
|
"default": false
|
|
42
|
+
},
|
|
43
|
+
"lambdaBucket": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "The S3 bucket for lambda",
|
|
46
|
+
"default": "payfit-shared-lambda-artifacts"
|
|
47
|
+
},
|
|
48
|
+
"lambdaRegistry": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "The OCI registry for lambda"
|
|
51
|
+
},
|
|
52
|
+
"lambdaStacks": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"description": "The list of stacks to publish the lambda to"
|
|
55
|
+
},
|
|
56
|
+
"lambdaFunctions": {
|
|
57
|
+
"type": "array",
|
|
58
|
+
"description": "The list of lambda functions inside the workload"
|
|
42
59
|
}
|
|
43
60
|
},
|
|
44
61
|
"required": []
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReleaseExecutorOptions, ReleaseExecutorSchema } from "./schema.js";
|
|
2
|
+
import { ExecutorContext } from "@nx/devkit";
|
|
3
|
+
|
|
4
|
+
//#region src/executors/release/executor.d.ts
|
|
5
|
+
declare const runExecutor: (options: ReleaseExecutorOptions, context: ExecutorContext) => Promise<ReleaseExecutorSchema>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { runExecutor as default };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_logger = require('../../utils/common/logger.js');
|
|
3
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_github = require('../../utils/common/github.js');
|
|
4
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_tsh = require('../../utils/common/tsh.js');
|
|
5
|
+
const require__home_circleci_project_packages_nx_core_src_utils_common_circleci = require('../../utils/common/circleci.js');
|
|
6
|
+
const nx_release = require_rolldown_runtime.__toESM(require("nx/release"));
|
|
7
|
+
|
|
8
|
+
//#region src/executors/release/executor.ts
|
|
9
|
+
const runExecutor = async (options, context) => {
|
|
10
|
+
const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
|
|
11
|
+
if (require__home_circleci_project_packages_nx_core_src_utils_common_circleci.isCircleCIRunner()) {
|
|
12
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.start("CircleCI runner detected, setting it up!");
|
|
13
|
+
await require__home_circleci_project_packages_nx_core_src_utils_common_circleci.setupCircleCIRunner();
|
|
14
|
+
await require__home_circleci_project_packages_nx_core_src_utils_common_tsh.startTbot();
|
|
15
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.success("CircleCI runner setup successfully!");
|
|
16
|
+
}
|
|
17
|
+
const branchName = await require__home_circleci_project_packages_nx_core_src_utils_common_github.getSanitizedCurrentGitBranch();
|
|
18
|
+
const commit = await require__home_circleci_project_packages_nx_core_src_utils_common_github.getCurrentGitCommitSha();
|
|
19
|
+
const isPreRelease = options?.preRelease != null ? options.preRelease : branchName != "main" && branchName != "master";
|
|
20
|
+
if (isPreRelease) require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.warn("This is an ephemeral release");
|
|
21
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.start("Calculating new versions");
|
|
22
|
+
const { projectsVersionData } = await (0, nx_release.releaseVersion)({
|
|
23
|
+
dryRun: isDryRun,
|
|
24
|
+
verbose: options.verbose,
|
|
25
|
+
groups: options.groups && options.groups.length > 0 ? options.groups : void 0,
|
|
26
|
+
specifier: options.specifier,
|
|
27
|
+
preid: isPreRelease ? `ephemeral-${branchName.substring(0, 100)}-${commit.substring(0, 7)}` : void 0
|
|
28
|
+
});
|
|
29
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.success("New versions calculated successfully!");
|
|
30
|
+
const projectsToPublish = Object.entries(projectsVersionData).map(([projectName, versionData]) => {
|
|
31
|
+
if (versionData?.newVersion) {
|
|
32
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.info(`Project '${projectName}' will be updated to version ${versionData.newVersion}`);
|
|
33
|
+
return projectName;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}).filter(Boolean);
|
|
37
|
+
if (projectsToPublish.length === 0) {
|
|
38
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.warn("No project to publish");
|
|
39
|
+
return { success: true };
|
|
40
|
+
}
|
|
41
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.start("Generating & pushing changelogs");
|
|
42
|
+
await (0, nx_release.releaseChangelog)({
|
|
43
|
+
versionData: projectsVersionData,
|
|
44
|
+
dryRun: isDryRun,
|
|
45
|
+
verbose: options.verbose,
|
|
46
|
+
projects: projectsToPublish,
|
|
47
|
+
createRelease: isPreRelease ? false : "github",
|
|
48
|
+
groups: options.groups && options.groups.length > 0 ? options.groups : void 0
|
|
49
|
+
});
|
|
50
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.success("Generated & pushed changelogs successfully!");
|
|
51
|
+
if (options.skipPublish) {
|
|
52
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.warn("Skipping publishing step as skipPublish = true");
|
|
53
|
+
return { success: true };
|
|
54
|
+
}
|
|
55
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.start("Publishing packages");
|
|
56
|
+
const publishResults = await (0, nx_release.releasePublish)({
|
|
57
|
+
projects: projectsToPublish,
|
|
58
|
+
dryRun: isDryRun,
|
|
59
|
+
verbose: options.verbose,
|
|
60
|
+
tag: isPreRelease ? "ephemeral" : void 0,
|
|
61
|
+
groups: options.groups && options.groups.length > 0 ? options.groups : void 0
|
|
62
|
+
});
|
|
63
|
+
let publishError = false;
|
|
64
|
+
Object.entries(publishResults).forEach(([projectName, result]) => {
|
|
65
|
+
if (result.code === 0) require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.success(`Published ${projectName} successfully!`);
|
|
66
|
+
else {
|
|
67
|
+
publishError = true;
|
|
68
|
+
require__home_circleci_project_packages_nx_core_src_utils_common_logger.consola.fail(`Failed to publish ${projectName} with exit code ${result.code}`);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
if (publishError) throw new Error("We got errors when publishing, check the logs");
|
|
72
|
+
return { success: true };
|
|
73
|
+
};
|
|
74
|
+
var executor_default = runExecutor;
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
module.exports = executor_default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/executors/release/schema.d.ts
|
|
2
|
+
interface ReleaseExecutorSchema {} // eslint-disable-line
|
|
3
|
+
interface ReleaseExecutorOptions {
|
|
4
|
+
skipPublish?: boolean;
|
|
5
|
+
preRelease?: boolean;
|
|
6
|
+
dryRun?: boolean;
|
|
7
|
+
verbose?: boolean;
|
|
8
|
+
groups?: string[];
|
|
9
|
+
specifier?: string;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { ReleaseExecutorOptions, ReleaseExecutorSchema };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CreateNodesContextV2, CreateNodesV2 } from "@nx/devkit";
|
|
2
|
+
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
interface MyPluginOptions {}
|
|
5
|
+
declare const createNodesV2: CreateNodesV2<MyPluginOptions>;
|
|
6
|
+
declare function createNodesInternal(configFilePath: string, options: MyPluginOptions, context: CreateNodesContextV2): Promise<{
|
|
7
|
+
projects: {
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
};
|
|
10
|
+
}>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { MyPluginOptions, createNodesInternal, createNodesV2 };
|