From d587122a9d139a2523748d8e1815fd02e7f87061 Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Fri, 14 Jan 2022 14:54:12 -0500 Subject: [PATCH] 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 --- .github/workflows/images.yaml | 4 ++-- .github/workflows/integration-tests.yaml | 4 ++-- .github/workflows/scorecards-analysis.yml | 2 +- .github/workflows/unit-tests.yaml | 4 ++-- deploy/Dockerfile | 2 +- deploy/Dockerfile_debug | 2 +- deploy/Dockerfile_warmer | 2 +- integration/integration_test.go | 9 +++++---- 8 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/images.yaml b/.github/workflows/images.yaml index 344832748..5b045cf4b 100644 --- a/.github/workflows/images.yaml +++ b/.github/workflows/images.yaml @@ -2,9 +2,9 @@ name: Build images on: pull_request: - branches: ['master'] + branches: ['main'] push: - branches: ['master'] + branches: ['main'] tags: ['v[0-9]+.[0-9]+.[0-9]+*'] jobs: diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index ce47f623b..9cb8e97e3 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -2,9 +2,9 @@ name: Integration tests on: push: - branches: ['master'] + branches: ['main'] pull_request: - branches: ['master'] + branches: ['main'] jobs: tests: diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 467088ffc..c1b38e87d 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -6,7 +6,7 @@ on: # Weekly on Saturdays. - cron: '30 1 * * 6' push: - branches: [ main, master ] + branches: ['main'] # Declare default permissions as read only. permissions: read-all diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index ba97b69de..101d5138b 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -2,9 +2,9 @@ name: Unit tests on: push: - branches: ['master'] + branches: ['main'] pull_request: - branches: ['master'] + branches: ['main'] jobs: tests: diff --git a/deploy/Dockerfile b/deploy/Dockerfile index 99e683a4c..93f63705c 100644 --- a/deploy/Dockerfile +++ b/deploy/Dockerfile @@ -26,7 +26,7 @@ ENV GOBIN=/usr/local/bin RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr@4cdd60d0f2d8a69bc70933f4d7718f9c4e956ff8 # 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 RUN go install github.com/chrismellard/docker-credential-acr-env@09e2b5a8ac86c3ec347b2473e42b34367d8fa419 diff --git a/deploy/Dockerfile_debug b/deploy/Dockerfile_debug index ba9a29379..4368361af 100644 --- a/deploy/Dockerfile_debug +++ b/deploy/Dockerfile_debug @@ -26,7 +26,7 @@ ENV GOBIN=/usr/local/bin RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr@4cdd60d0f2d8a69bc70933f4d7718f9c4e956ff8 # 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 RUN go install github.com/chrismellard/docker-credential-acr-env@09e2b5a8ac86c3ec347b2473e42b34367d8fa419 diff --git a/deploy/Dockerfile_warmer b/deploy/Dockerfile_warmer index d6f2fc16c..f55124459 100644 --- a/deploy/Dockerfile_warmer +++ b/deploy/Dockerfile_warmer @@ -26,7 +26,7 @@ ENV GOBIN=/usr/local/bin RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr@4cdd60d0f2d8a69bc70933f4d7718f9c4e956ff8 # 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 RUN go install github.com/chrismellard/docker-credential-acr-env@09e2b5a8ac86c3ec347b2473e42b34367d8fa419 diff --git a/integration/integration_test.go b/integration/integration_test.go index f311be779..c3c75b6c5 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -203,7 +203,7 @@ func getBranchCommitAndURL() (branch, commit, url string) { repo := os.Getenv("GITHUB_REPOSITORY") commit = os.Getenv("GITHUB_SHA") if _, isPR := os.LookupEnv("GITHUB_HEAD_REF"); isPR { - branch = "master" + branch = "main" } else { branch = os.Getenv("GITHUB_REF") 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" } if branch == "" { - branch = "master" + branch = "main" } log.Printf("repo=%q / commit=%q / branch=%q", repo, commit, branch) url = "github.com/" + repo @@ -266,9 +266,9 @@ func testGitBuildcontextHelper(t *testing.T, repo string) { checkContainerDiffOutput(t, diff, expected) } -// TestGitBuildcontext explicitly names the master branch +// TestGitBuildcontext explicitly names the main branch // Example: -// git://github.com/myuser/repo#refs/heads/master +// git://github.com/myuser/repo#refs/heads/main func TestGitBuildcontext(t *testing.T) { repo := getGitRepo(false) testGitBuildcontextHelper(t, repo) @@ -278,6 +278,7 @@ func TestGitBuildcontext(t *testing.T) { // Example: // git://github.com/myuser/repo 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() testGitBuildcontextHelper(t, url) }