Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openwrt/docker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Spooren <mail@aparcar.org>2020-07-14 07:57:20 +0300
committerPetr Štetiar <ynezz@true.cz>2020-08-03 10:10:16 +0300
commitab8551250874db17ef551ff5fa5ed8ce869979fd (patch)
treee6e3006905b149d41c2abaeffb87f4d5d4f70205 /docker-sdk.sh
parent570ecf2da54d3cf7a8e1ea0b793e2534a28e3df7 (diff)
dynamic downstream job creation based on targets
Instead of having a hard coded list of available targets, this approach makes use os the dumpinfo.pl script that automatically finds available targets existing in the OpenWrt buildroot. The advantage is to automatically adapt to available targets in different branches. Additionally the tagging of SDK containers is improved. While it is still possible to use SDK based on target tag, it is now also possible to chose the target based on architecutre. This way less SDK container are build as one architecutre covers multiple targets. Signed-off-by: Paul Spooren <mail@aparcar.org>
Diffstat (limited to 'docker-sdk.sh')
-rwxr-xr-xdocker-sdk.sh28
1 files changed, 26 insertions, 2 deletions
diff --git a/docker-sdk.sh b/docker-sdk.sh
index d0860f5..bf6cf43 100755
--- a/docker-sdk.sh
+++ b/docker-sdk.sh
@@ -2,7 +2,9 @@
set -ex
-TARGET=$(echo "$CI_JOB_NAME" | cut -d _ -f 2-)
+ARCH=$(echo "$CI_JOB_NAME" | cut -d _ -f 2-)
+# shellcheck disable=SC2153
+TARGET=$(echo "$TARGETS" | cut -d ' ' -f 1)
export TARGET="${TARGET:-x86-64}"
export BRANCH="${BRANCH:-master}"
export DOCKER_IMAGE="${DOCKER_IMAGE:-openwrt-sdk}"
@@ -16,4 +18,26 @@ fi
export DOWNLOAD_PATH
./docker-download.sh || exit 1
-./docker-build.sh || exit 1
+
+DOCKERFILE="${DOCKERFILE:-Dockerfile}"
+# Copy Dockerfile inside build context to support older Docker versions
+# See https://github.com/docker/cli/pull/886
+cp "$DOCKERFILE" ./build/
+docker build -t "$DOCKER_IMAGE:$ARCH-$BRANCH" -f "./build/$DOCKERFILE" ./build
+
+if [ "$BRANCH" == "master" ]; then
+ docker tag "$DOCKER_IMAGE:$ARCH-$BRANCH" "$DOCKER_IMAGE:$ARCH"
+ if [ "$ARCH" == "x86_64" ]; then
+ docker tag "$DOCKER_IMAGE:$ARCH-$BRANCH" "$DOCKER_IMAGE:latest"
+ fi
+fi
+
+if [ "$ARCH" == "x86_64" ]; then
+ docker tag "$DOCKER_IMAGE:$ARCH-$BRANCH" "$DOCKER_IMAGE:$BRANCH"
+fi
+
+for TARGET_TAG in $TARGETS; do
+ docker tag "$DOCKER_IMAGE:$ARCH-$BRANCH" "$DOCKER_IMAGE:$TARGET_TAG-$BRANCH"
+done
+
+rm -rf ./build