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

feat(ci): introduce GH Actions for Portainer CE (#10419)

Co-authored-by: Chaim Lev-Ari <chaim.levi-ari@portainer.io>
This commit is contained in:
Steven Kang 2023-10-24 19:30:33 +09:00 committed by GitHub
parent 860890046d
commit 08fdebfbd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 194 additions and 26 deletions

View file

@ -4,12 +4,12 @@ set -euo pipefail
mkdir -p dist
# populate tool versions
BUILDNUMBER="N/A"
CONTAINER_IMAGE_TAG="N/A"
NODE_VERSION="0"
YARN_VERSION="0"
WEBPACK_VERSION="0"
GO_VERSION="0"
BUILDNUMBER=${BUILDNUMBER:-"N/A"}
CONTAINER_IMAGE_TAG=${CONTAINER_IMAGE_TAG:-"N/A"}
NODE_VERSION=${NODE_VERSION:-"N/A"}
YARN_VERSION=${YARN_VERSION:-"N/A"}
WEBPACK_VERSION=${WEBPACK_VERSION:-"N/A"}
GO_VERSION=${GO_VERSION:-"N/A"}
# copy templates
cp -r "./mustache-templates" "./dist"

View file

@ -11,13 +11,15 @@ dockerVersion=$(jq -r '.docker' < "${BINARY_VERSION_FILE}")
dockerComposeVersion=$(jq -r '.dockerCompose' < "${BINARY_VERSION_FILE}")
helmVersion=$(jq -r '.helm' < "${BINARY_VERSION_FILE}")
kubectlVersion=$(jq -r '.kubectl' < "${BINARY_VERSION_FILE}")
mingitVersion=$(jq -r '.mingit' < "${BINARY_VERSION_FILE}")
mkdir -p dist
echo "Downloading binaries for docker ${dockerVersion}, docker-compose ${dockerComposeVersion}, helm ${helmVersion}, kubectl ${kubectlVersion}"
echo "Downloading binaries for docker ${dockerVersion}, docker-compose ${dockerComposeVersion}, helm ${helmVersion}, kubectl ${kubectlVersion}, and mingit ${mingitVersion}"
./build/download_docker_binary.sh "$PLATFORM" "$ARCH" "$dockerVersion" &
./build/download_docker_compose_binary.sh "$PLATFORM" "$ARCH" "$dockerComposeVersion" &
./build/download_helm_binary.sh "$PLATFORM" "$ARCH" "$helmVersion" &
./build/download_kubectl_binary.sh "$PLATFORM" "$ARCH" "$kubectlVersion" &
./build/download_mingit_binary.sh "$PLATFORM" "$ARCH" "$mingitVersion" &
wait

View file

@ -31,11 +31,11 @@ rm -rf "${DOWNLOAD_FOLDER}"
mkdir -pv "${DOWNLOAD_FOLDER}"
if [[ ${PLATFORM} == "windows" ]]; then
wget -O "${DOWNLOAD_FOLDER}/docker-binaries.zip" "https://download.docker.com/win/static/stable/${ARCH}/docker-${DOCKER_VERSION}.zip"
wget --tries=3 --waitretry=30 --quiet -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"
wget --tries=3 --waitretry=30 --quiet -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

View file

@ -21,10 +21,10 @@ fi
if [[ "$PLATFORM" == "windows" ]]; then
wget -O "dist/docker-compose.exe" "https://github.com/docker/compose/releases/download/$COMPOSE_VERSION/docker-compose-windows-${ARCH}.exe"
wget --tries=3 --waitretry=30 --quiet -O "dist/docker-compose.exe" "https://github.com/docker/compose/releases/download/$COMPOSE_VERSION/docker-compose-windows-${ARCH}.exe"
chmod +x "dist/docker-compose.exe"
else
wget -O "dist/docker-compose" "https://github.com/docker/compose/releases/download/$COMPOSE_VERSION/docker-compose-${PLATFORM}-${ARCH}"
wget --tries=3 --waitretry=30 --quiet -O "dist/docker-compose" "https://github.com/docker/compose/releases/download/$COMPOSE_VERSION/docker-compose-${PLATFORM}-${ARCH}"
chmod +x "dist/docker-compose"
fi

View file

@ -13,7 +13,7 @@ HELM_DIST="helm-$HELM_VERSION-$PLATFORM-$ARCH"
if [[ ${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
wget --tries=3 --waitretry=30 --quiet -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
else
wget -qO- "https://get.helm.sh/${HELM_DIST}.tar.gz" | tar -x -z --strip-components 1 "${PLATFORM}-${ARCH}/helm"
mv "helm" "dist/helm"

View file

@ -12,9 +12,9 @@ KUBECTL_VERSION=$3
if [[ ${PLATFORM} == "windows" ]]; then
wget -O "dist/kubectl.exe" "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/windows/amd64/kubectl.exe"
wget --tries=3 --waitretry=30 --quiet -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"
wget --tries=3 --waitretry=30 --quiet -O "dist/kubectl" "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/${PLATFORM}/${ARCH}/kubectl"
chmod +x "dist/kubectl"
fi

18
build/download_mingit_binary.sh Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -ne 3 ]]; then
echo "Illegal number of parameters" >&2
exit 1
fi
PLATFORM=$1
MINGIT_VERSION=$3
if [[ ${PLATFORM} == "windows" ]]; then
GIT_VERSION=$(echo $MINGIT_VERSION | cut -d "." -f 1-3)
GIT_PATCH_VERSION=$(echo $MINGIT_VERSION | cut -d "." -f 4)
wget --tries=3 --waitretry=30 --quiet "https://github.com/git-for-windows/git/releases/download/v$GIT_VERSION.windows.$GIT_PATCH_VERSION/MinGit-$GIT_VERSION.$GIT_PATCH_VERSION-busybox-64-bit.zip"
unzip "MinGit-$GIT_VERSION.$GIT_PATCH_VERSION-busybox-64-bit.zip" -d dist/mingit
fi

View file

@ -1,21 +1,14 @@
ARG OSVERSION
FROM --platform=linux/amd64 gcr.io/k8s-staging-e2e-test-images/windows-servercore-cache:1.0-linux-amd64-${OSVERSION} as core
FROM --platform=linux/amd64 alpine:3.14 as downloader
ENV GIT_VERSION 2.30.0
ENV GIT_PATCH_VERSION 2
RUN mkdir mingit/ \
&& wget https://github.com/git-for-windows/git/releases/download/v$GIT_VERSION.windows.$GIT_PATCH_VERSION/MinGit-$GIT_VERSION.$GIT_PATCH_VERSION-busybox-64-bit.zip \
&& unzip MinGit-$GIT_VERSION.$GIT_PATCH_VERSION-busybox-64-bit.zip -d mingit/
FROM mcr.microsoft.com/windows/nanoserver:${OSVERSION} as production
ENV PATH "C:\mingit\cmd;C:\Windows\system32;C:\Windows;"
COPY --from=downloader /mingit mingit/
COPY --from=core /Windows/System32/netapi32.dll /Windows/System32/netapi32.dll
USER ContainerAdministrator
COPY dist/mingit/ mingit/
COPY dist/docker.exe /
COPY dist/docker-compose.exe /
COPY dist/helm.exe /
@ -33,4 +26,4 @@ EXPOSE 8000
LABEL io.portainer.server true
ENTRYPOINT ["/portainer.exe"]
ENTRYPOINT ["/portainer.exe"]