1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 05:19:39 +02:00

feat(compose): upgrade to docker compose v2 EE-2096 (#6994)

Upgrade to compose v2 + new helm + new kubectl
This commit is contained in:
Matt Hook 2022-06-03 13:50:37 +12:00 committed by GitHub
parent aea62723c0
commit e8a8b71daa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 93 additions and 114 deletions

View file

@ -1,23 +1,34 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -ne 3 ]]; then
echo "Illegal number of parameters" >&2
exit 1
fi
PLATFORM=$1
ARCH=$2
DOCKER_VERSION=$3
DOCKER_VERSION=${3:1}
DOWNLOAD_FOLDER=".tmp/download"
if [[ ${ARCH} == "amd64" ]]; then
ARCH="x86_64"
elif [[ ${ARCH} == "arm" ]]; then
ARCH="armhf"
elif [[ ${ARCH} == "arm64" ]]; then
ARCH="aarch64"
fi
rm -rf "${DOWNLOAD_FOLDER}"
mkdir -pv "${DOWNLOAD_FOLDER}"
if [ "${PLATFORM}" == 'win' ]; then
wget -O "${DOWNLOAD_FOLDER}/docker-binaries.zip" "https://dockermsft.azureedge.net/dockercontainer/docker-${DOCKER_VERSION}.zip"
unzip "${DOWNLOAD_FOLDER}/docker-binaries.zip" -d "${DOWNLOAD_FOLDER}"
mv "${DOWNLOAD_FOLDER}/docker/docker.exe" dist/
mv ${DOWNLOAD_FOLDER}/docker/*.dll dist/
if [[ ${PLATFORM} == "windows" ]]; then
wget -O "${DOWNLOAD_FOLDER}/docker-binaries.zip" "https://download.docker.com/win/static/stable/${ARCH}/docker-${DOCKER_VERSION}.zip"
unzip "${DOWNLOAD_FOLDER}/docker-binaries.zip" -d "${DOWNLOAD_FOLDER}"
mv "${DOWNLOAD_FOLDER}/docker/docker.exe" dist/
else
wget -O "${DOWNLOAD_FOLDER}/docker-binaries.tgz" "https://download.docker.com/${PLATFORM}/static/stable/${ARCH}/docker-${DOCKER_VERSION}.tgz"
tar -xf "${DOWNLOAD_FOLDER}/docker-binaries.tgz" -C "${DOWNLOAD_FOLDER}"
mv "${DOWNLOAD_FOLDER}/docker/docker" dist/
wget -O "${DOWNLOAD_FOLDER}/docker-binaries.tgz" "https://download.docker.com/${PLATFORM}/static/stable/${ARCH}/docker-${DOCKER_VERSION}.tgz"
tar -xf "${DOWNLOAD_FOLDER}/docker-binaries.tgz" -C "${DOWNLOAD_FOLDER}"
mv "${DOWNLOAD_FOLDER}/docker/docker" dist/
fi
exit 0

View file

@ -1,57 +1,30 @@
#!/bin/bash
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
if [[ $# -ne 3 ]]; then
echo "Illegal number of parameters" >&2
exit 1
fi
PLATFORM=$1
ARCH=$2
DOCKER_COMPOSE_VERSION=$3
COMPOSE_VERSION=$3
function download_binary() {
local PLATFORM=$1
local ARCH=$2
local BINARY_VERSION=$3
if [ "${PLATFORM}" == 'linux' ] && [ "${ARCH}" == 'amd64' ]; then
wget -O "dist/docker-compose" "https://github.com/portainer/docker-compose-linux-amd64-static-binary/releases/download/${BINARY_VERSION}/docker-compose"
chmod +x "dist/docker-compose"
return
fi
if [ "${PLATFORM}" == 'mac' ]; then
wget -O "dist/docker-compose" "https://github.com/docker/compose/releases/download/${BINARY_VERSION}/docker-compose-Darwin-x86_64"
chmod +x "dist/docker-compose"
return
fi
if [ "${PLATFORM}" == 'win' ]; then
wget -O "dist/docker-compose.exe" "https://github.com/docker/compose/releases/download/${BINARY_VERSION}/docker-compose-Windows-x86_64.exe"
chmod +x "dist/docker-compose.exe"
return
fi
}
function download_plugin() {
local PLATFORM=$1
local ARCH=$2
local PLUGIN_VERSION=$3
if [ "${PLATFORM}" == 'mac' ]; then
PLATFORM="darwin"
fi
FILENAME="docker-compose-${PLATFORM}-${ARCH}"
TARGET_FILENAME="docker-compose.plugin"
if [[ "$PLATFORM" == "windows" ]]; then
FILENAME="$FILENAME.exe"
TARGET_FILENAME="$TARGET_FILENAME.exe"
fi
wget -O "dist/$TARGET_FILENAME" "https://github.com/docker/compose-cli/releases/download/v$PLUGIN_VERSION/$FILENAME"
chmod +x "dist/$TARGET_FILENAME"
}
if [ "${PLATFORM}" == 'linux' ] && [ "${ARCH}" != 'amd64' ]; then
download_plugin "$PLATFORM" "$ARCH" "$DOCKER_COMPOSE_VERSION"
if [[ ${ARCH} == "amd64" ]]; then
ARCH="x86_64"
elif [[ ${ARCH} == "arm" ]]; then
ARCH="armv7"
elif [[ ${ARCH} == "arm64" ]]; then
ARCH="aarch64"
fi
if [[ "$PLATFORM" == "windows" ]]; then
wget -O "dist/docker-compose.plugin.exe" "https://github.com/docker/compose/releases/download/$COMPOSE_VERSION/docker-compose-windows-${ARCH}.exe"
chmod +x "dist/docker-compose.plugin.exe"
else
wget -O "dist/docker-compose.plugin" "https://github.com/docker/compose/releases/download/$COMPOSE_VERSION/docker-compose-${PLATFORM}-${ARCH}"
chmod +x "dist/docker-compose.plugin"
fi
download_binary "$PLATFORM" "$ARCH" "$DOCKER_COMPOSE_VERSION"

View file

@ -1,21 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -ne 3 ]]; then
echo "Illegal number of parameters" >&2
exit 1
fi
PLATFORM=$1
ARCH=$2
HELM_VERSION=$3
HELM_DIST="helm-$HELM_VERSION-$PLATFORM-$ARCH"
if [ "${PLATFORM}" == 'linux' ]; then
if [[ ${PLATFORM} == "linux" ]]; then
wget -qO- "https://get.helm.sh/${HELM_DIST}.tar.gz" | tar -x -z --strip-components 1 "${PLATFORM}-${ARCH}/helm"
mv "helm" "dist/helm"
chmod +x "dist/helm"
elif [ "${PLATFORM}" == 'darwin' ]; then
elif [[ ${PLATFORM} == "darwin" ]]; then
wget -qO- "https://get.helm.sh/helm-canary-darwin-amd64.tar.gz" | tar -x -z --strip-components 1 "darwin-amd64/helm"
mv "helm" "dist/helm"
chmod +x "dist/helm"
elif [ "${PLATFORM}" == 'windows' ]; then
wget -q -O tmp.zip "https://get.helm.sh/${HELM_DIST}.zip" && unzip -o -j tmp.zip "${PLATFORM}-${ARCH}/helm.exe" -d dist && rm -f tmp.zip
elif [[ ${PLATFORM} == "windows" ]]; then
wget -O tmp.zip "https://get.helm.sh/${HELM_DIST}.zip" && unzip -o -j tmp.zip "${PLATFORM}-${ARCH}/helm.exe" -d dist && rm -f tmp.zip
fi
exit 0

View file

@ -1,15 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -ne 3 ]]; then
echo "Illegal number of parameters" >&2
exit 1
fi
PLATFORM=$1
ARCH=$2
KOMPOSE_VERSION=$3
if [ "${PLATFORM}" == 'windows' ]; then
if [[ ${PLATFORM} == "windows" ]]; then
wget -O "dist/kompose.exe" "https://github.com/kubernetes/kompose/releases/download/${KOMPOSE_VERSION}/kompose-windows-amd64.exe"
chmod +x "dist/kompose.exe"
else
wget -O "dist/kompose" "https://github.com/kubernetes/kompose/releases/download/${KOMPOSE_VERSION}/kompose-${PLATFORM}-${ARCH}"
chmod +x "dist/kompose"
fi
exit 0

View file

@ -1,15 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -ne 3 ]]; then
echo "Illegal number of parameters" >&2
exit 1
fi
PLATFORM=$1
ARCH=$2
KUBECTL_VERSION=$3
if [ "${PLATFORM}" == 'windows' ]; then
if [[ ${PLATFORM} == "windows" ]]; then
wget -O "dist/kubectl.exe" "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/windows/amd64/kubectl.exe"
chmod +x "dist/kubectl.exe"
else
wget -O "dist/kubectl" "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/${PLATFORM}/${ARCH}/kubectl"
chmod +x "dist/kubectl"
fi
exit 0