Build admission image during schedule CI #994
Workflow file for this run
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
name: Auto PR CI | ||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
paths-ignore: | ||
- docs/** | ||
- examples/** | ||
env: | ||
KUKEAN_OPERATOR_IMAGE_NAME: kubean-operator | ||
KUBEAN_ADMISSION_IMAGE_NAME: kubean-admission | ||
SPRAY_JOB_IMAGE_NAME: spray-job | ||
AIRGAP_PATCH_IMAGE_NAME: airgap-patch | ||
KUBESPRAY_TAG: latest | ||
VSPHERE_USER: ${{ secrets.VSPHERE_USER }} | ||
VSPHERE_PASSWD: ${{ secrets.VSPHERE_PASSWD }} | ||
AMD_ROOT_PASSWORD: ${{ secrets.AMD_ROOT_PASSWORD }} | ||
KYLIN_VM_PASSWORD: ${{ secrets.KYLIN_VM_PASSWORD }} | ||
jobs: | ||
get_ref: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
ref: ${{ steps.result.outputs.ref }} | ||
steps: | ||
- name: Get Ref | ||
id: result | ||
run: | | ||
echo ref=${{ github.event.pull_request.head.sha }} >> $GITHUB_OUTPUT | ||
static-check: | ||
needs: get_ref | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ needs.get_ref.outputs.ref }} | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.20.4 | ||
- name: static check | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | ||
version: v1.52.2 | ||
args: --timeout=10m | ||
- name: ansible-lint | ||
uses: ansible/ansible-lint-action@v6 | ||
with: | ||
path: "playbooks/" | ||
unit-test: | ||
needs: [ static-check,get_ref ] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ needs.get_ref.outputs.ref }} | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.20.4 | ||
- name: unit test | ||
run: | | ||
make test | ||
build-push-for-e2e: | ||
needs: [ unit-test,get_ref ] | ||
uses: kubean-io/kubean/.github/actions/build-push-for-e2e.yml@main | ||
e2e: | ||
needs: [ build-push-for-e2e,get_ref ] | ||
runs-on: [self-hosted, online] | ||
timeout-minutes: 900 | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ needs.get_ref.outputs.ref }} | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.20.4 | ||
- name: e2e | ||
run: | | ||
CONTAINER_TAG="$(git describe --tags --abbrev=8 --dirty)-e2e" | ||
HELM_CHART_VERSION=`echo ${CONTAINER_TAG}|awk -F "-" '{print $1}'` | ||
TAG_SECOND_PART=`echo ${CONTAINER_TAG}|awk -F "-" '{print $2 }'` | ||
if [[ ${TAG_SECOND_PART} =~ rc[0-9]+ ]];then | ||
HELM_CHART_VERSION=`echo ${CONTAINER_TAG}|awk -F "-" '{print $1"-"$2 }'` | ||
fi | ||
echo ${{ runner.name }} | ||
echo ${{ runner.os }} | ||
echo ${{ runner.arch }} | ||
echo ${{ github.workspace }} | ||
bash hack/e2e.sh "${HELM_CHART_VERSION}" "${CONTAINER_TAG}" ${{ runner.name }} "${VSPHERE_USER}" "${VSPHERE_PASSWD}" "${AMD_ROOT_PASSWORD}" "${KYLIN_VM_PASSWORD}" "PR" |