-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: FogDong <[email protected]>
- Loading branch information
Showing
19 changed files
with
1,678 additions
and
37 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,116 @@ | ||
name: HelmChart | ||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
workflow_dispatch: {} | ||
|
||
env: | ||
BUCKET: ${{ secrets.OSS_BUCKET }} | ||
ENDPOINT: ${{ secrets.OSS_ENDPOINT }} | ||
ACCESS_KEY: ${{ secrets.OSS_ACCESS_KEY }} | ||
ACCESS_KEY_SECRET: ${{ secrets.OSS_ACCESS_KEY_SECRET }} | ||
|
||
jobs: | ||
publish-images: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Get the vars | ||
id: vars | ||
run: | | ||
echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} | ||
- name: Login ghcr.io | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Login Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USER }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Login Alibaba Cloud ACR | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: kubevela-registry.cn-hangzhou.cr.aliyuncs.com | ||
username: ${{ secrets.ACR_USERNAME }} | ||
password: ${{ secrets.ACR_PASSWORD }} | ||
- uses: docker/setup-qemu-action@v1 | ||
- uses: docker/setup-buildx-action@v1 | ||
with: | ||
driver-opts: image=moby/buildkit:master | ||
|
||
- name: Build & Pushing vela-workflow for ACR | ||
run: | | ||
docker build --build-arg GOPROXY=https://proxy.golang.org -t kubevela-registry.cn-hangzhou.cr.aliyuncs.com/oamdev/vela-workflow:${{ steps.vars.outputs.TAG }} -f ./cmd/apiserver/Dockerfile . | ||
docker push kubevela-registry.cn-hangzhou.cr.aliyuncs.com/oamdev/vela-workflow:${{ steps.vars.outputs.TAG }} | ||
- uses: docker/build-push-action@v2 | ||
name: Build & Pushing vela-workflow for Dockerhub and GHCR | ||
with: | ||
context: . | ||
file: ./cmd/apiserver/Dockerfile | ||
labels: |- | ||
org.opencontainers.image.source=https://github.com/${{ github.repository }} | ||
org.opencontainers.image.revision=${{ github.sha }} | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
build-args: | | ||
GOPROXY=https://proxy.golang.org | ||
tags: |- | ||
docker.io/oamdev/vela-workflow:${{ steps.vars.outputs.TAG }} | ||
ghcr.io/${{ github.repository }}/vela-workflow:${{ steps.vars.outputs.TAG }} | ||
publish-charts: | ||
env: | ||
HELM_CHART: charts/ | ||
LOCAL_OSS_DIRECTORY: .oss/ | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Get the vars | ||
id: vars | ||
run: | | ||
echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} | ||
- name: Install Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.4.0 | ||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
- uses: oprypin/find-latest-tag@v1 | ||
with: | ||
repository: kubevela/workflow | ||
releases-only: true | ||
id: latest_tag | ||
- name: Tag helm chart image | ||
run: | | ||
latest_repo_tag=${{ steps.latest_tag.outputs.tag }} | ||
sub="." | ||
major="$(cut -d"$sub" -f1 <<<"$latest_repo_tag")" | ||
minor="$(cut -d"$sub" -f2 <<<"$latest_repo_tag")" | ||
patch="0" | ||
current_repo_tag="$major.$minor.$patch" | ||
image_tag=${GITHUB_REF#refs/tags/} | ||
chart_version=$latest_repo_tag | ||
if [[ ${GITHUB_REF} == "refs/heads/master" ]]; then | ||
image_tag=latest | ||
chart_version=${current_repo_tag}-nightly-build | ||
fi | ||
sed -i "s/latest/${image_tag}/g" $HELM_CHART/values.yaml | ||
chart_smever=${chart_version#"v"} | ||
sed -i "s/0.1.0/$chart_smever/g" $HELM_CHART/Chart.yaml | ||
- name: Install ossutil | ||
run: wget http://gosspublic.alicdn.com/ossutil/1.7.0/ossutil64 && chmod +x ossutil64 && mv ossutil64 ossutil | ||
- name: Configure Alibaba Cloud OSSUTIL | ||
run: ./ossutil --config-file .ossutilconfig config -i ${ACCESS_KEY} -k ${ACCESS_KEY_SECRET} -e ${ENDPOINT} -c .ossutilconfig | ||
- name: sync cloud to local | ||
run: ./ossutil --config-file .ossutilconfig sync oss://$BUCKET/workflow $LOCAL_OSS_DIRECTORY | ||
- name: Package helm charts | ||
run: | | ||
helm package $HELM_CHART --destination $LOCAL_OSS_DIRECTORY | ||
helm repo index --url https://$BUCKET.$ENDPOINT/workflow $LOCAL_OSS_DIRECTORY | ||
- name: sync local to cloud | ||
run: ./ossutil --config-file .ossutilconfig sync $LOCAL_OSS_DIRECTORY oss://$BUCKET/workflow -f |
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,82 @@ | ||
name: PostSubmit | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: {} | ||
|
||
env: | ||
GO_VERSION: '1.17' | ||
|
||
jobs: | ||
|
||
detect-noop: | ||
runs-on: ubuntu-20.04 | ||
outputs: | ||
noop: ${{ steps.noop.outputs.should_skip }} | ||
steps: | ||
- name: Detect No-op Changes | ||
id: noop | ||
uses: fkirc/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]' | ||
do_not_skip: '["workflow_dispatch", "schedule", "push"]' | ||
concurrent_skipping: false | ||
|
||
image-multi-arch: | ||
runs-on: ubuntu-20.04 | ||
needs: detect-noop | ||
if: needs.detect-noop.outputs.noop != 'true' | ||
strategy: | ||
matrix: | ||
arch: [ amd64, arm64 ] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Build Image | ||
run: | | ||
IMG_TAG=latest-${{ matrix.arch }} \ | ||
OS=linux \ | ||
ARCH=${{ matrix.arch }} \ | ||
make image-apiserver | ||
- name: Push Image | ||
run: | | ||
echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username ${{ secrets.DOCKER_USER }} --password-stdin | ||
docker push oamdev/vela-workflow:latest-${{ matrix.arch }} | ||
docker push oamdev/vela-workflow:latest-${{ matrix.arch }} | ||
image-manifest: | ||
runs-on: ubuntu-latest | ||
needs: [ image-multi-arch ] | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: Create Manifest | ||
run: | | ||
echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username ${{ secrets.DOCKER_USER }} --password-stdin | ||
docker manifest create oamdev/vela-workflow:latest \ | ||
oamdev/vela-workflow:latest-amd64 \ | ||
oamdev/vela-workflow:latest-arm64 | ||
- name: Annotate Manifest | ||
run: | | ||
docker manifest annotate oamdev/vela-workflow:latest \ | ||
oamdev/vela-workflow:latest-amd64 --arch amd64 | ||
docker manifest annotate oamdev/vela-workflow:latest \ | ||
oamdev/vela-workflow:latest-arm64 --arch arm64 | ||
- name: Push Manifest | ||
run: | | ||
docker manifest push oamdev/vela-workflow:latest |
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,36 @@ | ||
ARG BASE_IMAGE | ||
# Build the manager binary | ||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.17-alpine as builder | ||
ARG GOPROXY | ||
ENV GOPROXY=${GOPROXY:-https://goproxy.cn} | ||
WORKDIR /workspace | ||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
RUN go mod download | ||
|
||
# Copy the go source | ||
COPY cmd/main.go cmd/main.go | ||
COPY api/ api/ | ||
COPY controllers/ controllers/ | ||
COPY pkg/ pkg/ | ||
|
||
# Build | ||
ARG TARGETARCH | ||
|
||
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \ | ||
go build -a -ldflags "-s -w" \ | ||
-o vela-workflow-${TARGETARCH} cmd/main.go | ||
|
||
FROM ${BASE_IMAGE:-alpine:3.15} | ||
# This is required by daemon connecting with cri | ||
RUN apk add --no-cache ca-certificates bash expat | ||
|
||
WORKDIR / | ||
|
||
ARG TARGETARCH | ||
COPY --from=builder /workspace/vela-workflow-${TARGETARCH} /usr/local/bin/vela-workflow | ||
|
||
ENTRYPOINT ["vela-workflow"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,24 @@ | ||
apiVersion: v2 | ||
name: vela-workflow | ||
description: A Helm chart for KubeVela Workflow | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
version: 0.1.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. | ||
appVersion: 0.1.0 | ||
|
||
home: https://kubevela.io | ||
icon: https://kubevela.io/img/logo.svg |
Oops, something went wrong.