Merge pull request #10162 from id/ci-export-docker-image-in-slim-packages
Ci export docker image in slim packages
This commit is contained in:
commit
3d8107b48e
|
@ -10,7 +10,7 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
linux:
|
||||||
runs-on: ${{ matrix.runs-on }}
|
runs-on: ${{ matrix.runs-on }}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -152,3 +152,91 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.os }}
|
name: ${{ matrix.os }}
|
||||||
path: _packages/**/*.zip
|
path: _packages/**/*.zip
|
||||||
|
|
||||||
|
docker:
|
||||||
|
runs-on: ${{ matrix.runs-on }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
otp:
|
||||||
|
- 24.3.4.2-1
|
||||||
|
runs-on:
|
||||||
|
- aws-amd64
|
||||||
|
- ubuntu-22.04
|
||||||
|
use-self-hosted:
|
||||||
|
- ${{ github.repository_owner == 'emqx' }}
|
||||||
|
exclude:
|
||||||
|
- runs-on: ubuntu-22.04
|
||||||
|
use-self-hosted: true
|
||||||
|
- runs-on: aws-amd64
|
||||||
|
use-self-hosted: false
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: AutoModality/action-clean@v1
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # clone full git history
|
||||||
|
- name: fix-git-unsafe-repository
|
||||||
|
run: git config --global --add safe.directory /__w/emqx/emqx
|
||||||
|
- name: prepare
|
||||||
|
run: |
|
||||||
|
if [ -f 'EMQX_ENTERPRISE' ]; then
|
||||||
|
EMQX_NAME=emqx-ee
|
||||||
|
else
|
||||||
|
EMQX_NAME=emqx
|
||||||
|
fi
|
||||||
|
EMQX_IMAGE_TAG=localhost:5000/${{ github.repository_owner }}/$EMQX_NAME
|
||||||
|
PKG_VSN=${PKG_VSN:-$(./pkg-vsn.sh $EMQX_NAME)}
|
||||||
|
echo "EMQX_NAME=$EMQX_NAME" >> $GITHUB_ENV
|
||||||
|
echo "PKG_VSN=$PKG_VSN" >> $GITHUB_ENV
|
||||||
|
echo "EMQX_IMAGE_TAG=$EMQX_IMAGE_TAG" >> $GITHUB_ENV
|
||||||
|
- name: ensure access to github
|
||||||
|
if: endsWith(github.repository, 'enterprise')
|
||||||
|
run: |
|
||||||
|
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
|
||||||
|
git config --global credential.helper store
|
||||||
|
- uses: docker/setup-buildx-action@v2
|
||||||
|
- uses: docker/metadata-action@v4
|
||||||
|
id: meta
|
||||||
|
with:
|
||||||
|
images: ${{ env.EMQX_IMAGE_TAG }}
|
||||||
|
flavor: |
|
||||||
|
latest=false
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=match,pattern=[v|e](.*),group=1
|
||||||
|
labels:
|
||||||
|
org.opencontainers.image.otp.version=${{ matrix.otp }}
|
||||||
|
- uses: docker/build-push-action@v4
|
||||||
|
if: endsWith(github.repository, 'emqx')
|
||||||
|
with:
|
||||||
|
load: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
build-args: |
|
||||||
|
BUILD_FROM=ghcr.io/emqx/emqx-builder/4.4-24:${{ matrix.otp }}-alpine3.15.1
|
||||||
|
RUN_FROM=alpine:3.15.1
|
||||||
|
EMQX_NAME=${{ env.EMQX_NAME }}
|
||||||
|
file: deploy/docker/Dockerfile
|
||||||
|
context: .
|
||||||
|
- uses: docker/build-push-action@v4
|
||||||
|
if: endsWith(github.repository, 'enterprise')
|
||||||
|
with:
|
||||||
|
load: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
build-args: |
|
||||||
|
BUILD_FROM=ghcr.io/emqx/emqx-builder/4.4-24:${{ matrix.otp }}-alpine3.15.1
|
||||||
|
RUN_FROM=alpine:3.15.1
|
||||||
|
EMQX_NAME=${{ env.EMQX_NAME }}
|
||||||
|
file: deploy/docker/Dockerfile.enterprise
|
||||||
|
context: .
|
||||||
|
- name: export docker image
|
||||||
|
run: |
|
||||||
|
docker save ${{ steps.meta.outputs.tags }} | gzip > $EMQX_NAME-$PKG_VSN.tar.gz
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: "${{ env.EMQX_NAME }}-docker"
|
||||||
|
path: "${{ env.EMQX_NAME }}-${{ env.PKG_VSN }}.tar.gz"
|
||||||
|
|
|
@ -30,7 +30,7 @@ jobs:
|
||||||
-d "{\"title\": \"Sync code from opensource $GITHUB_REF to entperprise $EE_REF\", \"head\": \"$GITHUB_REF\", \"base\":\"$EE_REF\"}" \
|
-d "{\"title\": \"Sync code from opensource $GITHUB_REF to entperprise $EE_REF\", \"head\": \"$GITHUB_REF\", \"base\":\"$EE_REF\"}" \
|
||||||
https://api.github.com/repos/${{ github.repository_owner }}/emqx-enterprise/pulls)
|
https://api.github.com/repos/${{ github.repository_owner }}/emqx-enterprise/pulls)
|
||||||
echo $R | jq
|
echo $R | jq
|
||||||
echo "::set-output name=url::$(echo $R | jq '.url')"
|
echo "url=$(echo $R | jq '.url')" >> $GITHUB_OUTPUT
|
||||||
- name: request reviewers for a pull request
|
- name: request reviewers for a pull request
|
||||||
if: steps.create_pull_request.outputs.url != 'null'
|
if: steps.create_pull_request.outputs.url != 'null'
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -38,12 +38,12 @@ jobs:
|
||||||
git config --global credential.helper store
|
git config --global credential.helper store
|
||||||
make deps-emqx-ee
|
make deps-emqx-ee
|
||||||
make clean
|
make clean
|
||||||
echo "::set-output name=imgname::emqx-ee"
|
echo "imgname=emqx-ee" >> $GITHUB_OUTPUT
|
||||||
echo "::set-output name=version::$(./pkg-vsn.sh)"
|
echo "version=$(./pkg-vsn.sh)" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
make emqx-docker
|
make emqx-docker
|
||||||
echo "::set-output name=imgname::emqx"
|
echo "imgname=emqx" >> $GITHUB_OUTPUT
|
||||||
echo "::set-output name=version::$(./pkg-vsn.sh)"
|
echo "version=$(./pkg-vsn.sh)" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
- name: build docker image
|
- name: build docker image
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -233,15 +233,15 @@ jobs:
|
||||||
|
|
||||||
echo "OLD_VSNS=$old_vsns" >> $GITHUB_ENV
|
echo "OLD_VSNS=$old_vsns" >> $GITHUB_ENV
|
||||||
|
|
||||||
echo "::set-output name=vsn::$vsn"
|
echo "vsn=$vsn" >> $GITHUB_OUTPUT
|
||||||
echo "::set-output name=profile::$profile"
|
echo "profile=$profile" >> $GITHUB_OUTPUT
|
||||||
echo "::set-output name=broker::$broker"
|
echo "broker=$broker" >> $GITHUB_OUTPUT
|
||||||
echo "::set-output name=old_vsns::$old_vsns"
|
echo "old_vsns=$old_vsns" >> $GITHUB_OUTPUT
|
||||||
- name: Generate matrix
|
- name: Generate matrix
|
||||||
id: generate-matrix
|
id: generate-matrix
|
||||||
run: |
|
run: |
|
||||||
matrix=$(echo -n "$OLD_VSNS" | sed 's/ $//g' | jq -R -s -c 'split(" ")')
|
matrix=$(echo -n "$OLD_VSNS" | sed 's/ $//g' | jq -R -s -c 'split(" ")')
|
||||||
echo "::set-output name=matrix::$matrix"
|
echo "matrix=$matrix" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
relup_test_build:
|
relup_test_build:
|
||||||
needs: relup_test_plan
|
needs: relup_test_plan
|
||||||
|
|
Loading…
Reference in New Issue