@tahminator/pipeline 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gh/pr/index.d.ts +1 -2
- package/dist/gh/pr/index.js +8 -8
- package/dist/gh/tag/index.d.ts +2 -1
- package/dist/gh/tag/index.js +4 -1
- package/package.json +1 -1
package/dist/gh/pr/index.d.ts
CHANGED
|
@@ -26,8 +26,7 @@ export declare class GitHubPRManager {
|
|
|
26
26
|
* newTag: a70ee0e
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
updateK8sTagWithPR({
|
|
30
|
-
client: Octokit;
|
|
29
|
+
updateK8sTagWithPR({ newTag, imageName, kustomizationFilePath, environment, originRepo, manifestRepo, }: {
|
|
31
30
|
newTag: string;
|
|
32
31
|
imageName: string;
|
|
33
32
|
kustomizationFilePath: string;
|
package/dist/gh/pr/index.js
CHANGED
|
@@ -29,27 +29,27 @@ export class GitHubPRManager {
|
|
|
29
29
|
* newTag: a70ee0e
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
async updateK8sTagWithPR({
|
|
32
|
+
async updateK8sTagWithPR({ newTag, imageName, kustomizationFilePath, environment, originRepo, manifestRepo, }) {
|
|
33
33
|
const [manifestOwner, manifestRepository] = manifestRepo;
|
|
34
34
|
const [originOwner, originRepository] = originRepo;
|
|
35
35
|
const newBranchName = `${imageName}-${newTag}-${Utils.generateShortId()}`;
|
|
36
|
-
const { data: repo } = await client.rest.repos.get({
|
|
36
|
+
const { data: repo } = await this.client.rest.repos.get({
|
|
37
37
|
owner: manifestOwner,
|
|
38
38
|
repo: manifestRepository,
|
|
39
39
|
});
|
|
40
40
|
const baseBranch = repo.default_branch;
|
|
41
|
-
const { data: ref } = await client.rest.git.getRef({
|
|
41
|
+
const { data: ref } = await this.client.rest.git.getRef({
|
|
42
42
|
owner: manifestOwner,
|
|
43
43
|
repo: manifestRepository,
|
|
44
44
|
ref: `heads/${baseBranch}`,
|
|
45
45
|
});
|
|
46
|
-
await client.rest.git.createRef({
|
|
46
|
+
await this.client.rest.git.createRef({
|
|
47
47
|
owner: manifestOwner,
|
|
48
48
|
repo: manifestRepository,
|
|
49
49
|
ref: `refs/heads/${newBranchName}`,
|
|
50
50
|
sha: ref.object.sha,
|
|
51
51
|
});
|
|
52
|
-
const { data: file } = await client.rest.repos.getContent({
|
|
52
|
+
const { data: file } = await this.client.rest.repos.getContent({
|
|
53
53
|
owner: manifestOwner,
|
|
54
54
|
repo: manifestRepository,
|
|
55
55
|
path: kustomizationFilePath,
|
|
@@ -74,7 +74,7 @@ export class GitHubPRManager {
|
|
|
74
74
|
targetImage.newTag = newTag;
|
|
75
75
|
doc.set("images", yamlObj.images);
|
|
76
76
|
const updatedYaml = doc.toString();
|
|
77
|
-
await client.rest.repos.createOrUpdateFileContents({
|
|
77
|
+
await this.client.rest.repos.createOrUpdateFileContents({
|
|
78
78
|
owner: manifestOwner,
|
|
79
79
|
repo: manifestRepository,
|
|
80
80
|
path: kustomizationFilePath,
|
|
@@ -83,7 +83,7 @@ export class GitHubPRManager {
|
|
|
83
83
|
sha: file.sha,
|
|
84
84
|
branch: newBranchName,
|
|
85
85
|
});
|
|
86
|
-
const { data: pr } = await client.rest.pulls.create({
|
|
86
|
+
const { data: pr } = await this.client.rest.pulls.create({
|
|
87
87
|
owner: manifestOwner,
|
|
88
88
|
repo: manifestRepository,
|
|
89
89
|
title: `Deploying ${newTag} for ${imageName} in ${environment}`,
|
|
@@ -91,7 +91,7 @@ export class GitHubPRManager {
|
|
|
91
91
|
base: baseBranch,
|
|
92
92
|
body: `Automated image tag change to ${newTag} for ${imageName} in ${environment} triggered by [${originOwner}/${originRepository}](https://github.com/${originOwner}/${originRepository}).`,
|
|
93
93
|
});
|
|
94
|
-
await client.rest.pulls.merge({
|
|
94
|
+
await this.client.rest.pulls.merge({
|
|
95
95
|
owner: manifestOwner,
|
|
96
96
|
repo: manifestRepository,
|
|
97
97
|
pull_number: pr.number,
|
package/dist/gh/tag/index.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ import semver from "semver";
|
|
|
3
3
|
import type { OwnerString, RepoString } from "../../types";
|
|
4
4
|
export declare class GitHubTagManager {
|
|
5
5
|
private readonly client;
|
|
6
|
-
readonly isExplicitToken
|
|
6
|
+
private readonly isExplicitToken;
|
|
7
7
|
private static readonly BASE_VERSION;
|
|
8
8
|
constructor(client: Octokit, isExplicitToken: boolean);
|
|
9
|
+
private checkToken;
|
|
9
10
|
/**
|
|
10
11
|
* Utilizes the GitHub API to create a new tag version in the given repository.
|
|
11
12
|
*
|
package/dist/gh/tag/index.js
CHANGED
|
@@ -8,7 +8,9 @@ export class GitHubTagManager {
|
|
|
8
8
|
constructor(client, isExplicitToken) {
|
|
9
9
|
this.client = client;
|
|
10
10
|
this.isExplicitToken = isExplicitToken;
|
|
11
|
-
|
|
11
|
+
}
|
|
12
|
+
checkToken() {
|
|
13
|
+
if (!this.isExplicitToken) {
|
|
12
14
|
throw new Error("You must pass in an explicit GitHub token for this operation. You may either use a PAT or a GitHub App Token");
|
|
13
15
|
}
|
|
14
16
|
}
|
|
@@ -20,6 +22,7 @@ export class GitHubTagManager {
|
|
|
20
22
|
* a GitHub PAT.
|
|
21
23
|
*/
|
|
22
24
|
async createTag({ repositoryOverride, releaseType, onPreTagCreate, }) {
|
|
25
|
+
this.checkToken();
|
|
23
26
|
const repositoryEnv = (() => {
|
|
24
27
|
const v = process.env.GITHUB_REPOSITORY;
|
|
25
28
|
return v;
|