|
|
@ -20,8 +20,8 @@ on:
|
|
|
|
- ready_for_review
|
|
|
|
- ready_for_review
|
|
|
|
|
|
|
|
|
|
|
|
env:
|
|
|
|
env:
|
|
|
|
DOCKER_HUB_REPO: portainerci/portainer
|
|
|
|
DOCKER_HUB_REPO: portainerci/portainer-ce
|
|
|
|
NODE_ENV: testing
|
|
|
|
EXTENSION_HUB_REPO: portainerci/portainer-docker-extension
|
|
|
|
GO_VERSION: 1.21.6
|
|
|
|
GO_VERSION: 1.21.6
|
|
|
|
NODE_VERSION: 18.x
|
|
|
|
NODE_VERSION: 18.x
|
|
|
|
|
|
|
|
|
|
|
@ -30,19 +30,22 @@ jobs:
|
|
|
|
strategy:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
matrix:
|
|
|
|
config:
|
|
|
|
config:
|
|
|
|
- { platform: linux, arch: amd64 }
|
|
|
|
- { platform: linux, arch: amd64, version: "" }
|
|
|
|
- { platform: linux, arch: arm64 }
|
|
|
|
- { platform: linux, arch: arm64, version: "" }
|
|
|
|
|
|
|
|
- { platform: linux, arch: arm, version: "" }
|
|
|
|
|
|
|
|
- { platform: linux, arch: ppc64le, version: "" }
|
|
|
|
|
|
|
|
- { platform: linux, arch: s390x, version: "" }
|
|
|
|
- { platform: windows, arch: amd64, version: 1809 }
|
|
|
|
- { platform: windows, arch: amd64, version: 1809 }
|
|
|
|
- { platform: windows, arch: amd64, version: ltsc2022 }
|
|
|
|
- { platform: windows, arch: amd64, version: ltsc2022 }
|
|
|
|
runs-on: arc-runner-set
|
|
|
|
runs-on: arc-runner-set
|
|
|
|
if: github.event.pull_request.draft == false
|
|
|
|
if: github.event.pull_request.draft == false
|
|
|
|
steps:
|
|
|
|
steps:
|
|
|
|
- name: '[preparation] checkout the current branch'
|
|
|
|
- name: '[preparation] checkout the current branch'
|
|
|
|
uses: actions/checkout@v3.5.3
|
|
|
|
uses: actions/checkout@v4.1.1
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
ref: ${{ github.event.inputs.branch }}
|
|
|
|
ref: ${{ github.event.inputs.branch }}
|
|
|
|
- name: '[preparation] set up golang'
|
|
|
|
- name: '[preparation] set up golang'
|
|
|
|
uses: actions/setup-go@v4.0.1
|
|
|
|
uses: actions/setup-go@v5.0.0
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
cache: false
|
|
|
|
cache: false
|
|
|
@ -53,7 +56,7 @@ jobs:
|
|
|
|
echo "go-build-dir=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
|
|
|
|
echo "go-build-dir=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
|
|
|
|
echo "go-mod-dir=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
|
|
|
|
echo "go-mod-dir=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: '[preparation] cache go'
|
|
|
|
- name: '[preparation] cache go'
|
|
|
|
uses: actions/cache@v3
|
|
|
|
uses: actions/cache@v4.0.0
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
path: |
|
|
|
|
${{ steps.cache-dir-path.outputs.go-build-dir }}
|
|
|
|
${{ steps.cache-dir-path.outputs.go-build-dir }}
|
|
|
@ -63,12 +66,12 @@ jobs:
|
|
|
|
${{ matrix.config.platform }}-${{ matrix.config.arch }}-go-
|
|
|
|
${{ matrix.config.platform }}-${{ matrix.config.arch }}-go-
|
|
|
|
enableCrossOsArchive: true
|
|
|
|
enableCrossOsArchive: true
|
|
|
|
- name: '[preparation] set up node.js'
|
|
|
|
- name: '[preparation] set up node.js'
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
uses: actions/setup-node@v4.0.1
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
cache: ''
|
|
|
|
cache: ''
|
|
|
|
- name: '[preparation] cache yarn'
|
|
|
|
- name: '[preparation] cache yarn'
|
|
|
|
uses: actions/cache@v3
|
|
|
|
uses: actions/cache@v4.0.0
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
path: |
|
|
|
|
**/node_modules
|
|
|
|
**/node_modules
|
|
|
@ -78,33 +81,35 @@ jobs:
|
|
|
|
${{ matrix.config.platform }}-${{ matrix.config.arch }}-yarn-
|
|
|
|
${{ matrix.config.platform }}-${{ matrix.config.arch }}-yarn-
|
|
|
|
enableCrossOsArchive: true
|
|
|
|
enableCrossOsArchive: true
|
|
|
|
- name: '[preparation] set up qemu'
|
|
|
|
- name: '[preparation] set up qemu'
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
uses: docker/setup-qemu-action@v3.0.0
|
|
|
|
- name: '[preparation] set up docker context for buildx'
|
|
|
|
- name: '[preparation] set up docker context for buildx'
|
|
|
|
run: docker context create builders
|
|
|
|
run: docker context create builders
|
|
|
|
- name: '[preparation] set up docker buildx'
|
|
|
|
- name: '[preparation] set up docker buildx'
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
uses: docker/setup-buildx-action@v3.0.0
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
endpoint: builders
|
|
|
|
endpoint: builders
|
|
|
|
- name: '[preparation] docker login'
|
|
|
|
- name: '[preparation] docker login'
|
|
|
|
uses: docker/login-action@v2.2.0
|
|
|
|
uses: docker/login-action@v3.0.0
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
|
|
|
- name: '[preparation] set the container image tag'
|
|
|
|
- name: '[preparation] set the container image tag'
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then
|
|
|
|
if [[ "${GITHUB_BASE_REF}" =~ ^release/.*$ ]]; then
|
|
|
|
|
|
|
|
# use the release branch name as the tag for release branches
|
|
|
|
|
|
|
|
# for instance, release/2.19 becomes 2.19
|
|
|
|
|
|
|
|
CONTAINER_IMAGE_TAG=$(echo $GITHUB_BASE_REF | cut -d "/" -f 2)
|
|
|
|
|
|
|
|
elif [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then
|
|
|
|
|
|
|
|
# use pr${{ github.event.number }} as the tag for pull requests
|
|
|
|
|
|
|
|
# for instance, pr123
|
|
|
|
CONTAINER_IMAGE_TAG="pr${{ github.event.number }}"
|
|
|
|
CONTAINER_IMAGE_TAG="pr${{ github.event.number }}"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
# replace / with - in the branch name
|
|
|
|
|
|
|
|
# for instance, feature/1.0.0 -> feature-1.0.0
|
|
|
|
CONTAINER_IMAGE_TAG=$(echo $GITHUB_REF_NAME | sed 's/\//-/g')
|
|
|
|
CONTAINER_IMAGE_TAG=$(echo $GITHUB_REF_NAME | sed 's/\//-/g')
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${{ matrix.config.platform }}" == "windows" ]; then
|
|
|
|
echo "CONTAINER_IMAGE_TAG=${CONTAINER_IMAGE_TAG}-${{ matrix.config.platform }}${{ matrix.config.version }}-${{ matrix.config.arch }}" >> $GITHUB_ENV
|
|
|
|
CONTAINER_IMAGE_TAG="${CONTAINER_IMAGE_TAG}-${{ matrix.config.platform }}${{ matrix.config.version }}-${{ matrix.config.arch }}"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
CONTAINER_IMAGE_TAG="${CONTAINER_IMAGE_TAG}-${{ matrix.config.platform }}-${{ matrix.config.arch }}"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "CONTAINER_IMAGE_TAG=${CONTAINER_IMAGE_TAG}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: '[execution] build linux & windows portainer binaries'
|
|
|
|
- name: '[execution] build linux & windows portainer binaries'
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
export YARN_VERSION=$(yarn --version)
|
|
|
|
export YARN_VERSION=$(yarn --version)
|
|
|
@ -112,6 +117,12 @@ jobs:
|
|
|
|
export BUILDNUMBER=${GITHUB_RUN_NUMBER}
|
|
|
|
export BUILDNUMBER=${GITHUB_RUN_NUMBER}
|
|
|
|
GIT_COMMIT_HASH_LONG=${{ github.sha }}
|
|
|
|
GIT_COMMIT_HASH_LONG=${{ github.sha }}
|
|
|
|
export GIT_COMMIT_HASH_SHORT={GIT_COMMIT_HASH_LONG:0:7}
|
|
|
|
export GIT_COMMIT_HASH_SHORT={GIT_COMMIT_HASH_LONG:0:7}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NODE_ENV="testing"
|
|
|
|
|
|
|
|
if [[ "${GITHUB_BASE_REF}" =~ ^release/.*$ ]]; then
|
|
|
|
|
|
|
|
NODE_ENV="production"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
make build-all PLATFORM=${{ matrix.config.platform }} ARCH=${{ matrix.config.arch }} ENV=${NODE_ENV}
|
|
|
|
make build-all PLATFORM=${{ matrix.config.platform }} ARCH=${{ matrix.config.arch }} ENV=${NODE_ENV}
|
|
|
|
env:
|
|
|
|
env:
|
|
|
|
CONTAINER_IMAGE_TAG: ${{ env.CONTAINER_IMAGE_TAG }}
|
|
|
|
CONTAINER_IMAGE_TAG: ${{ env.CONTAINER_IMAGE_TAG }}
|
|
|
@ -123,6 +134,11 @@ jobs:
|
|
|
|
else
|
|
|
|
else
|
|
|
|
docker buildx build --output=type=registry --platform ${{ matrix.config.platform }}/${{ matrix.config.arch }} -t "${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}" -f build/${{ matrix.config.platform }}/Dockerfile .
|
|
|
|
docker buildx build --output=type=registry --platform ${{ matrix.config.platform }}/${{ matrix.config.arch }} -t "${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}" -f build/${{ matrix.config.platform }}/Dockerfile .
|
|
|
|
docker buildx build --output=type=registry --platform ${{ matrix.config.platform }}/${{ matrix.config.arch }} -t "${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-alpine" -f build/${{ matrix.config.platform }}/alpine.Dockerfile .
|
|
|
|
docker buildx build --output=type=registry --platform ${{ matrix.config.platform }}/${{ matrix.config.arch }} -t "${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-alpine" -f build/${{ matrix.config.platform }}/alpine.Dockerfile .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "${GITHUB_BASE_REF}" =~ ^release/.*$ ]]; then
|
|
|
|
|
|
|
|
docker buildx build --output=type=registry --platform ${{ matrix.config.platform }}/${{ matrix.config.arch }} -t "${EXTENSION_HUB_REPO}:${CONTAINER_IMAGE_TAG}" -f build/${{ matrix.config.platform }}/Dockerfile .
|
|
|
|
|
|
|
|
docker buildx build --output=type=registry --platform ${{ matrix.config.platform }}/${{ matrix.config.arch }} -t "${EXTENSION_HUB_REPO}:${CONTAINER_IMAGE_TAG}-alpine" -f build/${{ matrix.config.platform }}/alpine.Dockerfile .
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
env:
|
|
|
|
env:
|
|
|
|
CONTAINER_IMAGE_TAG: ${{ env.CONTAINER_IMAGE_TAG }}
|
|
|
|
CONTAINER_IMAGE_TAG: ${{ env.CONTAINER_IMAGE_TAG }}
|
|
|
@ -132,26 +148,56 @@ jobs:
|
|
|
|
needs: [build_images]
|
|
|
|
needs: [build_images]
|
|
|
|
steps:
|
|
|
|
steps:
|
|
|
|
- name: '[preparation] docker login'
|
|
|
|
- name: '[preparation] docker login'
|
|
|
|
uses: docker/login-action@v2.2.0
|
|
|
|
uses: docker/login-action@v3.0.0
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
|
|
|
- name: '[preparation] set up docker context for buildx'
|
|
|
|
- name: '[preparation] set up docker context for buildx'
|
|
|
|
run: docker version && docker context create builders
|
|
|
|
run: docker version && docker context create builders
|
|
|
|
- name: '[preparation] set up docker buildx'
|
|
|
|
- name: '[preparation] set up docker buildx'
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
uses: docker/setup-buildx-action@v3.0.0
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
endpoint: builders
|
|
|
|
endpoint: builders
|
|
|
|
- name: '[execution] build and push manifests'
|
|
|
|
- name: '[execution] build and push manifests'
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then
|
|
|
|
if [[ "${GITHUB_BASE_REF}" =~ ^release/.*$ ]]; then
|
|
|
|
|
|
|
|
# use the release branch name as the tag for release branches
|
|
|
|
|
|
|
|
# for instance, release/2.19 becomes 2.19
|
|
|
|
|
|
|
|
CONTAINER_IMAGE_TAG=$(echo $GITHUB_BASE_REF | cut -d "/" -f 2)
|
|
|
|
|
|
|
|
elif [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then
|
|
|
|
|
|
|
|
# use pr${{ github.event.number }} as the tag for pull requests
|
|
|
|
|
|
|
|
# for instance, pr123
|
|
|
|
CONTAINER_IMAGE_TAG="pr${{ github.event.number }}"
|
|
|
|
CONTAINER_IMAGE_TAG="pr${{ github.event.number }}"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
# replace / with - in the branch name
|
|
|
|
|
|
|
|
# for instance, feature/1.0.0 -> feature-1.0.0
|
|
|
|
CONTAINER_IMAGE_TAG=$(echo $GITHUB_REF_NAME | sed 's/\//-/g')
|
|
|
|
CONTAINER_IMAGE_TAG=$(echo $GITHUB_REF_NAME | sed 's/\//-/g')
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
docker buildx imagetools create -t "${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}" \
|
|
|
|
docker buildx imagetools create -t "${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}" \
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-amd64" \
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-amd64" \
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-arm64" \
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-arm64" \
|
|
|
|
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-arm" \
|
|
|
|
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-ppc64le" \
|
|
|
|
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-s390x" \
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-windows1809-amd64" \
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-windows1809-amd64" \
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-windowsltsc2022-amd64"
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-windowsltsc2022-amd64"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docker buildx imagetools create -t "${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-alpine" \
|
|
|
|
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-amd64-alpine" \
|
|
|
|
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-arm64-alpine" \
|
|
|
|
|
|
|
|
"${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-arm-alpine"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "${GITHUB_BASE_REF}" =~ ^release/.*$ ]]; then
|
|
|
|
|
|
|
|
docker buildx imagetools create -t "${EXTENSION_HUB_REPO}:${CONTAINER_IMAGE_TAG}" \
|
|
|
|
|
|
|
|
"${EXTENSION_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-amd64" \
|
|
|
|
|
|
|
|
"${EXTENSION_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-arm64" \
|
|
|
|
|
|
|
|
"${EXTENSION_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-arm" \
|
|
|
|
|
|
|
|
"${EXTENSION_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-ppc64le" \
|
|
|
|
|
|
|
|
"${EXTENSION_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-s390x"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docker buildx imagetools create -t "${EXTENSION_HUB_REPO}:${CONTAINER_IMAGE_TAG}-alpine" \
|
|
|
|
|
|
|
|
"${EXTENSION_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-amd64-alpine" \
|
|
|
|
|
|
|
|
"${EXTENSION_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-arm64-alpine" \
|
|
|
|
|
|
|
|
"${EXTENSION_HUB_REPO}:${CONTAINER_IMAGE_TAG}-linux-arm-alpine"
|
|
|
|
|
|
|
|
fi
|
|
|
|