Skip to content
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

Publish the marker inside the fast folder #291

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions object/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@ func (g *GCS) GetReleasePath(
//
// gs://<bucket>/<gcsRoot>
func (g *GCS) GetMarkerPath(
bucket, gcsRoot string,
bucket, gcsRoot string, fast bool,
) (string, error) {
gcsPath, err := g.getPath(
bucket,
gcsRoot,
"",
"marker",
false,
fast,
)
if err != nil {
return "", fmt.Errorf("normalize GCS path: %w", err)
Expand Down Expand Up @@ -258,6 +258,9 @@ func (g *GCS) getPath(
gcsPathParts = append(gcsPathParts, version)
}
case "marker":
if fast {
gcsPathParts = append(gcsPathParts, "fast")
}
default:
return "", errors.New("a GCS path type must be specified")
}
Expand Down
22 changes: 19 additions & 3 deletions object/gcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,40 @@ func TestGetMarkerPath(t *testing.T) {
bucket, gcsRoot string
expected string
shouldError bool
fast bool
}{
{ // default CI build
bucket: "k8s-release-dev",
gcsRoot: "ci",
expected: "gs://k8s-release-dev/ci",
shouldError: false,
fast: false,
},
{ // default fast CI build
bucket: "k8s-release-dev",
gcsRoot: "ci",
expected: "gs://k8s-release-dev/ci/fast",
shouldError: false,
fast: true,
},
{ // current problematic behaviour
bucket: "k8s-release-dev",
gcsRoot: "ci",
expected: "gs://k8s-release-dev/ci",
shouldError: true,
fast: true,
},
} {
actual, err := testGCS.GetMarkerPath(
tc.bucket,
tc.gcsRoot,
tc.fast,
)

require.Equal(t, tc.expected, actual)

if tc.shouldError {
require.NotNil(t, err)
require.NotEqual(t, tc.expected, actual)
} else {
require.Equal(t, tc.expected, actual)
require.Nil(t, err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion object/objectfakes/fake_store.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion object/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type Store interface {

// TODO: Overly specific. We should only care these methods during a release.
GetReleasePath(bucket, gcsRoot, version string, fast bool) (string, error)
GetMarkerPath(bucket, gcsRoot string) (string, error)
GetMarkerPath(bucket, gcsRoot string, fast bool) (string, error)
}

type OptFn func(Store)