Skip to content

Commit

Permalink
Merge pull request #2185 from hhiroshell/fix-pack-1218
Browse files Browse the repository at this point in the history
Update image references to use fully qualified names.
  • Loading branch information
natalieparellano authored Nov 13, 2024
2 parents 84f661d + fdde5f9 commit 08abcc4
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check-latest-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
id: scan-image
uses: anchore/scan-action@v5
with:
image: buildpacksio/pack:${{ steps.read-go.outputs.latest-release-version }}
image: docker.io/buildpacksio/pack:${{ steps.read-go.outputs.latest-release-version }}
- name: Create issue if needed
if: failure() && steps.scan-image.outcome == 'failure'
env:
Expand All @@ -91,7 +91,7 @@ jobs:
search_output=$(gh issue list --search "$title" --label "$label")
GITHUB_WORKFLOW_URL=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
body="Latest buildpacksio/pack v${{ steps.read-go.outputs.latest-release-version }} triggered CVE(s) from Grype. For further details, see: $GITHUB_WORKFLOW_URL"
body="Latest docker.io/buildpacksio/pack v${{ steps.read-go.outputs.latest-release-version }} triggered CVE(s) from Grype. For further details, see: $GITHUB_WORKFLOW_URL"
if [ -z "${search_output// }" ]
then
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/delivery-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
default: false

env:
REGISTRY_NAME: 'index.docker.io'
REGISTRY_NAME: 'docker.io'
USER_NAME: 'buildpacksio'
IMG_NAME: 'pack'

Expand Down
24 changes: 12 additions & 12 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ make prepare-for-pr
### Acceptance Tests
Some options users can provide to our acceptance tests are:

| ENV_VAR | Description | Default |
|--------------|------------------------------------------------------------------------|---------|
| ACCEPTANCE_SUITE_CONFIG | A set of configurations for how to run the acceptance tests, describing the version of `pack` used for testing, the version of `pack` used to create the builders used in the test, and the version of `lifecycle` binaries used to test with Github | `[{"pack": "current", "pack_create_builder": "current", "lifecycle": "default"}]'` |
| COMPILE_PACK_WITH_VERSION | Tell `pack` what version to consider itself | `dev` |
| GITHUB_TOKEN | A Github Token, used when downloading `pack` and `lifecycle` releases from Github during the test setup | "" |
| LIFECYCLE_IMAGE | Image reference to be used in untrusted builder workflows | buildpacksio/lifecycle:<lifecycle version> |
| LIFECYCLE_PATH | Path to a `.tgz` file filled with a set of `lifecycle` binaries | The Github release for the default version of lifecycle in `pack` |
| PACK_PATH | Path to a `pack` executable. | A compiled version of the current branch |
| PREVIOUS_LIFECYCLE_IMAGE | Image reference to be used in untrusted builder workflows, used to test compatibility of `pack` with the n-1 version of the `lifecycle` | buildpacksio/lifecycle:<PREVIOUS_LIFECYCLE_PATH lifecycle version>, buildpacksio/lifecycle:<n-1 lifecycle version> |
| PREVIOUS_LIFECYCLE_PATH | Path to a `.tgz` file filled with a set of `lifecycle` binaries, used to test compatibility of `pack` with the n-1 version of the `lifecycle` | The Github release for n-1 release of `lifecycle` |
| PREVIOUS_PACK_FIXTURES_PATH | Path to a set of fixtures, used to override the most up-to-date fixtures, in case of changed functionality | `acceptance/testdata/pack_previous_fixtures_overrides` |
| PREVIOUS_PACK_PATH | Path to a `pack` executable, used to test compatibility with n-1 version of `pack` | The most recent release from `pack`'s Github release |
| ENV_VAR | Description | Default |
|--------------|------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| ACCEPTANCE_SUITE_CONFIG | A set of configurations for how to run the acceptance tests, describing the version of `pack` used for testing, the version of `pack` used to create the builders used in the test, and the version of `lifecycle` binaries used to test with Github | `[{"pack": "current", "pack_create_builder": "current", "lifecycle": "default"}]'` |
| COMPILE_PACK_WITH_VERSION | Tell `pack` what version to consider itself | `dev` |
| GITHUB_TOKEN | A Github Token, used when downloading `pack` and `lifecycle` releases from Github during the test setup | "" |
| LIFECYCLE_IMAGE | Image reference to be used in untrusted builder workflows | docker.io/buildpacksio/lifecycle:<lifecycle version> |
| LIFECYCLE_PATH | Path to a `.tgz` file filled with a set of `lifecycle` binaries | The Github release for the default version of lifecycle in `pack` |
| PACK_PATH | Path to a `pack` executable. | A compiled version of the current branch |
| PREVIOUS_LIFECYCLE_IMAGE | Image reference to be used in untrusted builder workflows, used to test compatibility of `pack` with the n-1 version of the `lifecycle` | docker.io/buildpacksio/lifecycle:<PREVIOUS_LIFECYCLE_PATH lifecycle version>, buildpacksio/lifecycle:<n-1 lifecycle version> |
| PREVIOUS_LIFECYCLE_PATH | Path to a `.tgz` file filled with a set of `lifecycle` binaries, used to test compatibility of `pack` with the n-1 version of the `lifecycle` | The Github release for n-1 release of `lifecycle` |
| PREVIOUS_PACK_FIXTURES_PATH | Path to a set of fixtures, used to override the most up-to-date fixtures, in case of changed functionality | `acceptance/testdata/pack_previous_fixtures_overrides` |
| PREVIOUS_PACK_PATH | Path to a `pack` executable, used to test compatibility with n-1 version of `pack` | The most recent release from `pack`'s Github release |
7 changes: 6 additions & 1 deletion internal/commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,12 @@ func isForbiddenTag(cfg config.Config, input, lifecycle, builder string) error {
}
}

if inputImage.Context().RepositoryStr() == config.DefaultLifecycleImageRepo {
defaultLifecycleImageRef, err := name.ParseReference(config.DefaultLifecycleImageRepo)
if err != nil {
return errors.Wrapf(err, "parsing default lifecycle image %s", config.DefaultLifecycleImageRepo)
}

if inputImage.Context().RepositoryStr() == defaultLifecycleImageRef.Context().RepositoryStr() {
return fmt.Errorf("name must not match default lifecycle image name")
}

Expand Down
7 changes: 7 additions & 0 deletions internal/commands/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ func testBuildCommand(t *testing.T, when spec.G, it spec.S) {
h.AssertNotNil(t, command.Execute())
h.AssertContains(t, outBuf.String(), "name must not match default lifecycle image name")
})

it("refuses to build when using fully qualified name", func() {
logger.WantVerbose(true)
command.SetArgs([]string{"docker.io/buildpacksio/lifecycle:test", "--builder", "test", "--trust-builder"})
h.AssertNotNil(t, command.Execute())
h.AssertContains(t, outBuf.String(), "name must not match default lifecycle image name")
})
})

when("the builder is not trusted", func() {
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@ func GetRegistry(cfg Config, registryName string) (Registry, error) {
return Registry{}, errors.Errorf("registry %s is not defined in your config file", style.Symbol(registryName))
}

const DefaultLifecycleImageRepo = "buildpacksio/lifecycle"
const DefaultLifecycleImageRepo = "docker.io/buildpacksio/lifecycle"

0 comments on commit 08abcc4

Please sign in to comment.