Skip to content

Commit

Permalink
Match the input values for artifact type to ones required by
Browse files Browse the repository at this point in the history
gcr.io/cloud-builders/gcs-uploader:latest image.

Also add documentation on gcr.io/cloud-builders/gcs-uploader:latest
supports only Manifest.
  • Loading branch information
tejal29 authored and knative-prow-robot committed Feb 12, 2019
1 parent 8944a07 commit 0ce7d0a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/run/gcs-resource-spec-taskrun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ spec:
- name: location
value: gs://build-crd-tests/rules_docker-master.zip
- name: artifactType
value: archive
value: Archive
- name: type
value: build-gcs
5 changes: 3 additions & 2 deletions pkg/apis/pipeline/v1alpha1/build_gcs_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ type GCSArtifactType string

const (
// GCSArchive indicates that resource should be fetched from a typical archive file.
GCSArchive GCSArtifactType = "archive"
GCSArchive GCSArtifactType = "Archive"

// GCSManifest indicates that resource should be fetched using a
// manifest-based protocol which enables incremental source upload.
GCSManifest GCSArtifactType = "manifest"
GCSManifest GCSArtifactType = "Manifest"

// EmptyArtifactType indicates, no artifact type is specified.
EmptyArtifactType = ""
Expand Down Expand Up @@ -167,6 +167,7 @@ func getArtifactType(val string) (GCSArtifactType, error) {
valid := []string{string(GCSArchive), string(GCSManifest)}
switch aType {
case GCSArchive:
return aType, nil
case GCSManifest:
return aType, nil
case EmptyArtifactType:
Expand Down
14 changes: 7 additions & 7 deletions pkg/apis/pipeline/v1alpha1/build_gcs_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ func Test_Valid_NewBuildGCSResource(t *testing.T) {
Value: "build-gcs",
}, {
Name: "ArtifactType",
Value: "manifest",
Value: "Manifest",
}},
},
}
expectedGCSResource := &BuildGCSResource{
Name: "build-gcs-resource",
Location: "gs://fake-bucket",
Type: PipelineResourceTypeStorage,
ArtifactType: "manifest",
ArtifactType: "Manifest",
}

r, err := NewBuildGCSResource(pr)
Expand Down Expand Up @@ -218,21 +218,21 @@ func Test_BuildGCSGetDownloadContainerSpec(t *testing.T) {
Name: "gcs-valid",
Location: "gs://some-bucket",
DestinationDir: "/workspace",
ArtifactType: "archive",
ArtifactType: "Archive",
},
wantContainers: []corev1.Container{
CreateDirContainer("gcs-valid", "/workspace"), {
Name: "storage-fetch-gcs-valid",
Image: "gcr.io/cloud-builders/gcs-fetcher:latest",
Args: []string{"--type", "archive", "--location", "gs://some-bucket",
Args: []string{"--type", "Archive", "--location", "gs://some-bucket",
"--dest_dir", "/workspace"},
}},
}, {
name: "invalid no destination directory set",
resource: &BuildGCSResource{
Name: "gcs-invalid",
Location: "gs://some-bucket",
ArtifactType: "archive",
ArtifactType: "Archive",
},
wantErr: true,
}}
Expand Down Expand Up @@ -261,7 +261,7 @@ func Test_BuildGCSGetUploadContainerSpec(t *testing.T) {
Name: "gcs-valid",
Location: "gs://some-bucket/manifest.json",
DestinationDir: "/workspace",
ArtifactType: "manifest",
ArtifactType: "Manifest",
},
wantContainers: []corev1.Container{{
Name: "storage-upload-gcs-valid",
Expand All @@ -272,7 +272,7 @@ func Test_BuildGCSGetUploadContainerSpec(t *testing.T) {
name: "invalid upload to protected buckets with single file",
resource: &BuildGCSResource{
Name: "gcs-valid",
ArtifactType: "archive",
ArtifactType: "Archive",
Location: "gs://some-bucket",
DestinationDir: "/workspace/results.tar",
},
Expand Down

0 comments on commit 0ce7d0a

Please sign in to comment.