Skip to content

Commit

Permalink
Merge pull request #291 from borg-land/fast-marker-patch
Browse files Browse the repository at this point in the history
Publish the marker inside the fast folder
  • Loading branch information
k8s-ci-robot authored Dec 20, 2023
2 parents 44a2ea8 + f1467e0 commit e707968
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
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)

0 comments on commit e707968

Please sign in to comment.