diff --git a/pods/external/README.md b/pods/external/README.md new file mode 100644 index 0000000000..3d63d1fe74 --- /dev/null +++ b/pods/external/README.md @@ -0,0 +1,27 @@ +# External Pods Integration + +A container for integrating external Docker images into the build process. + +Implements two entry points consumed by the Rush build process: "docker:build" and "docker:push". + +## docker:build + +Imports external images into the local registry. The `services.d/` directory contains files that describe external images. A 'local' tag is applied to imported images. + +## docker:push + +Copies external images into the official registry (hardcoreeng). A git-based `git describe --tags --abbrev=0` tag is applied to copied images. + +## Configuration + +Each file in the `services.d/` directory describes a single external image. Only the first line in every file is used. The line should follow this format: + +``` + /: +``` + +If the file name starts with "-", it will be ignored. Lines starting with "#" are also ignored. + +## More information + +More details are available in the [Design Document](https://app.hc.engineering/workbench/platform/document/external-services-build-682232fa8c2a2eb48ffe47d5) diff --git a/pods/external/bin/build.sh b/pods/external/bin/build.sh index 9cc4773fb7..64befdf1bf 100644 --- a/pods/external/bin/build.sh +++ b/pods/external/bin/build.sh @@ -4,16 +4,18 @@ registry=hardcoreeng tag=latest find services.d/ -type f -name "*.service" ! -name "-*" | sort | while read -r file; do - extern=$(cat $file | grep -v -e '^[[:space:]]*$' -e '^#' | head -n 1 | tr -d '[:space:]') + line=$(cat $file | grep -v -e '^[[:space:]]*$' -e '^#' | head -n 1) - if [ ! -z $extern ]; then - repo=$(echo $extern | cut -d'/' -f2 | cut -d':' -f1) - pulled=$(docker pull --quiet $extern) - local=$registry/$repo:$tag + target_repo=$(echo $line | cut -d ' ' -f1 | tr -d '[:space:]') + source=$(echo $line | cut -d ' ' -f2 | tr -d '[:space:]') - docker tag $extern $local + if [ ! -z $target_repo ] && [ ! -z $source ]; then + target=$registry/$target_repo:$tag - echo "Pull&Tag: $pulled -> $local" + docker pull --quiet $source > /dev/null + docker tag $source $target + + echo "Pull&Tag: $source -> $target" fi done diff --git a/pods/external/bin/push.sh b/pods/external/bin/push.sh index cf6cdf6d9d..a3381af167 100644 --- a/pods/external/bin/push.sh +++ b/pods/external/bin/push.sh @@ -4,14 +4,17 @@ registry=hardcoreeng tag=$(git describe --tags --abbrev=0) find services.d/ -type f -name "*.service" ! -name "-*" | sort | while read -r file; do - extern=$(cat $file | grep -v -e '^[[:space:]]*$' -e '^#' | head -n 1 | tr -d '[:space:]') + line=$(cat $file | grep -v -e '^[[:space:]]*$' -e '^#' | head -n 1) - if [ ! -z $extern ]; then - repo=$(echo $extern | cut -d'/' -f2 | cut -d':' -f1) - local=$registry/$repo:$tag - docker buildx imagetools create --tag $local $extern + target_repo=$(echo $line | cut -d ' ' -f1 | tr -d '[:space:]') + source=$(echo $line | cut -d ' ' -f2 | tr -d '[:space:]') - echo "Copy: $extern -> $local" + if [ ! -z $target_repo ] && [ ! -z $source ]; then + target=$registry/$target_repo:$tag + + docker buildx imagetools create --tag $target $source + + echo "Copy: $source -> $target" fi done diff --git a/pods/external/services.d/hulykvs.service b/pods/external/services.d/hulykvs.service index d4f16a738b..0cb9d8ed76 100644 --- a/pods/external/services.d/hulykvs.service +++ b/pods/external/services.d/hulykvs.service @@ -1 +1 @@ -aristov/hulykvs:0.1.1 +hulykvs hardcoreeng/service_hulykvs:0.2.0