summaryrefslogtreecommitdiff
path: root/.gitlab
diff options
context:
space:
mode:
authorTimo Kösters <timo@koesters.xyz>2022-11-02 16:47:48 +0000
committerTimo Kösters <timo@koesters.xyz>2022-11-02 16:47:48 +0000
commitccdaaceb3311a0972c3c23a11c4a81fa7329518a (patch)
treeb550bcc7086539ad077cccf2684ecd9b4f4dab64 /.gitlab
parente8e0a4dcc5055b24314c02a8b5371effb27e1026 (diff)
parentb37876f3b2280cab122b46f15290979eef355ea3 (diff)
downloadconduit-ccdaaceb3311a0972c3c23a11c4a81fa7329518a.zip
Merge branch 'ci-revamp-2022-10' into 'next'
Fix CI See merge request famedly/conduit!414
Diffstat (limited to '.gitlab')
-rw-r--r--.gitlab/setup-buildx-remote-builders.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/.gitlab/setup-buildx-remote-builders.sh b/.gitlab/setup-buildx-remote-builders.sh
new file mode 100644
index 0000000..29d50dd
--- /dev/null
+++ b/.gitlab/setup-buildx-remote-builders.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+set -eux
+
+# --------------------------------------------------------------------- #
+# #
+# Configures docker buildx to use a remote server for arm building. #
+# Expects $SSH_PRIVATE_KEY to be a valid ssh ed25519 private key with #
+# access to the server $ARM_SERVER_USER@$ARM_SERVER_IP #
+# #
+# This is expected to only be used in the official CI/CD pipeline! #
+# #
+# Requirements: openssh-client, docker buildx #
+# Inspired by: https://depot.dev/blog/building-arm-containers #
+# #
+# --------------------------------------------------------------------- #
+
+cat "$BUILD_SERVER_SSH_PRIVATE_KEY" | ssh-add -
+
+# Test server connections:
+ssh "$ARM_SERVER_USER@$ARM_SERVER_IP" "uname -a"
+ssh "$AMD_SERVER_USER@$AMD_SERVER_IP" "uname -a"
+
+# Connect remote arm64 server for all arm builds:
+docker buildx create \
+ --name "multi" \
+ --driver "docker-container" \
+ --platform "linux/arm64,linux/arm/v7" \
+ "ssh://$ARM_SERVER_USER@$ARM_SERVER_IP"
+
+# Connect remote amd64 server for adm64 builds:
+docker buildx create --append \
+ --name "multi" \
+ --driver "docker-container" \
+ --platform "linux/amd64" \
+ "ssh://$AMD_SERVER_USER@$AMD_SERVER_IP"
+
+docker buildx use multi