@tahminator/pipeline 1.0.97-beta.g9d95485a → 1.0.97
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 +0 -2
- package/dist/gh/pr/index.d.ts +1 -7
- package/dist/gh/pr/index.js +5 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -327,8 +327,6 @@ 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,
|
|
332
330
|
});
|
|
333
331
|
|
|
334
332
|
await client.sendPrMessage({
|
package/dist/gh/pr/index.d.ts
CHANGED
|
@@ -51,19 +51,13 @@ 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, }: {
|
|
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;
|
|
67
61
|
}): Promise<void>;
|
|
68
62
|
mergePr({ prId, owner, repository, mergeMethod, }: {
|
|
69
63
|
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, }) {
|
|
53
53
|
const [manifestOwner, manifestRepository] = manifestRepo;
|
|
54
54
|
const [originOwner, originRepository] = originRepo;
|
|
55
55
|
const newBranchName = `${imageName}-${newTag}-${Utils.generateShortId()}`;
|
|
@@ -111,29 +111,11 @@ 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
|
-
|
|
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
|
-
},
|
|
114
|
+
await this.mergePr({
|
|
115
|
+
prId: pr.number,
|
|
116
|
+
owner: manifestOwner,
|
|
117
|
+
repository: manifestRepository,
|
|
133
118
|
});
|
|
134
|
-
if (!merged) {
|
|
135
|
-
throw new Error(`Failed to merge PR #${pr.number} after ${mergeAttempts} attempts`, { cause: lastMergeError });
|
|
136
|
-
}
|
|
137
119
|
}
|
|
138
120
|
async mergePr({ prId, owner, repository, mergeMethod = "squash", }) {
|
|
139
121
|
await this.client.rest.pulls.merge({
|
package/package.json
CHANGED