score-spec / score-go

Reference library for parsing and loading Score files
Apache License 2.0
26 stars 6 forks source link

Import of provisioners from private OCI registry/image #60

Open 7h3-3mp7y-m4n opened 5 days ago

7h3-3mp7y-m4n commented 5 days ago

Description

Added the docker login support

as mentioned here: https://github.com/oras-project/oras-go/blob/main/example_test.go#L106

What does this PR do?

This PR supports dynamic login which uses $DOCKER_CONFIG/config.json for login..

Types of changes

Checklist:

7h3-3mp7y-m4n commented 4 days ago

the following code was added from https://github.com/oras-project/oras-go/blob/main/example_test.go#L122 while the old test cases tested it, it spits no error, so adding some logged output showed some clarity ... === RUN ExampleGetFile_oci_https 2024/11/20 00:24:49 Starting getOci for URL: oci://ghcr.io/score-spec/score-compose-community-provisioners:v0.1.0#00-service.provisioners.yaml 2024/11/20 00:24:49 Parsed reference: ghcr.io/score-spec/score-compose-community-provisioners:v0.1.0, with tag: v0.1.0 2024/11/20 00:24:49 Specified file from fragment: 00-service.provisioners.yaml 2024/11/20 00:24:49 Docker credentials successfully loaded 2024/11/20 00:24:49 Connected to remote repository: ghcr.io/score-spec/score-compose-community-provisioners:v0.1.0 2024/11/20 00:24:49 Fetching manifest for reference: v0.1.0 2024/11/20 00:24:50 Manifest fetched and decoded successfully 2024/11/20 00:24:50 Searching for YAML files in manifest layers 2024/11/20 00:24:50 Checking layer: 00-redis-dapr-state-store.provisioners.yaml 2024/11/20 00:24:50 Found YAML file: 00-redis-dapr-state-store.provisioners.yaml (count: 1) 2024/11/20 00:24:50 Checking layer: 00-service.provisioners.yaml 2024/11/20 00:24:50 Found YAML file: 00-service.provisioners.yaml (count: 2) 2024/11/20 00:24:50 Selected layer for file: 00-service.provisioners.yaml 2024/11/20 00:24:50 Fetching blob for layer: sha256:be27ce16ed6916c35fe0a08f56c4a86e884d6b40a8273c6031d6d772a8fccfb0 2024/11/20 00:24:50 Reading blob content with limit: 1073741824 bytes 2024/11/20 00:24:50 Successfully read 231 bytes from file: 00-service.provisioners.yaml 2024/11/20 00:24:51 Read 231 bytes from GET https://github.com/score-spec/community-provisioners/raw/v0.1.0/score-compose/00-service.provisioners.yaml --- PASS: ExampleGetFile_oci_https (2.11s) I haven't tested it yet with a private repository, I'll update it according and add a test case for it as well