-
Notifications
You must be signed in to change notification settings - Fork 26
Route kiln test through docker-virtual registry and refactor test-script generation #643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b910390
Default kiln test to docker-virtual Artifactory path
rizwanreza 9d9fac2
Improve kiln test UX: Dockerfile caching, suite headers, GOMAXPROCS
rizwanreza a59703d
Refactor commands() into testPlan with per-suite exit tracking and su…
rizwanreza edd3cbe
Add --verbose flag: timestamps, quiet npm by default
rizwanreza ba05565
Rename Configuration.RunMetadata to RunStability
rizwanreza 6ca9e9a
Eliminate double decodeEnvironment call in runTest
rizwanreza 15ae184
Decompose runTest into buildTestImage and startAndWaitContainer
rizwanreza b80e9da
Fix GingkoFlags typo: rename to GinkgoFlags
rizwanreza 7c36e19
Move verbose out of testPlan; pass as parameter to script()
rizwanreza 77093c8
Replace fmt.Errorf(\"%s\", detail) with errors.New in checkImageBuild…
rizwanreza ec6287f
Fix errcheck lint: explicitly discard progress write return values
rizwanreza e086957
Fix timestamps in non-verbose summary footer
rizwanreza d219e71
Update --verbose flag description to reflect actual behaviour
rizwanreza 97b16f1
Add NPM virtual proxy
rizwanreza fe19ecb
Use t.Setenv for Artifactory credential cleanup in test
rizwanreza e4db702
Simplify checkImageBuildResponse to take one argument
rizwanreza 2e8ab04
Pass Verbose flag and clean up setupTestRepo in integration test
rizwanreza a1fd222
Merge main and bump Ruby base image to 4.0.3
rizwanreza 19eebd5
Restore verbose image build output in kiln test
rizwanreza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| package commands | ||
|
|
||
| import ( | ||
| "context" | ||
| "io" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
|
|
||
| "github.com/pivotal-cf/kiln/internal/test" | ||
| ) | ||
|
|
||
| func TestTileTest_RequiresArtifactoryCredentials(t *testing.T) { | ||
| t.Setenv("ARTIFACTORY_USERNAME", "") | ||
| t.Setenv("ARTIFACTORY_PASSWORD", "") | ||
|
|
||
| err := NewTileTest().Execute([]string{}) | ||
| require.Error(t, err) | ||
| require.ErrorContains(t, err, "ARTIFACTORY_USERNAME") | ||
| require.ErrorContains(t, err, "kiln test") | ||
| } | ||
|
|
||
| func TestTileTest_RequiresArtifactoryPassword(t *testing.T) { | ||
| t.Setenv("ARTIFACTORY_PASSWORD", "") | ||
|
|
||
| err := NewTileTest().Execute([]string{"-e", "ARTIFACTORY_USERNAME=onlyuser"}) | ||
| require.Error(t, err) | ||
| require.ErrorContains(t, err, "ARTIFACTORY_PASSWORD") | ||
| } | ||
|
|
||
| func TestTileTest_PassesArtifactoryViaEnvironmentToConfiguration(t *testing.T) { | ||
| var captured test.Configuration | ||
| stub := func(_ context.Context, _ io.Writer, c test.Configuration) error { | ||
| captured = c | ||
| return nil | ||
| } | ||
| err := NewTileTestWithCollaborators(io.Discard, stub).Execute([]string{ | ||
| "-e", "ARTIFACTORY_USERNAME=u", | ||
| "-e", "ARTIFACTORY_PASSWORD=p", | ||
| }) | ||
| require.NoError(t, err) | ||
| require.Contains(t, captured.Environment, "ARTIFACTORY_USERNAME=u") | ||
| require.Contains(t, captured.Environment, "ARTIFACTORY_PASSWORD=p") | ||
| } | ||
|
|
||
| func TestTileTest_UsesProcessEnvArtifactoryCredentials(t *testing.T) { | ||
| t.Setenv("ARTIFACTORY_USERNAME", "fromenv") | ||
| t.Setenv("ARTIFACTORY_PASSWORD", "frompass") | ||
|
|
||
| var captured test.Configuration | ||
| stub := func(_ context.Context, _ io.Writer, c test.Configuration) error { | ||
| captured = c | ||
| return nil | ||
| } | ||
| err := NewTileTestWithCollaborators(io.Discard, stub).Execute([]string{}) | ||
| require.NoError(t, err) | ||
| require.Empty(t, captured.Environment) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,52 @@ | ||
| FROM golang AS go-image | ||
| FROM docker.io/pivotalcfreleng/kiln:v0.110.0-rc2 AS kiln | ||
| # Base images: host must match DockerVirtualRegistryHost in internal/test/container.go (AuthConfigs). | ||
| FROM tas-rel-eng-docker-virtual.usw1.packages.broadcom.com/golang AS go-image | ||
| FROM tas-rel-eng-docker-virtual.usw1.packages.broadcom.com/pivotalcfreleng/kiln:v0.110.0-rc2 AS kiln | ||
|
|
||
| FROM ruby:3.4.8 AS builder | ||
| FROM tas-rel-eng-docker-virtual.usw1.packages.broadcom.com/ruby:3.4.8 AS builder | ||
| RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts | ||
|
|
||
| FROM ruby:3.4.8 | ||
| FROM tas-rel-eng-docker-virtual.usw1.packages.broadcom.com/ruby:3.4.8 | ||
|
|
||
| # Install Go | ||
| # ── Stable tools — no credentials; these layers cache across credential rotation ── | ||
|
|
||
| # Go runtime | ||
| COPY --from=go-image /usr/local/go/ /usr/local/go/ | ||
| ENV GOROOT=/usr/local/go/ | ||
| ENV PATH="$GOROOT/bin:/root/go/bin:$PATH" | ||
|
|
||
| # Install Kiln | ||
| # Kiln binary (used by ops-manifest during manifest tests) | ||
| COPY --from=kiln /kiln /usr/local/bin/kiln | ||
|
|
||
| # Install JQ | ||
| RUN apt-get update && apt-get install jq -y | ||
| # System packages (consolidated to one layer; before credentials so they stay cached) | ||
| RUN apt-get update \ | ||
| && apt-get install --no-install-recommends -y jq nodejs npm \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install Ginkgo | ||
| RUN go install github.com/onsi/ginkgo/ginkgo@latest | ||
| # Go toolchain settings — must appear before any `go install` | ||
| # CGO_ENABLED=0: pure-Go build avoids gcc issues on arm64 (e.g. Podman on Apple Silicon). | ||
| ENV GOTOOLCHAIN=local | ||
| ENV CGO_ENABLED=0 | ||
|
|
||
| # Install NodeJS | ||
| RUN apt-get update && apt-get install nodejs npm -y | ||
| # ── Ginkgo — credentials scoped to this RUN only so layers above stay cached ── | ||
| # Pinned to v1.16.5 for reproducibility (last stable v1; tiles using ginkgo v2 use their own binary). | ||
|
|
||
| # Install OpsManifest from Artifactory | ||
| ARG ARTIFACTORY_USERNAME | ||
| ARG ARTIFACTORY_PASSWORD | ||
|
|
||
| RUN GOPROXY=https://${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD}@usw1.packages.broadcom.com/artifactory/api/go/tas-rel-eng-go-virtual \ | ||
| GOSUMDB=off \ | ||
| go install github.com/onsi/ginkgo/ginkgo@v1.16.5 | ||
|
|
||
| # ── ops-manifest gem — credentials exported for gem source registration at build time ── | ||
|
|
||
| ENV ARTIFACTORY_USERNAME=${ARTIFACTORY_USERNAME} | ||
| ENV ARTIFACTORY_PASSWORD=${ARTIFACTORY_PASSWORD} | ||
|
|
||
| RUN gem source -a https://${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD}@usw1.packages.broadcom.com/artifactory/api/gems/tas-rel-eng-gem-dev-local/ | ||
| RUN gem install --verbose ops-manifest -v 0.0.4.pre | ||
|
|
||
| RUN which ops-manifest | ||
|
|
||
| RUN printf '%s\n%s\n' \ | ||
| 'registry=https://${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD}@usw1.packages.broadcom.com/artifactory/api/npm/tis-npm-virtual/' \ | ||
| 'always-auth=true' > /root/.npmrc | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.