From 6c355a90a6533f90cbfe3acbc1b0c98e3c0f12aa Mon Sep 17 00:00:00 2001 From: Stefen Allen Date: Tue, 3 Oct 2023 10:22:08 -0600 Subject: [PATCH 1/2] Removing hidden characters in regsync-split.rb added ruby to GHA --- .github/workflows/regsync-config.yaml | 19 ++++++++++++++++++- regsync-split.rb | 10 +++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/regsync-config.yaml b/.github/workflows/regsync-config.yaml index 55ad0a15ad..401edbf210 100644 --- a/.github/workflows/regsync-config.yaml +++ b/.github/workflows/regsync-config.yaml @@ -21,6 +21,9 @@ jobs: - uses: actions/checkout@v3 with: token: ${{ secrets.PUSH_TOKEN }} + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' # Not needed with a .ruby-version file # Need to remove export version once rancher/charts gets the latest version # of charts-build-script binary. @@ -42,4 +45,18 @@ jobs: git branch sleep 30 git push - + + - name: Install Regsync + run: | + curl --silent --fail --location --output regsync https://github.com/regclient/regclient/releases/download/v0.5.1/regsync-linux-amd64 + chmod +x regsync + + - name: Sync Images to Registry + run: | + head regsync.yaml + ruby ./regsync-split.rb + time find regsync -type f -name regsync.yaml -print -exec time regsync check --config '{}' ';' + env: + REGISTRY_ENDPOINT: ${{ secrets.REGISTRY_ENDPOINT }} + REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} \ No newline at end of file diff --git a/regsync-split.rb b/regsync-split.rb index 197ed2f1f0..50a0bf6b6f 100644 --- a/regsync-split.rb +++ b/regsync-split.rb @@ -1,19 +1,19 @@ #! /usr/bin/env ruby -​ + require "json" require "pathname" require "yaml" -​ + pwd = Pathname(Dir.pwd) -​ + regsync = YAML.load((pwd + "regsync.yaml").read) -​ + regsync["sync"].sum do |sync| sync["tags"]["allow"].count end.then do |sum| puts "total tags to consider: #{sum}" end -​ + regsync["sync"].each do |sync| regsync.merge("sync" => [sync]).then do |regsync| (pwd + "regsync" + sync["source"]).then do |dir| From 9745ae7ee2a2deb70f527255b57b9d6a5cba875f Mon Sep 17 00:00:00 2001 From: Stefen Allen Date: Tue, 3 Oct 2023 10:38:36 -0600 Subject: [PATCH 2/2] removing sleep --- .github/workflows/regsync-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/regsync-config.yaml b/.github/workflows/regsync-config.yaml index 401edbf210..746a2efa46 100644 --- a/.github/workflows/regsync-config.yaml +++ b/.github/workflows/regsync-config.yaml @@ -43,7 +43,6 @@ jobs: git add regsync.yaml git commit -m "Updating resync.yaml" git branch - sleep 30 git push - name: Install Regsync