-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28b6d0c
commit d419123
Showing
4 changed files
with
493 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
export SOURCE_ACR="radixdev" | ||
export TARGET_ACR="radixdevdr" | ||
export SOURCE_SUBSCRIPTION_ID="16ede44b-1f74-40a5-b428-46cca9a5741b" | ||
export TARGET_SUBSCRIPTION_ID="939950ec-da7e-4349-8b8d-77d9c278af04" | ||
export SOURCE_RESOURCE_GROUP="common" | ||
|
||
az account set --subscription "${SOURCE_SUBSCRIPTION_ID}" | ||
repos=$(az acr repository list --name "${SOURCE_ACR}" --output tsv | grep radix-) | ||
|
||
import_images() { | ||
local repo=$1 | ||
echo "Processing repository: ${repo}" | ||
tags=$(az acr repository show-tags --name "${SOURCE_ACR}" --subscription "${SOURCE_SUBSCRIPTION_ID}" --repository "${repo}" --orderby time_desc --output tsv | head -n 15) | ||
existing_tags=$(az acr repository show-tags --name "${TARGET_ACR}" --subscription "${TARGET_SUBSCRIPTION_ID}" --repository "${repo}" --orderby time_desc --output tsv) | ||
|
||
for tag in $tags; do | ||
if echo "${existing_tags}" | grep --silent "${tag}"; then | ||
echo "Tag: ${tag} already exists in repository ${repo}. Skipping import." | ||
continue | ||
fi | ||
|
||
echo "Processing tag: ${tag} in repository ${repo}..." | ||
az acr import \ | ||
--name "${TARGET_ACR}" \ | ||
--source "${repo}:${tag}" \ | ||
--subscription $TARGET_SUBSCRIPTION_ID \ | ||
--registry "/subscriptions/${SOURCE_SUBSCRIPTION_ID}/resourceGroups/${SOURCE_RESOURCE_GROUP}/providers/Microsoft.ContainerRegistry/registries/${SOURCE_ACR}" | ||
done | ||
} | ||
|
||
export -f import_images | ||
|
||
echo $repos | xargs -d ' ' -I'{}' -n1 -P10 bash -c 'import_images {}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
module main | ||
|
||
go 1.21.0 | ||
|
||
require ( | ||
github.com/equinor/radix-operator v1.46.0 | ||
github.com/schollz/progressbar/v3 v3.14.1 | ||
k8s.io/apimachinery v0.27.6 | ||
) | ||
|
||
require ( | ||
dario.cat/mergo v1.0.0 // indirect | ||
github.com/beorn7/perks v1.0.1 // indirect | ||
github.com/cespare/xxhash/v2 v2.2.0 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/emicklei/go-restful/v3 v3.10.2 // indirect | ||
github.com/equinor/radix-common v1.6.2 // indirect | ||
github.com/go-logr/logr v1.2.4 // indirect | ||
github.com/go-openapi/jsonpointer v0.19.6 // indirect | ||
github.com/go-openapi/jsonreference v0.20.2 // indirect | ||
github.com/go-openapi/swag v0.22.4 // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/golang/mock v1.6.0 // indirect | ||
github.com/golang/protobuf v1.5.3 // indirect | ||
github.com/google/gnostic v0.6.9 // indirect | ||
github.com/google/go-cmp v0.5.9 // indirect | ||
github.com/google/gofuzz v1.2.0 // indirect | ||
github.com/google/uuid v1.3.0 // indirect | ||
github.com/imdario/mergo v0.3.13 // indirect | ||
github.com/josharian/intern v1.0.0 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/mailru/easyjson v0.7.7 // indirect | ||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect | ||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect | ||
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.64.1 // indirect | ||
github.com/prometheus-operator/prometheus-operator/pkg/client v0.64.1 // indirect | ||
github.com/prometheus/client_golang v1.16.0 // indirect | ||
github.com/prometheus/client_model v0.4.0 // indirect | ||
github.com/prometheus/common v0.42.0 // indirect | ||
github.com/prometheus/procfs v0.10.1 // indirect | ||
github.com/rivo/uniseg v0.4.4 // indirect | ||
github.com/sirupsen/logrus v1.9.3 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
golang.org/x/crypto v0.14.0 // indirect | ||
golang.org/x/net v0.17.0 // indirect | ||
golang.org/x/oauth2 v0.8.0 // indirect | ||
golang.org/x/sys v0.14.0 // indirect | ||
golang.org/x/term v0.14.0 // indirect | ||
golang.org/x/text v0.13.0 // indirect | ||
golang.org/x/time v0.3.0 // indirect | ||
google.golang.org/appengine v1.6.7 // indirect | ||
google.golang.org/protobuf v1.30.0 // indirect | ||
gopkg.in/inf.v0 v0.9.1 // indirect | ||
gopkg.in/yaml.v2 v2.4.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
k8s.io/api v0.27.6 // indirect | ||
k8s.io/apiextensions-apiserver v0.27.6 // indirect | ||
k8s.io/client-go v0.27.6 // indirect | ||
k8s.io/klog/v2 v2.100.1 // indirect | ||
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect | ||
k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect | ||
sigs.k8s.io/controller-runtime v0.14.6 // indirect | ||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect | ||
sigs.k8s.io/secrets-store-csi-driver v1.3.3 // indirect | ||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect | ||
sigs.k8s.io/yaml v1.3.0 // indirect | ||
) |
Oops, something went wrong.