fix wf and action call script
All checks were successful
Test skopeo-copy action / test-process (push) Successful in 58s
All checks were successful
Test skopeo-copy action / test-process (push) Successful in 58s
This commit is contained in:
parent
2f92497d27
commit
7413f9183a
@ -1,12 +1,23 @@
|
|||||||
name: Test skopeo-copy action
|
name: Test skopeo-copy action
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-process:
|
test-process:
|
||||||
runs-on: alt-p10
|
runs-on: alt-p10
|
||||||
steps:
|
steps:
|
||||||
|
- name: Update and install apt rpm
|
||||||
|
run: |
|
||||||
|
echo "apt-get update -y"
|
||||||
|
apt-get update -y
|
||||||
|
- name: Install reqier-s
|
||||||
|
run: |
|
||||||
|
echo "apt-get install -y skopeo jq"
|
||||||
|
apt-get install -y skopeo jq
|
||||||
- name: Run skopeo action
|
- name: Run skopeo action
|
||||||
uses: actions/skopeo-copy@master
|
uses: actions/skopeo-copy@v1
|
||||||
with:
|
with:
|
||||||
source: gitea.basealt.ru/alt
|
source: gitea.basealt.ru/alt
|
||||||
source-proto: docker://
|
source-proto: docker://
|
53
action.yaml
53
action.yaml
@ -1,53 +0,0 @@
|
|||||||
# action.yml
|
|
||||||
name: 'Skopeo copy action'
|
|
||||||
description: 'Copy images from repo to repo'
|
|
||||||
inputs:
|
|
||||||
source:
|
|
||||||
required: true
|
|
||||||
description: 'Source repository name / path. Example: github.com/exam/ple'
|
|
||||||
source-proto:
|
|
||||||
required: false
|
|
||||||
description: 'Source protocol. Example: docker://, dir:'
|
|
||||||
default: docker://
|
|
||||||
dest:
|
|
||||||
required: true
|
|
||||||
description: 'Destination repository name / path. Example: github.com/exam/ple'
|
|
||||||
dest-proto:
|
|
||||||
required: false
|
|
||||||
description: 'Destination protocol. Example: docker://, dir:'
|
|
||||||
default: docker://
|
|
||||||
dest-login:
|
|
||||||
required: true
|
|
||||||
description: 'Destination login'
|
|
||||||
dest-pass:
|
|
||||||
required: true
|
|
||||||
description: 'Destination pass'
|
|
||||||
images:
|
|
||||||
required: true
|
|
||||||
description: 'List of images in json format. Example: [ "first", "second" ]'
|
|
||||||
tags:
|
|
||||||
required: true
|
|
||||||
description: 'List of tags in source for coping in json format, like images'
|
|
||||||
args:
|
|
||||||
required: false
|
|
||||||
description: 'Argument for skopeo-copy command'
|
|
||||||
default: -a
|
|
||||||
runs:
|
|
||||||
using: 'composite'
|
|
||||||
steps:
|
|
||||||
- name: Update and install apt rpm
|
|
||||||
run: |
|
|
||||||
echo "apt-get update -y"
|
|
||||||
apt-get update -y
|
|
||||||
- name: Install reqier-s
|
|
||||||
run: |
|
|
||||||
echo "apt-get install -y skopeo jq"
|
|
||||||
apt-get install -y skopeo jq
|
|
||||||
- name: Login skopeo
|
|
||||||
run: |
|
|
||||||
echo "skopeo login --username ${{ inputs.dest-login }} --password ${{ inputs.dest-pass }} ${{ inputs.dest }}"
|
|
||||||
skopeo login --username ${{ inputs.dest-login }} --password ${{ inputs.dest-pass }} ${{ inputs.dest }}
|
|
||||||
- name: Copy images
|
|
||||||
run: |
|
|
||||||
echo "${GITHUB_ACTION_PATH}/copy.sh ${{ inputs.source-proto }}${{ inputs.source }} ${{ inputs.dest-proto }}${{ inputs.dest }} ${{ inputs.args }} ${{ inputs.images }} ${{ inputs.tags }}"
|
|
||||||
${GITHUB_ACTION_PATH}/copy.sh ${{ inputs.source-proto }}${{ inputs.source }} ${{ inputs.dest-proto }}${{ inputs.dest }} ${{ inputs.args }} ${{ inputs.images }} ${{ inputs.tags }}
|
|
42
action.yml
Normal file
42
action.yml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# action.yml
|
||||||
|
name: 'Skopeo copy action'
|
||||||
|
description: 'Copy images from repo to repo'
|
||||||
|
inputs:
|
||||||
|
source:
|
||||||
|
description: 'Source repository name or path'
|
||||||
|
required: true
|
||||||
|
source-proto:
|
||||||
|
description: 'Source protocol'
|
||||||
|
default: docker://
|
||||||
|
required: false
|
||||||
|
dest:
|
||||||
|
description: 'Destination repository name or path'
|
||||||
|
required: true
|
||||||
|
dest-proto:
|
||||||
|
description: 'Destination protocol'
|
||||||
|
default: docker://
|
||||||
|
required: false
|
||||||
|
dest-login:
|
||||||
|
description: 'Destination login'
|
||||||
|
required: true
|
||||||
|
dest-pass:
|
||||||
|
description: 'Destination pass'
|
||||||
|
required: true
|
||||||
|
images:
|
||||||
|
description: 'List of images in json format. Example: first,second'
|
||||||
|
required: true
|
||||||
|
tags:
|
||||||
|
description: 'List of tags in source for coping in json format, like images'
|
||||||
|
required: true
|
||||||
|
args:
|
||||||
|
description: 'Argument for skopeo-copy command'
|
||||||
|
default: -a
|
||||||
|
required: false
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Login skopeo
|
||||||
|
run: skopeo login --username ${{ inputs.dest-login }} --password ${{ inputs.dest-pass }} ${{ inputs.dest }}
|
||||||
|
- name: Copy images
|
||||||
|
shell: bash
|
||||||
|
run: ${GITHUB_ACTION_PATH}/copy.sh ${{ inputs.source-proto }}${{ inputs.source }} ${{ inputs.dest-proto }}${{ inputs.dest }} ${{ inputs.args }} ${{ inputs.images }} ${{ inputs.tags }}
|
7
copy.sh
7
copy.sh
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
source=$1
|
source=$1
|
||||||
dest=$2
|
dest=$2
|
||||||
args=${3:-"-a"}
|
args=${3:-"-a"}
|
||||||
@ -17,11 +16,15 @@ tags=$(echo $tags | jq -R 'split(",")' 2> /dev/null)
|
|||||||
|
|
||||||
for IM in $(echo $images | jq '.[]' -r 2> /dev/null | xargs)
|
for IM in $(echo $images | jq '.[]' -r 2> /dev/null | xargs)
|
||||||
do
|
do
|
||||||
|
echo "start copy image $IM"
|
||||||
|
echo "get all tags for image in source"
|
||||||
extags=$(skopeo list-tags $source/$IM | jq '.Tags.[]' -r 2> /dev/null | xargs)
|
extags=$(skopeo list-tags $source/$IM | jq '.Tags.[]' -r 2> /dev/null | xargs)
|
||||||
for TAG in $(echo $tags | jq '.[]' -r 2> /dev/null | xargs)
|
for TAG in $(echo $tags | jq '.[]' -r 2> /dev/null | xargs)
|
||||||
do
|
do
|
||||||
|
echo "copy tag $TAG"
|
||||||
if echo $extags | grep $TAG 2> /dev/null
|
if echo $extags | grep $TAG 2> /dev/null
|
||||||
then skopeo copy $args $source/$IM:$TAG $dest/$IM:$TAG
|
then skopeo copy $args $source/$IM:$TAG $dest/$IM:$TAG
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
echo "finish with image $IM"
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user