Skip to content

Commit

Permalink
Local PR (#1)
Browse files Browse the repository at this point in the history
* Add Dockerfile for konflux  adoption

* Add shadow-utils and entrypoint

* Add rpms

* Fix file permission issue while doing untar of cache archive.

Remove Entry Point as it is not required.

Fix Unit Test so it runs on machines where /root directory is not present.

update audience in GCS WIF Pipelinerun
  • Loading branch information
pramodbindal committed Oct 16, 2024
1 parent 03047ba commit 7409b33
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dev/pr/gcs-wif-pipelinerun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
projected:
sources:
- serviceAccountToken:
audience: https://iam.googleapis.com/projects/272779626560/locations/global/workloadIdentityPools/openshift-pool/providers/opeshift-wif
audience: openshift
expirationSeconds: 3600
path: token

5 changes: 3 additions & 2 deletions internal/provider/oci/fetch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ func TestFetchInvalidFolder(t *testing.T) {
err = crane.Push(img, fmt.Sprintf("%s/test/crane:%s", u.Host, hash))
assert.NoError(t, err, "Failed to push image to registry")

folder := "/root"
folder := "/tmp/readonly-dir-for-unit-testing"
_ = os.MkdirAll(folder, 0o555)
defer os.RemoveAll(folder)
insecure := false

err = Fetch(context.Background(), hash, target, folder, insecure)

assert.Error(t, err, "Fetch should return an error when folder is not writable")
assert.Contains(t, err.Error(), "permission denied", "Error should indicate permission issues for the folder")
}
Expand Down
4 changes: 4 additions & 0 deletions internal/tar/file-utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ func Tarit(source, target string) error {
return err
}

if info.IsDir() {
header.Mode = 0o755 // create directories with same permissions.
}
header.Name = strings.TrimPrefix(path, source)

if err := tarball.WriteHeader(header); err != nil {
Expand Down Expand Up @@ -70,6 +73,7 @@ func Tarit(source, target string) error {
}

func Untar(ctx context.Context, file *os.File, target string) error {
log.Printf("Untaring file %s to %s", file.Name(), target)
f, err := os.Open(file.Name())
if err != nil {
return err
Expand Down
2 changes: 0 additions & 2 deletions openshift/dockerfiles/cache.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,3 @@ LABEL \
RUN microdnf install -y shadow-utils
RUN groupadd -r -g 65532 nonroot && useradd --no-log-init -r -u 65532 -g nonroot nonroot
USER 65532

ENTRYPOINT ["/ko-app/cache"]

0 comments on commit 7409b33

Please sign in to comment.