Skip to content

Merge pull request #2232 from wenchajun/upgrade #1244

Merge pull request #2232 from wenchajun/upgrade

Merge pull request #2232 from wenchajun/upgrade #1244

Workflow file for this run

name: e2e-TEST
on:
push:
branches:
- 'master'
- 'release-*'
pull_request:
branches:
- 'master'
- 'release-*'
env:
# TODO: Change variable to your image's name.
IMAGE_NAME: ks-installer
IMAGE_REPO: kubespheredev
IMAGE_VERSION: latest
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_TEST }}
jobs:
Test-on-k8s-v-1-19-7:
runs-on: self-hosted
timeout-minutes: 150
outputs:
is_MY_SECRET_set: ${{ steps.checksecret_job.outputs.is_MY_SECRET_set }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Clean up
run: kind delete cluster --name chart-testing && docker image prune -f
- name: Build image (pr)
if: ${{ github.event_name == 'pull_request' }}
run: |
echo ${{ github.base_ref }}
tag=${{ github.base_ref }} && sed -i "2idev_tag\: $tag" roles/download/defaults/main.yml && sed -i "/ \"version\"/s/\:.*/\: \"$tag\"/g" controller/installRunner.py
docker build . --file Dockerfile --tag ks-installer
- name: Build image (push)
if: ${{ github.event_name == 'push' }}
run: |
echo ${GITHUB_REF#refs/heads/}
tag=${GITHUB_REF#refs/heads/} && sed -i "2idev_tag\: $tag" roles/download/defaults/main.yml && sed -i "/ \"version\"/s/\:.*/\: \"$tag\"/g" controller/installRunner.py
docker build . --file Dockerfile --tag ks-installer
- name: Create kind cluster
uses: helm/[email protected]
with:
config: .github/workflows/kind/kind.yaml
- name: Load image to kind
run: kind load docker-image ks-installer --name chart-testing
- name: Deploy KubeSphere to Kind
run: |
sed -i 's/image: .*/image: ks-installer/g' deploy/kubesphere-installer.yaml
sed -i 's/imagePullPolicy: .*/imagePullPolicy: IfNotPresent/g' deploy/kubesphere-installer.yaml
sed -i 's/jenkinsMemoryReq: .*/jenkinsMemoryReq: 200Mi/g' deploy/cluster-configuration.yaml
kubectl apply -f deploy/kubesphere-installer.yaml
kubectl apply -f deploy/cluster-configuration.yaml
bash scripts/check_cluster_status.sh
- name: Test plugin
run: |
kubectl -n kubesphere-system patch cc ks-installer --type merge --patch '{"spec":{"servicemesh":{"enabled":true},"devops":{"enabled":true},"alerting":{"enabled":true},"auditing":{"enabled":true},"console":{"enableMultiLogin":true},"events":{"enabled":true},"logging":{"enabled":true},"metrics_server":{"enabled":true},"network":{"networkpolicy":{"enabled":true}},"openpitrix":{"store":{"enabled":true}}}}'
bash scripts/check_cluster_status.sh
# - name: Clean up (servicemesh / devops / gatekeeper)
# run: kind delete cluster --name chart-testing
#
# - name: Create kind cluster (servicemesh / devops / gatekeeper)
# uses: helm/[email protected]
# with:
# config: .github/workflows/kind/kind.yaml
#
# - name: Load image to kind (servicemesh / devops / gatekeeper)
# run: kind load docker-image ks-installer --name chart-testing
#
# - name: Deploy KubeSphere to Kind (servicemesh / devops / gatekeeper)
# run: |
# kubectl apply -f deploy/kubesphere-installer.yaml
# kubectl apply -f deploy/cluster-configuration.yaml
# bash scripts/check_cluster_status.sh
#
# - name: Test plugin (servicemesh / devops / gatekeeper)
# run: |
# kubectl -n kubesphere-system patch cc ks-installer --type merge --patch '{"spec":{"servicemesh":{"enabled":true},"devops":{"enabled":true},"gatekeeper":{"enabled":true}}}'
# bash scripts/check_cluster_status.sh
- name: Check DOCKER_PASSWORD secret
id: checksecret_job
env:
MY_SECRET: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "is_MY_SECRET_set: ${{ env.MY_SECRET != '' }}"
echo "::set-output name=is_MY_SECRET_set::${{ env.MY_SECRET != '' }}"
- name: slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
if: ${{ failure() }}
push-image-to-dockerhub:
runs-on: ubuntu-latest
needs: [Test-on-k8s-v-1-19-7]
if: needs.Test-on-k8s-v-1-19-7.outputs.is_MY_SECRET_set == 'true'
steps:
- uses: actions/checkout@v2
- 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: Log into registry
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Get Version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/heads/}
- name: Push image
run: |
echo ${GITHUB_REF#refs/heads/}
tag=${GITHUB_REF#refs/heads/} && sed -i "2idev_tag\: $tag" roles/download/defaults/main.yml && sed -i "/ \"version\"/s/\:.*/\: \"$tag\"/g" controller/installRunner.py
IMAGE=$IMAGE_REPO/$IMAGE_NAME:${{ steps.get_version.outputs.VERSION }}
docker buildx build --platform linux/amd64,linux/arm64 --push -f Dockerfile.complete -t $IMAGE .
echo "Push $IMAGE success!"
- name: slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
if: ${{ failure() }}