Run GitHub Actions on pushes and PRs to main, not master (#1883)
* Run GitHub Actions on pushes and PRs to main, not master * fix go install ecr-login, bump to latest v0.6.0 * master -> main in some integration tests * skip no-ref integration test
This commit is contained in:
parent
1a6b8ce37b
commit
d587122a9d
|
|
@ -2,9 +2,9 @@ name: Build images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ['master']
|
branches: ['main']
|
||||||
push:
|
push:
|
||||||
branches: ['master']
|
branches: ['main']
|
||||||
tags: ['v[0-9]+.[0-9]+.[0-9]+*']
|
tags: ['v[0-9]+.[0-9]+.[0-9]+*']
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ name: Integration tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ['master']
|
branches: ['main']
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ['master']
|
branches: ['main']
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ on:
|
||||||
# Weekly on Saturdays.
|
# Weekly on Saturdays.
|
||||||
- cron: '30 1 * * 6'
|
- cron: '30 1 * * 6'
|
||||||
push:
|
push:
|
||||||
branches: [ main, master ]
|
branches: ['main']
|
||||||
|
|
||||||
# Declare default permissions as read only.
|
# Declare default permissions as read only.
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ name: Unit tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ['master']
|
branches: ['main']
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ['master']
|
branches: ['main']
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ ENV GOBIN=/usr/local/bin
|
||||||
RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr@4cdd60d0f2d8a69bc70933f4d7718f9c4e956ff8
|
RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr@4cdd60d0f2d8a69bc70933f4d7718f9c4e956ff8
|
||||||
|
|
||||||
# Get Amazon ECR credential helper
|
# Get Amazon ECR credential helper
|
||||||
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@v0.5.0
|
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@69c85dc22db6511932bbf119e1a0cc5c90c69a7f # v0.6.0
|
||||||
|
|
||||||
# Get ACR docker env credential helper
|
# Get ACR docker env credential helper
|
||||||
RUN go install github.com/chrismellard/docker-credential-acr-env@09e2b5a8ac86c3ec347b2473e42b34367d8fa419
|
RUN go install github.com/chrismellard/docker-credential-acr-env@09e2b5a8ac86c3ec347b2473e42b34367d8fa419
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ ENV GOBIN=/usr/local/bin
|
||||||
RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr@4cdd60d0f2d8a69bc70933f4d7718f9c4e956ff8
|
RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr@4cdd60d0f2d8a69bc70933f4d7718f9c4e956ff8
|
||||||
|
|
||||||
# Get Amazon ECR credential helper
|
# Get Amazon ECR credential helper
|
||||||
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@v0.5.0
|
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@69c85dc22db6511932bbf119e1a0cc5c90c69a7f # v0.6.0
|
||||||
|
|
||||||
# Get ACR docker env credential helper
|
# Get ACR docker env credential helper
|
||||||
RUN go install github.com/chrismellard/docker-credential-acr-env@09e2b5a8ac86c3ec347b2473e42b34367d8fa419
|
RUN go install github.com/chrismellard/docker-credential-acr-env@09e2b5a8ac86c3ec347b2473e42b34367d8fa419
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ ENV GOBIN=/usr/local/bin
|
||||||
RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr@4cdd60d0f2d8a69bc70933f4d7718f9c4e956ff8
|
RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr@4cdd60d0f2d8a69bc70933f4d7718f9c4e956ff8
|
||||||
|
|
||||||
# Get Amazon ECR credential helper
|
# Get Amazon ECR credential helper
|
||||||
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@v0.5.0
|
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@69c85dc22db6511932bbf119e1a0cc5c90c69a7f # v0.6.0
|
||||||
|
|
||||||
# Get ACR docker env credential helper
|
# Get ACR docker env credential helper
|
||||||
RUN go install github.com/chrismellard/docker-credential-acr-env@09e2b5a8ac86c3ec347b2473e42b34367d8fa419
|
RUN go install github.com/chrismellard/docker-credential-acr-env@09e2b5a8ac86c3ec347b2473e42b34367d8fa419
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ func getBranchCommitAndURL() (branch, commit, url string) {
|
||||||
repo := os.Getenv("GITHUB_REPOSITORY")
|
repo := os.Getenv("GITHUB_REPOSITORY")
|
||||||
commit = os.Getenv("GITHUB_SHA")
|
commit = os.Getenv("GITHUB_SHA")
|
||||||
if _, isPR := os.LookupEnv("GITHUB_HEAD_REF"); isPR {
|
if _, isPR := os.LookupEnv("GITHUB_HEAD_REF"); isPR {
|
||||||
branch = "master"
|
branch = "main"
|
||||||
} else {
|
} else {
|
||||||
branch = os.Getenv("GITHUB_REF")
|
branch = os.Getenv("GITHUB_REF")
|
||||||
log.Printf("GITHUB_HEAD_REF is unset (not a PR); using GITHUB_REF=%q", branch)
|
log.Printf("GITHUB_HEAD_REF is unset (not a PR); using GITHUB_REF=%q", branch)
|
||||||
|
|
@ -213,7 +213,7 @@ func getBranchCommitAndURL() (branch, commit, url string) {
|
||||||
repo = "GoogleContainerTools/kaniko"
|
repo = "GoogleContainerTools/kaniko"
|
||||||
}
|
}
|
||||||
if branch == "" {
|
if branch == "" {
|
||||||
branch = "master"
|
branch = "main"
|
||||||
}
|
}
|
||||||
log.Printf("repo=%q / commit=%q / branch=%q", repo, commit, branch)
|
log.Printf("repo=%q / commit=%q / branch=%q", repo, commit, branch)
|
||||||
url = "github.com/" + repo
|
url = "github.com/" + repo
|
||||||
|
|
@ -266,9 +266,9 @@ func testGitBuildcontextHelper(t *testing.T, repo string) {
|
||||||
checkContainerDiffOutput(t, diff, expected)
|
checkContainerDiffOutput(t, diff, expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestGitBuildcontext explicitly names the master branch
|
// TestGitBuildcontext explicitly names the main branch
|
||||||
// Example:
|
// Example:
|
||||||
// git://github.com/myuser/repo#refs/heads/master
|
// git://github.com/myuser/repo#refs/heads/main
|
||||||
func TestGitBuildcontext(t *testing.T) {
|
func TestGitBuildcontext(t *testing.T) {
|
||||||
repo := getGitRepo(false)
|
repo := getGitRepo(false)
|
||||||
testGitBuildcontextHelper(t, repo)
|
testGitBuildcontextHelper(t, repo)
|
||||||
|
|
@ -278,6 +278,7 @@ func TestGitBuildcontext(t *testing.T) {
|
||||||
// Example:
|
// Example:
|
||||||
// git://github.com/myuser/repo
|
// git://github.com/myuser/repo
|
||||||
func TestGitBuildcontextNoRef(t *testing.T) {
|
func TestGitBuildcontextNoRef(t *testing.T) {
|
||||||
|
t.Skip("Docker's behavior is to assume a 'master' branch, which the Kaniko repo doesn't have")
|
||||||
_, _, url := getBranchCommitAndURL()
|
_, _, url := getBranchCommitAndURL()
|
||||||
testGitBuildcontextHelper(t, url)
|
testGitBuildcontextHelper(t, url)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue