Skip to content

Commit

Permalink
fix template and tag checking
Browse files Browse the repository at this point in the history
  • Loading branch information
tashima42 committed Nov 17, 2023
1 parent 7b2310e commit 6b694ce
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions release/rke2/rke2.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (
updateImageBuildScript = `#!/bin/sh
set -e
REPO_NAME={{ .RepoName }}
REPO_ORG={{ .RepoOrg }}
REPO_ORG={{ .RepoOwner }}
DRY_RUN={{ .DryRun }}
CLONE_DIR={{ .CloneDir }}
NEW_TAG={{ .NewTag }}
Expand Down Expand Up @@ -149,7 +149,7 @@ func UpdateImageBuild(ctx context.Context, ghClient *github.Client, repo, owner,
if _, ok := imageBuildRepos[repo]; !ok {
return errors.New("invalid repo, please review the `imageBuildRepos` map")
}
newTag, err := latestTag(ctx, ghClient, owner, repo)
newTag, err := latestTag(ctx, ghClient, "rancher", "image-build-base")
if err != nil {
return err
}
Expand All @@ -162,19 +162,20 @@ func UpdateImageBuild(ctx context.Context, ghClient *github.Client, repo, owner,
CloneDir: cloneDir,
NewTag: newTag,
}
output, err := exec.RunTemplatedScript(cloneDir, updateImageBuildScriptFileName, updateImageBuildScript, data)
output, err := exec.RunTemplatedScript("/tmp", updateImageBuildScriptFileName, updateImageBuildScript, data)
if err != nil {
return err
}
logrus.Info(output)
if createPR {
prName := "Update hardened build base to " + newTag
logrus.Info("preparing PR")
logrus.Info("PR:\n Name: " + prName + "\n From: " + owner + ":" + branchName + "\n To rancher:master")
if dryRun {
logrus.Info("dry run, PR will not be created")
logrus.Info("PR:\n Name: " + prName + "\n From: " + owner + ":" + branchName + "\n To rancher:master")
return nil
}
logrus.Info("creating pr")
if err := createPRFromRancher(ctx, ghClient, prName, branchName, owner, repo); err != nil {
return err
}
Expand Down

0 comments on commit 6b694ce

Please sign in to comment.