initial commit
All checks were successful
Test skopeo-copy action / test-process (push) Successful in 54s
All checks were successful
Test skopeo-copy action / test-process (push) Successful in 54s
This commit is contained in:
commit
2f92497d27
19
.gitea/workflows/testwf.yaml
Executable file
19
.gitea/workflows/testwf.yaml
Executable file
@ -0,0 +1,19 @@
|
||||
name: Test skopeo-copy action
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
test-process:
|
||||
runs-on: alt-p10
|
||||
steps:
|
||||
- name: Run skopeo action
|
||||
uses: actions/skopeo-copy@master
|
||||
with:
|
||||
source: gitea.basealt.ru/alt
|
||||
source-proto: docker://
|
||||
dest: gitea.basealt.ru/images_repo
|
||||
dest-proto: docker://
|
||||
dest-login: ${{ secrets.PODMAN_USER }}
|
||||
dest-pass: ${{ secrets.PODMAN_PASS }}
|
||||
tags: latest
|
||||
images: alt
|
||||
args: -a
|
53
action.yaml
Normal file
53
action.yaml
Normal file
@ -0,0 +1,53 @@
|
||||
# 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 }}
|
27
copy.sh
Executable file
27
copy.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
source=$1
|
||||
dest=$2
|
||||
args=${3:-"-a"}
|
||||
images=$4
|
||||
tags=$5
|
||||
|
||||
echo "source=$1"
|
||||
echo "dest=$2"
|
||||
echo "args=$3"
|
||||
echo "images=$4"
|
||||
echo "tags=$5"
|
||||
|
||||
images=$(echo $images | jq -R 'split(",")' 2> /dev/null)
|
||||
tags=$(echo $tags | jq -R 'split(",")' 2> /dev/null)
|
||||
|
||||
for IM in $(echo $images | jq '.[]' -r 2> /dev/null | xargs)
|
||||
do
|
||||
extags=$(skopeo list-tags $source/$IM | jq '.Tags.[]' -r 2> /dev/null | xargs)
|
||||
for TAG in $(echo $tags | jq '.[]' -r 2> /dev/null | xargs)
|
||||
do
|
||||
if echo $extags | grep $TAG 2> /dev/null
|
||||
then skopeo copy $args $source/$IM:$TAG $dest/$IM:$TAG
|
||||
fi
|
||||
done
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user