@tahminator/pipeline 1.0.96 → 1.0.97-beta.g9d95485a
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 +8 -0
- package/dist/gh/pr/index.d.ts +7 -1
- package/dist/gh/pr/index.js +23 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -327,6 +327,8 @@ await client.updateK8sTagWithPR({
|
|
|
327
327
|
environment: "production",
|
|
328
328
|
originRepo: ["tahminator", "pipeline"],
|
|
329
329
|
manifestRepo: ["tahminator", "infra"],
|
|
330
|
+
// optional: max PR merge attempts (2s apart) before throwing; defaults to 10
|
|
331
|
+
mergeAttempts: 10,
|
|
330
332
|
});
|
|
331
333
|
|
|
332
334
|
await client.sendPrMessage({
|
|
@@ -514,6 +516,12 @@ Language toolchains are installed and cached by the setup action, so jobs don't
|
|
|
514
516
|
RUST_COMPONENTS: "clippy, rustfmt"
|
|
515
517
|
```
|
|
516
518
|
|
|
519
|
+
Java version and distribution are configurable with `JAVA_VERSION` and `JAVA_DISTRIBUTION`. For built-in dependency caching, `JAVA_CACHE` selects `maven` (default), `gradle`, or `sbt`; set it to `""` to disable built-in caching. `JAVA_CACHE_DEPENDENCY_PATH` accepts newline-separated dependency files/globs for the generated key, and `JAVA_CACHE_PATH` overrides the cached directories. Empty paths keep setup-java's defaults.
|
|
520
|
+
|
|
521
|
+
For an explicit cache key, set both `JAVA_CACHE_KEY` and `JAVA_CACHE_PATH`. This uses `actions/cache` and disables setup-java's built-in caching to avoid duplicate restore/save operations. `JAVA_CACHE_RESTORE_KEYS` optionally supplies newline-separated fallback prefixes. `JAVA_CACHE_DEPENDENCY_PATH` is ignored in this mode; compute dependency hashes in `JAVA_CACHE_KEY` yourself. Both cache modes require `INSTALL_JAVA: "true"`.
|
|
522
|
+
|
|
523
|
+
With `INSTALL_PNPM: "true"`, set `PNPM_CACHE: "true"` to cache the pnpm store. `PNPM_CACHE_DEPENDENCY_PATH` accepts newline-separated lockfiles (default `pnpm-lock.yaml`), and `PNPM_PACKAGE_JSON_FILE` selects the package manifest (default `package.json`). Project dependencies must still be installed separately.
|
|
524
|
+
|
|
517
525
|
### `NPMClient`
|
|
518
526
|
|
|
519
527
|
Interface with NPM registry in order to publish packages to `npmjs.com`
|
package/dist/gh/pr/index.d.ts
CHANGED
|
@@ -51,13 +51,19 @@ export declare class GitHubPRManager {
|
|
|
51
51
|
private readonly client;
|
|
52
52
|
constructor(client: Octokit);
|
|
53
53
|
uploadDirectoryContents({ owner, repository, sourceDirectory, directory, message, branch, }: UploadDirectoryContentsArgs): Promise<void>;
|
|
54
|
-
updateK8sTagWithPR({ newTag, imageName, kustomizationFilePath, environment, originRepo, manifestRepo, }: {
|
|
54
|
+
updateK8sTagWithPR({ newTag, imageName, kustomizationFilePath, environment, originRepo, manifestRepo, mergeAttempts, }: {
|
|
55
55
|
newTag: string;
|
|
56
56
|
imageName: string;
|
|
57
57
|
kustomizationFilePath: string;
|
|
58
58
|
environment: Environment;
|
|
59
59
|
originRepo: [OwnerString, RepoString];
|
|
60
60
|
manifestRepo: [OwnerString, RepoString];
|
|
61
|
+
/**
|
|
62
|
+
* max number of times to try merging the created PR before failing
|
|
63
|
+
*
|
|
64
|
+
* @default 10
|
|
65
|
+
*/
|
|
66
|
+
mergeAttempts?: number;
|
|
61
67
|
}): Promise<void>;
|
|
62
68
|
mergePr({ prId, owner, repository, mergeMethod, }: {
|
|
63
69
|
prId: number;
|
package/dist/gh/pr/index.js
CHANGED
|
@@ -49,7 +49,7 @@ export class GitHubPRManager {
|
|
|
49
49
|
sha: commit.sha,
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
async updateK8sTagWithPR({ newTag, imageName, kustomizationFilePath, environment, originRepo, manifestRepo, }) {
|
|
52
|
+
async updateK8sTagWithPR({ newTag, imageName, kustomizationFilePath, environment, originRepo, manifestRepo, mergeAttempts = 10, }) {
|
|
53
53
|
const [manifestOwner, manifestRepository] = manifestRepo;
|
|
54
54
|
const [originOwner, originRepository] = originRepo;
|
|
55
55
|
const newBranchName = `${imageName}-${newTag}-${Utils.generateShortId()}`;
|
|
@@ -111,11 +111,29 @@ export class GitHubPRManager {
|
|
|
111
111
|
base: baseBranch,
|
|
112
112
|
body: `Automated image tag change to ${newTag} for ${imageName} in ${environment} triggered by [${originOwner}/${originRepository}](https://github.com/${originOwner}/${originRepository}).`,
|
|
113
113
|
});
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
let lastMergeError;
|
|
115
|
+
const merged = await Utils.waitUntil({
|
|
116
|
+
attempts: mergeAttempts,
|
|
117
|
+
intervalMs: 2000,
|
|
118
|
+
predicate: async (attempt) => {
|
|
119
|
+
try {
|
|
120
|
+
await this.mergePr({
|
|
121
|
+
prId: pr.number,
|
|
122
|
+
owner: manifestOwner,
|
|
123
|
+
repository: manifestRepository,
|
|
124
|
+
});
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
lastMergeError = e;
|
|
129
|
+
console.warn(`Failed to merge PR #${pr.number} (${attempt}/${mergeAttempts}):`, e);
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
},
|
|
118
133
|
});
|
|
134
|
+
if (!merged) {
|
|
135
|
+
throw new Error(`Failed to merge PR #${pr.number} after ${mergeAttempts} attempts`, { cause: lastMergeError });
|
|
136
|
+
}
|
|
119
137
|
}
|
|
120
138
|
async mergePr({ prId, owner, repository, mergeMethod = "squash", }) {
|
|
121
139
|
await this.client.rest.pulls.merge({
|
package/package.json
CHANGED