Skip to content

support kubeconfig saving type #1364

support kubeconfig saving type

support kubeconfig saving type #1364

Workflow file for this run

name: Build
on:
workflow_dispatch:
inputs:
tag:
description: "Image Tag"
default: "latest"
pull_request:
branches:
- master
push:
branches:
- master
tags:
- 'v*.*.*'
paths-ignore:
- "**.md"
- "LICENSE"
- "docs/**"
- ".devcontainer/**"
- "*.ya?ml" # ignore all yaml files(with suffix yaml or yml) in the root of the repository
- "!codecov.yml"
- "!.golangci.yml"
- "!config/**"
- "OWNERS"
- "PROJECT"
jobs:
BuildController:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare
id: prepare
run: |
VERSION=latest
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
fi
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION=${{ github.event.inputs.tag }}
fi
echo ::set-output name=version::${VERSION}
- name: Docker meta for kubesphere
id: meta
uses: docker/metadata-action@v3
with:
images: |
kubesphere/devops-controller
tags: ${{ steps.prepare.outputs.version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_SECRETS }}
- name: Build env
id: build_env
run: |
if [ "${{ github.event_name }}" == "pull_request" ]
then
echo "::set-output name=platforms::linux/amd64"
echo "::set-output name=push::false"
echo "::set-output name=load::true"
echo "::set-output name=ref::pr-$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")"
else
echo "::set-output name=platforms::linux/amd64,linux/arm64"
echo "::set-output name=push::true"
echo "::set-output name=load::false"
echo "::set-output name=ref::${{github.ref_name}}"
fi
echo "::set-output name=short_sha::${GITHUB_SHA::7}"
- name: Build and push Docker images
uses: docker/[email protected]
with:
file: config/dockerfiles/controller-manager/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
push: ${{ steps.build_env.outputs.push }}
load: ${{ steps.build_env.outputs.load }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ steps.build_env.outputs.platforms }}
provenance: false
sbom: false
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
if: github.event_name == 'pull_request'
with:
image-ref: 'docker.io/kubesphere/devops-controller:${{ steps.build_env.outputs.ref }}-${{ steps.build_env.outputs.short_sha }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
BuildAPIServer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare
id: prepare
run: |
VERSION=latest
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
fi
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION=${{ github.event.inputs.tag }}
fi
echo ::set-output name=version::${VERSION}
- name: Docker meta for kubesphere
id: meta
uses: docker/metadata-action@v3
with:
images: |
kubesphere/devops-apiserver
tags: ${{ steps.prepare.outputs.version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_SECRETS }}
- name: Build env
id: build_env
run: |
if [ "${{ github.event_name }}" == "pull_request" ]
then
echo "::set-output name=platforms::linux/amd64"
echo "::set-output name=push::false"
echo "::set-output name=load::true"
echo "::set-output name=ref::pr-$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")"
else
echo "::set-output name=platforms::linux/amd64,linux/arm64"
echo "::set-output name=push::true"
echo "::set-output name=load::false"
echo "::set-output name=ref::${{github.ref_name}}"
fi
echo "::set-output name=short_sha::${GITHUB_SHA::7}"
- name: Build and push Docker images
uses: docker/[email protected]
with:
file: config/dockerfiles/apiserver/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
push: ${{ steps.build_env.outputs.push }}
load: ${{ steps.build_env.outputs.load }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ steps.build_env.outputs.platforms }}
provenance: false
sbom: false
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
if: github.event_name == 'pull_request'
with:
image-ref: 'docker.io/kubesphere/devops-apiserver:${{ steps.build_env.outputs.ref }}-${{ steps.build_env.outputs.short_sha }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
BuildTools:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare
id: prepare
run: |
VERSION=latest
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
fi
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION=${{ github.event.inputs.tag }}
fi
echo ::set-output name=version::${VERSION}
- name: Docker meta for kubesphere
id: meta
uses: docker/metadata-action@v3
with:
images: |
kubesphere/devops-tools
tags: ${{ steps.prepare.outputs.version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_SECRETS }}
- name: Build env
id: build_env
run: |
if [ "${{ github.event_name }}" == "pull_request" ]
then
echo "::set-output name=platforms::linux/amd64"
echo "::set-output name=push::false"
echo "::set-output name=load::true"
echo "::set-output name=ref::pr-$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")"
else
echo "::set-output name=platforms::linux/amd64,linux/arm64"
echo "::set-output name=push::true"
echo "::set-output name=load::false"
echo "::set-output name=ref::${{github.ref_name}}"
fi
echo "::set-output name=short_sha::${GITHUB_SHA::7}"
- name: Build and push Docker images
uses: docker/[email protected]
with:
file: config/dockerfiles/tools/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
push: ${{ steps.build_env.outputs.push }}
load: ${{ steps.build_env.outputs.load }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ steps.build_env.outputs.platforms }}
provenance: false
sbom: false
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
if: github.event_name == 'pull_request'
with:
image-ref: 'docker.io/kubesphere/devops-tools:${{ steps.build_env.outputs.ref }}-${{ steps.build_env.outputs.short_sha }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'