forked from aledbf/kube-keepalived-vip
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from renyunkang/master
update image build way
- Loading branch information
Showing
23 changed files
with
1,536 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: BuildContainerImage | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'release-*' | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
env: | ||
GO111MODULE: on | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
platforms: all | ||
|
||
- name: Set up Docker buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build and push docker images | ||
env: | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
if: github.event_name == 'push' | ||
run: | | ||
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | ||
REPO=kubesphere TAG="${GITHUB_REF#refs/*/}" make container-cross-push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,34 @@ | ||
rootfs/kube-keepalived-vip | ||
rootfs/keepalived.tar.gz | ||
|
||
chart/kube-keepalived-vip-*.tgz | ||
chart/kube-keepalived-vip/Chart.yaml | ||
chart/kube-keepalived-vip/values.yaml | ||
# Ignore backup files | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
bin | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
# Kubernetes Generated files - skip generated files, except for vendored files | ||
|
||
!vendor/**/zz_generated.* | ||
|
||
# editor and IDE paraphernalia | ||
.idea | ||
*.swp | ||
*.swo | ||
*~ | ||
.vscode | ||
*.bak | ||
.DS_Store | ||
.idea/ | ||
*.coverprofile | ||
# log | ||
*.porterlog | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
docker image prune -f | ||
docker image ls | grep keepalived | grep -v infra | awk '{print $1":"$2}' | xargs docker rmi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
set -o pipefail | ||
|
||
OPENELB_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | ||
source "${OPENELB_ROOT}/hack/lib/init.sh" | ||
|
||
# push to kubesphere with default latest tag | ||
REPO=${REPO:-kubesphere} | ||
VERSION=${VERSION:-2.2.8} | ||
COMPILE_ONLY=${COMPILE_ONLY:-} | ||
if [[ -n "${COMPILE_ONLY:-}" ]]; then | ||
TAG=${TAG:-${VERSION}} | ||
else | ||
TAG=${TAG:-latest} | ||
fi | ||
|
||
# If set, just building, no pushing | ||
DRY_RUN=${DRY_RUN:-} | ||
|
||
# support other container tools. e.g. podman | ||
CONTAINER_CLI=${CONTAINER_CLI:-docker} | ||
CONTAINER_BUILDER=${CONTAINER_BUILDER:-build} | ||
|
||
# use host os and arch as default target os and arch | ||
TARGETOS=${TARGETOS:-$(kube::util::host_os)} | ||
TARGETARCH=${TARGETARCH:-$(kube::util::host_arch)} | ||
|
||
|
||
if [[ -n "${COMPILE_ONLY:-}" ]]; then | ||
${CONTAINER_CLI} "${CONTAINER_BUILDER}" \ | ||
--build-arg TARGETARCH="${TARGETARCH}" \ | ||
--build-arg TARGETOS="${TARGETOS}" \ | ||
--build-arg VERSION="${VERSION}" \ | ||
--output type=docker \ | ||
-f build/keepalived/Dockerfile \ | ||
-t "${REPO}"/build-keepalived:"${TAG}" . | ||
else | ||
${CONTAINER_CLI} "${CONTAINER_BUILDER}" \ | ||
--build-arg "TARGETARCH=${TARGETARCH}" \ | ||
--build-arg "TARGETOS=${TARGETOS}" \ | ||
--output type=docker \ | ||
-f build/kube-keepalived/Dockerfile \ | ||
-t "${REPO}"/kube-keepalived-vip:"${TAG}" . | ||
fi | ||
|
||
if [[ -z "${DRY_RUN:-}" ]]; then | ||
if [[ -n "${COMPILE_ONLY:-}" ]]; then | ||
${CONTAINER_CLI} push "${REPO}"/build-keepalived:"${TAG}" | ||
else | ||
${CONTAINER_CLI} push "${REPO}"/kube-keepalived-vip:"${TAG}" | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
set -o pipefail | ||
|
||
OPENELB_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | ||
source "${OPENELB_ROOT}/hack/lib/init.sh" | ||
|
||
# push to kubesphere with default latest tag | ||
REPO=${REPO:-kubesphere} | ||
VERSION=${VERSION:-2.2.8} | ||
PUSH=${PUSH:-} | ||
COMPILE_ONLY=${COMPILE_ONLY:-} | ||
if [[ -n "${COMPILE_ONLY:-}" ]]; then | ||
TAG=${TAG:-${VERSION}} | ||
else | ||
TAG=${TAG:-latest} | ||
fi | ||
|
||
# support other container tools. e.g. podman | ||
CONTAINER_CLI=${CONTAINER_CLI:-docker} | ||
CONTAINER_BUILDER=${CONTAINER_BUILDER:-"buildx build"} | ||
|
||
# If set, just building, no pushing | ||
if [[ -z "${DRY_RUN:-}" ]]; then | ||
PUSH="--push" | ||
fi | ||
|
||
# supported platforms | ||
PLATFORMS=linux/amd64,linux/arm64 | ||
|
||
|
||
# shellcheck disable=SC2086 # inteneded splitting of CONTAINER_BUILDER | ||
if [[ -n "${COMPILE_ONLY:-}" ]]; then | ||
${CONTAINER_CLI} ${CONTAINER_BUILDER} \ | ||
--platform ${PLATFORMS} \ | ||
--build-arg VERSION="${VERSION}" \ | ||
${PUSH} \ | ||
-f build/keepalived/Dockerfile \ | ||
-t "${REPO}"/build-keepalived:"${TAG}" . | ||
|
||
else | ||
${CONTAINER_CLI} ${CONTAINER_BUILDER} \ | ||
--platform ${PLATFORMS} \ | ||
${PUSH} \ | ||
-f build/kube-keepalived/Dockerfile \ | ||
-t "${REPO}"/kube-keepalived-vip:"${TAG}" . | ||
|
||
fi | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
OPENELB_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | ||
source "${OPENELB_ROOT}/hack/lib/init.sh" | ||
|
||
VERBOSE=${VERBOSE:-"0"} | ||
if [[ "${VERBOSE}" == "1" ]];then | ||
set -x | ||
fi | ||
|
||
OUTPUT_DIR=bin | ||
BUILDPATH=./${1:?"path to build"} | ||
OUT=${OUTPUT_DIR}/${1:?"output path"} | ||
|
||
|
||
GOBINARY=${GOBINARY:-go} | ||
BUILD_GOOS=${GOOS:-$(go env GOOS)} | ||
BUILD_GOARCH=${GOARCH:-$(go env GOARCH)} | ||
LDFLAGS=$(kube::version::ldflags) | ||
|
||
# forgoing -i (incremental build) because it will be deprecated by tool chain. | ||
GOOS=${BUILD_GOOS} CGO_ENABLED=0 GOARCH=${BUILD_GOARCH} ${GOBINARY} build \ | ||
-ldflags="${LDFLAGS}" \ | ||
-o "${OUT}" \ | ||
"${BUILDPATH}" |
Oops, something went wrong.