Detect buildpacks for specific branch (fall back to deploy-branch to be consistent with deployment behavior)
This commit is contained in:
1 parent
e234401178
commit
65e0fb9037
4 files changed
+20
-6
No files matched your search
@@ -64,15 +64,25 @@ func validBuildpackURL(buildpack string) (string, error) {
|
||||
return buildpack, fmt.Errorf("Invalid buildpack specified: %v", buildpack)
|
||||
}
|
||||
|
||||
func checkoutBareGitRepo(sourceWorkDir string) (string, error) {
|
||||
func checkoutBareGitRepo(sourceWorkDir string, branch string) (string, error) {
|
||||
tmpdir, err := os.MkdirTemp("", "bare-git-checkout")
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Unable to create temporary directory: %s", err.Error())
|
||||
}
|
||||
|
||||
args := []string{
|
||||
"--git-dir=" + sourceWorkDir,
|
||||
"--work-tree=" + tmpdir,
|
||||
"checkout", "-f",
|
||||
}
|
||||
|
||||
if branch != "" {
|
||||
args = append(args, branch)
|
||||
}
|
||||
|
||||
result, err := common.CallExecCommand(common.ExecCommandInput{
|
||||
Command: "git",
|
||||
Args: []string{"--git-dir=" + sourceWorkDir, "--work-tree=" + tmpdir, "checkout", "-f"},
|
||||
Args: args,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user