mirror of
https://github.com/goharbor/harbor
synced 2025-04-15 19:59:09 +00:00
Add build base image step in build package git action workflow
Build base image step should be in build package workflow, and local base images build by new step should be removed since images have been pushed to docker hub. Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
parent
5f0e7cfd62
commit
f0ebd17994
31
.github/workflows/build-package.yml
vendored
31
.github/workflows/build-package.yml
vendored
|
@ -36,9 +36,31 @@ jobs:
|
|||
with:
|
||||
docker_version: 18.09
|
||||
docker_channel: stable
|
||||
- uses: actions/checkout@v2.1.0
|
||||
- uses: jitterbit/get-changed-files@v1
|
||||
id: changed-files
|
||||
with:
|
||||
format: space-delimited
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
path: src/github.com/goharbor/harbor
|
||||
- name: Build Dev Base Image
|
||||
if: contains(steps.changed-files.outputs.modified, 'Dockerfile.base') && contains(github.ref, 'master')
|
||||
run: |
|
||||
set -x
|
||||
base_image_tag=$(cat ./VERSION)
|
||||
echo "Start to build base image for dev ......"
|
||||
cd src/github.com/goharbor/harbor
|
||||
sudo make build_base_docker -e BASEIMAGETAG=$base_image_tag -e REGISTRYUSER="${{ secrets.DOCKER_HUB_USERNAME }}" -e REGISTRYPASSWORD="${{ secrets.DOCKER_HUB_PASSWORD }}" -e PUSHBASEIMAGE=yes
|
||||
- name: Build Release Base Image
|
||||
if: contains(steps.changed-files.outputs.modified, 'VERSION')
|
||||
run: |
|
||||
set -x
|
||||
base_image_tag=$(cat ./VERSION)
|
||||
echo "Start to build base image for release $(base_image_tag) ......"
|
||||
cd src/github.com/goharbor/harbor
|
||||
sudo make build_base_docker -e BASEIMAGETAG=$base_image_tag -e REGISTRYUSER="${{ secrets.DOCKER_HUB_USERNAME }}" -e REGISTRYPASSWORD="${{ secrets.DOCKER_HUB_PASSWORD }}" -e PUSHBASEIMAGE=yes
|
||||
- name: Build Package
|
||||
run: |
|
||||
set -x
|
||||
|
@ -58,8 +80,10 @@ jobs:
|
|||
|
||||
if [[ $target_branch == "master" ]]; then
|
||||
Harbor_Assets_Version=$Harbor_Package_Version
|
||||
harbor_target_bucket=$harbor_builds_bucket
|
||||
else
|
||||
Harbor_Assets_Version=$target_release_version
|
||||
harbor_target_bucket=$harbor_releases_bucket/$target_branch
|
||||
fi
|
||||
|
||||
if [[ $target_branch == "release-"* ]]; then
|
||||
|
@ -68,12 +92,6 @@ jobs:
|
|||
Harbor_Build_Base_Tag=dev
|
||||
fi
|
||||
|
||||
if [[ $target_branch == "master" ]]; then
|
||||
harbor_target_bucket=$harbor_builds_bucket
|
||||
else
|
||||
harbor_target_bucket=$harbor_releases_bucket/$target_branch
|
||||
fi
|
||||
|
||||
cd src/github.com/goharbor/harbor
|
||||
sudo make package_offline GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=${Harbor_Build_Base_Tag} VERSIONTAG=${Harbor_Assets_Version} PKGVERSIONTAG=${Harbor_Package_Version} BUILDBIN=true NOTARYFLAG=true CHARTFLAG=true TRIVYFLAG=true HTTPPROXY=
|
||||
sudo make package_online GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=${Harbor_Build_Base_Tag} VERSIONTAG=${Harbor_Assets_Version} PKGVERSIONTAG=${Harbor_Package_Version} BUILDBIN=true NOTARYFLAG=true CHARTFLAG=true TRIVYFLAG=true HTTPPROXY=
|
||||
|
@ -108,4 +126,3 @@ jobs:
|
|||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
|
||||
if: always()
|
||||
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -48,3 +48,5 @@ src/core/conf/app.conf
|
|||
|
||||
src/server/v2.0/models/
|
||||
src/server/v2.0/restapi/
|
||||
.editorconfig
|
||||
|
||||
|
|
|
@ -112,3 +112,16 @@ if [ $? -ne 0 ];then
|
|||
else
|
||||
success "Pushing image $IMAGE succeeded";
|
||||
fi
|
||||
|
||||
h2 "Remove local goharbor images"
|
||||
DOCKER_RMI="docker rmi -f $(docker images | grep "goharbor" | awk '{print $3}')"
|
||||
info "$DOCKER_RMI"
|
||||
DOCKER_RMI_OUTPUT=$($DOCKER_RMI)
|
||||
|
||||
if [ $? -ne 0 ];then
|
||||
warn $DOCKER_RMI_OUTPUT
|
||||
error "Clean local goharbor images failed";
|
||||
else
|
||||
success "Clean local goharbor images succeeded";
|
||||
fi
|
||||
|
||||
|
|
2
tests/e2e-image/build.sh → tests/test-engine-image/build.sh
Executable file → Normal file
2
tests/e2e-image/build.sh → tests/test-engine-image/build.sh
Executable file → Normal file
|
@ -5,7 +5,7 @@ set -e
|
|||
IMAGE_FOR=$1
|
||||
VERSION=$2
|
||||
|
||||
CMD_BASE="cat Dockerfile.base"
|
||||
CMD_BASE="cat Dockerfile.common"
|
||||
SRC_FILE=""
|
||||
DST_FILE=Dockerfile
|
||||
|
Loading…
Reference in New Issue
Block a user