33set -e
44set -u
55
6+ if [ " $( uname -s) " = " Darwin" ]; then
7+ for cmd in gsed gstat gtar ; do
8+ if ! command -v $cmd & > /dev/null; then
9+ echo " Please install $cmd . You can do this via 'brew install $cmd '"
10+ exit 1
11+ fi
12+ done
13+
14+ sed () { gsed " $@ " ; }
15+ stat () { gstat " $@ " ; }
16+ tar () { gtar " $@ " ; }
17+
18+ export -f sed tar stat
19+ fi
20+
621PWD=$( pwd)
722BUILD_ROOT=${PWD} /_build
823ISO_ROOT=${BUILD_ROOT} /root
@@ -22,13 +37,13 @@ source ${VERSION_FILE}
2237GIT_REVISION=$( git describe --long --always --tags --dirty)
2338ISO=${BUILD_ROOT} /${PRODUCT_LOWERNAME} -${VERSION_FULL} .iso
2439
25- DOCKER=docker
26- DOCKER_OPTS=
2740HARDLINK=hardlink
28- OPERATOR_SDK=operator-sdk
29- OPERATOR_SDK_OPTS=
41+ command -v $HARDLINK > /dev/null 2>&1 || HARDLINK=" $( brew --prefix util-linux) /bin/hardlink"
42+
43+ DOCKER=docker
44+ DOCKER_OPTS=" --platform linux/amd64"
3045SKOPEO=skopeo
31- SKOPEO_OPTS=" --override-os linux --insecure-policy"
46+ SKOPEO_OPTS=" --override-os linux --override-arch amd64 -- insecure-policy"
3247
3348export SOLUTION_REGISTRY=metalk8s-registry-from-config.invalid/${PRODUCT_LOWERNAME} -${VERSION_FULL}
3449
@@ -69,7 +84,7 @@ function flatten_source_images()
6984{
7085 source <( ${REPOSITORY_DIR} /solution/kafka_build_vars.sh )
7186
72- yq eval ' .* | (.sourceRegistry // "docker.io") + "/" + .image + ":" + .tag' deps.yaml |
87+ yq eval ' .* | select(.image) | (.sourceRegistry // "docker.io") + "/" + .image + ":" + .tag' deps.yaml |
7388 sed ' /ghcr.io\/scality\/zenko\/kafka/ s/$/-' " ${BUILD_TREE_HASH} " ' /'
7489}
7590
@@ -107,7 +122,7 @@ function copy_yamls()
107122 mv $file ${file% .yaml} _crd.yaml
108123 done
109124 kustomize build " ${zenko_operator_repo} /config/artesca-solution/rbac?ref=$( zenko_operator_tag) " |
110- docker run --rm -i ryane/kfilt:v0.0.5 -k Role,ClusterRole > ${deploy_dir} /role.yaml
125+ docker run ${DOCKER_OPTS} --rm -i ryane/kfilt:v0.0.5 -k Role,ClusterRole > ${deploy_dir} /role.yaml
111126
112127 env $( dependencies_versions_env) envsubst < zenkoversion.yaml > ${ISO_ROOT} /zenkoversion.yaml
113128
@@ -118,7 +133,7 @@ function copy_yamls()
118133function copy_docker_image()
119134{
120135 IMAGE_NAME=${1##*/ }
121- IMAGE_TRANSPORT=${2:- docker:// }
136+ IMAGE_TRANSPORT=${2:- docker-daemon : }
122137 FULL_PATH=${IMAGES_ROOT} /${IMAGE_NAME/:/ \/ }
123138 mkdir -p ${FULL_PATH}
124139 ${SKOPEO} ${SKOPEO_OPTS} copy \
@@ -208,7 +223,7 @@ function get_local_dashboards()
208223
209224function get_component_dashboards()
210225{
211- components=$( yq eval ' .* | select(has(" dashboard") ) | .sourceRegistry + "/" + .dashboard + ":" + .tag' deps.yaml)
226+ components=$( yq eval ' .* | select(. dashboard) | .sourceRegistry + "/" + .dashboard + ":" + .tag' deps.yaml)
212227
213228 for dashboard in ${components}
214229 do
@@ -225,7 +240,7 @@ function get_dashboards()
225240
226241function copy_iam_policies()
227242{
228- components=$( yq eval ' .* | select(has(" policy") ) | .sourceRegistry + "/" + .policy + ":" + .tag' deps.yaml)
243+ components=$( yq eval ' .* | select(. policy) | .sourceRegistry + "/" + .policy + ":" + .tag' deps.yaml)
229244
230245 for policy in ${components}
231246 do
@@ -237,7 +252,7 @@ function copy_iam_policies()
237252
238253function copy_config()
239254{
240- components=$( yq eval ' .* | select(.config != "" ) | .sourceRegistry + "/" + .config + ":" + .tag' deps.yaml)
255+ components=$( yq eval ' .* | select(.config) | .sourceRegistry + "/" + .config + ":" + .tag' deps.yaml)
241256
242257 for config in ${components}
243258 do
@@ -265,7 +280,7 @@ function build_registry_config()
265280 --server-root ' {{ registry_root }}' \
266281 --omit-constants \
267282 /var/lib/images > ${ISO_ROOT} /registry-config.inc.j2
268- rm ${ISO_ROOT} /static-container-registry.conf -f
283+ rm -f ${ISO_ROOT} /static-container-registry.conf
269284}
270285
271286function build_iso()
@@ -294,7 +309,7 @@ function build_iso()
294309function download_tools()
295310{
296311 # Download every tool
297- yq eval ' .[] | select(has(" toolUrl") ) | .toolUrl + " " + .tag + " " + .toolName + " " + .envsubst' deps.yaml | \
312+ yq eval ' .[] | select(. toolUrl) | .toolUrl + " " + .tag + " " + .toolName + " " + .envsubst' deps.yaml | \
298313 while read -r url tag toolName envsubst; do
299314 (
300315 url=" $( env " $envsubst =$tag " envsubst " \$ $envsubst " <<< " $url" ) "
@@ -333,7 +348,7 @@ gen_manifest_yaml
333348copy_yamls
334349flatten_source_images | while read img ; do
335350 # only pull if the image isnt already local
336- ${DOCKER} image inspect ${img} > /dev/null 2>&1 || ${DOCKER} ${DOCKER_OPTS} pull ${img}
351+ ${DOCKER} image inspect ${img} > /dev/null 2>&1 || ${DOCKER} pull ${DOCKER_OPTS} ${img}
337352 copy_docker_image ${img}
338353done
339354get_dashboards
0 commit comments