mirror of https://github.com/kubernetes/kops.git
Merge pull request #13860 from olemarkus/sha-for-sha
Set Makefile GITSHA to the git sha instead of human 'readable' name
This commit is contained in:
commit
9a3e86ca31
|
|
@ -34,7 +34,7 @@ When a PR builds successfully, you can test the PR using the following script:
|
|||
```sh
|
||||
pr=13208
|
||||
sha=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/kubernetes/kops/pulls/${pr} | jq -r .head.sha )
|
||||
export KOPS_BASE_URL=https://storage.googleapis.com/kops-ci/pulls/pull-kops-e2e-kubernetes-aws/pull-v1.24.0-alpha.2-68-g8a1070a1b9
|
||||
export KOPS_BASE_URL="https://storage.googleapis.com/kops-ci/pulls/pull-kops-e2e-kubernetes-aws/pull-${sha}"
|
||||
wget -q "$KOPS_BASE_URL/$(go env GOOS)/$(go env GOARCH)/kops"
|
||||
chmod +x ./kops
|
||||
./kops version
|
||||
|
|
|
|||
|
|
@ -92,14 +92,17 @@ func defaultStageLocation(kopsRoot string) (string, error) {
|
|||
jobName = defaultJobName
|
||||
}
|
||||
|
||||
cmd := exec.Command("git", "rev-parse", "--short", "HEAD")
|
||||
cmd.SetDir(kopsRoot)
|
||||
output, err := exec.CombinedOutputLines(cmd)
|
||||
if err != nil {
|
||||
return "", err
|
||||
} else if len(output) != 1 {
|
||||
return "", fmt.Errorf("unexpected output from git describe: %v", output)
|
||||
sha := os.Getenv("PULL_PULL_SHA")
|
||||
if sha == "" {
|
||||
cmd := exec.Command("git", "rev-parse", "--short", "HEAD")
|
||||
cmd.SetDir(kopsRoot)
|
||||
output, err := exec.CombinedOutputLines(cmd)
|
||||
if err != nil {
|
||||
return "", err
|
||||
} else if len(output) != 1 {
|
||||
return "", fmt.Errorf("unexpected output from git describe: %v", output)
|
||||
}
|
||||
sha = strings.TrimSpace(output[0])
|
||||
}
|
||||
sha := strings.TrimSpace(output[0])
|
||||
return fmt.Sprintf(defaultGCSPath, jobName, sha), nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue