Skip to content

Commit 0108be9

Browse files
authored
feat: add skopeo copy command to transfer image from OCI layout (#4564)
Signed-off-by: maksim.nabokikh <max.nabokih@gmail.com>
1 parent 548b0f5 commit 0108be9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/artifacts.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,19 @@ jobs:
163163
# path: image.tar
164164

165165
- name: Extract OCI tarball
166+
id: extract-oci
166167
run: |
167168
mkdir -p image
168169
tar -xf image.tar -C image
169170
171+
image_name=$(jq -r '.manifests[0].annotations["io.containerd.image.name"]' image/index.json)
172+
image_tag=$(jq -r '.manifests[0].annotations["org.opencontainers.image.ref.name"]' image/index.json)
173+
174+
echo "Copying $image_tag -> $image_name"
175+
skopeo copy "oci:image:$image_tag" "docker-daemon:$image_name"
176+
177+
echo "value=$image_name" >> "$GITHUB_OUTPUT"
178+
170179
# - name: List tags
171180
# run: skopeo --insecure-policy list-tags oci:image
172181
#
@@ -202,8 +211,7 @@ jobs:
202211

203212
- name: Prepare image fs for scanning
204213
run: |
205-
docker load --input image.tar
206-
docker export $(docker create --rm ${{ steps.image-name.outputs.value }}@${{ steps.build.outputs.digest }}) -o docker-image.tar
214+
docker export $(docker create --rm ${{ steps.extract-oci.outputs.value }}) -o docker-image.tar
207215
208216
mkdir -p docker-image
209217
tar -xf docker-image.tar -C docker-image

0 commit comments

Comments
 (0)