diff --git a/.github/workflows/deploy-backend-daily.yaml b/.github/workflows/deploy-backend-daily.yaml deleted file mode 100644 index d04320cc8aa..00000000000 --- a/.github/workflows/deploy-backend-daily.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: Deploy-Backend-Daily - -on: - schedule: - - cron: "0 16 * * *" - workflow_dispatch: - -jobs: - - update: - name: Update Backend Service - runs-on: ubuntu-latest - steps: - - name: executing remote ssh commands - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.QING_EIP }} - username: root - password: ${{ secrets.QING_PASSWORD }} - port: 22 - script: | - kubectl -n kubesphere-system rollout restart deploy ks-apiserver - kubectl -n kubesphere-system rollout restart deploy ks-controller-manager - kubectl -n kubesphere-system rollout restart deploy ks-console \ No newline at end of file diff --git a/.github/workflows/deploy-backend.yml b/.github/workflows/deploy-backend.yml deleted file mode 100644 index 0979d5e1333..00000000000 --- a/.github/workflows/deploy-backend.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Deploy-Backend - -on: - workflow_dispatch: - -jobs: - Deploy-Backend: - runs-on: ubuntu-latest - timeout-minutes: 150 - strategy: - max-parallel: 1 - env: - working-directory: ./.github/workflows/deploy-backend - steps: - - uses: actions/checkout@v2.1.1 - - - name: setup terraform - working-directory: ${{env.working-directory}} - run: | - wget https://releases.hashicorp.com/terraform/0.13.0/terraform_0.13.0_linux_amd64.zip - unzip terraform_0.13.0_linux_amd64.zip - - - name: setup secret - working-directory: ${{env.working-directory}} - run: | - sed -i 's/QING_ACCESS_KEY/${{ secrets.QINGCLOUD_ACCESS_KEY }}/g' var.tf - sed -i 's/QING_SECRET_KEY/${{ secrets.QINGCLOUD_SECRET_KEY }}/g' var.tf - sed -i 's/QING_EIP_ID/${{ secrets.QING_EIP_ID }}/g' var.tf - sed -i 's/QING_EIP/${{ secrets.QING_EIP }}/g' var.tf - sed -i 's/QING_PASSWORD/${{ secrets.QING_PASSWORD }}/g' var.tf - sed -i 's/GITHUB_REPOSITORY/${{ github.repository_owner }}-tf-cd-console/g' var.tf - - - name: init - working-directory: ${{env.working-directory}} - run: | - terraform init - - - name: destory - working-directory: ${{env.working-directory}} - continue-on-error: true - run: | - echo 'yes' | terraform destroy - - - name: install kubesphere - working-directory: ${{env.working-directory}} - timeout-minutes: 90 - run: | - terraform apply -input=false -auto-approve diff --git a/.github/workflows/deploy-backend/install.sh b/.github/workflows/deploy-backend/install.sh deleted file mode 100644 index 139d393ac7d..00000000000 --- a/.github/workflows/deploy-backend/install.sh +++ /dev/null @@ -1,38 +0,0 @@ -function wait_status_ok(){ - for ((n=0;n<30;n++)) - do - OK=`kubectl get pod -A| grep -E 'Running|Completed' | wc | awk '{print $1}'` - Status=`kubectl get pod -A | sed '1d' | wc | awk '{print $1}'` - echo "Success rate: ${OK}/${Status}" - if [[ $OK == $Status ]] - then - n=$((n+1)) - else - n=0 - fi - sleep 10 - kubectl get all -A - done -} - -yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -yum install -y vim openssl socat conntrack ipset wget jq -wget https://github.com/kubesphere/kubekey/releases/download/v1.0.0/kubekey-v1.0.0-linux-amd64.tar.gz -tar xvf kubekey-v1.0.0-linux-amd64.tar.gz -ls -al -chmod +x ./kk -./kk create cluster --with-kubernetes v1.17.9 -y - -kubectl apply -f https://openebs.github.io/charts/openebs-operator.yaml -wait_status_ok -kubectl patch storageclass openebs-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' - -kubectl apply -f https://raw.githubusercontent.com/kubesphere/ks-installer/master/deploy/kubesphere-installer.yaml -kubectl apply -f https://raw.githubusercontent.com/kubesphere/ks-installer/master/deploy/cluster-configuration.yaml - -kubectl -n kubesphere-system get cc ks-installer -o yaml | sed "s/false/true/g" | kubectl replace -n kubesphere-system cc -f - - -kubectl -n kubesphere-system patch cc ks-installer --type merge --patch '{"spec":{"etcd":{"monitoring":false}}}' -kubectl -n kubesphere-system patch cc ks-installer --type merge --patch '{"spec":{"etcd":{"tlsEnable":false}}}' - -kubectl -n kubesphere-system rollout restart deploy ks-installer \ No newline at end of file diff --git a/.github/workflows/deploy-backend/kubesphere.tf b/.github/workflows/deploy-backend/kubesphere.tf deleted file mode 100644 index f925b1c177a..00000000000 --- a/.github/workflows/deploy-backend/kubesphere.tf +++ /dev/null @@ -1,57 +0,0 @@ -resource "qingcloud_security_group" "basic"{ - name = "cd-console" - description = "cd-console" -} - -resource "qingcloud_security_group_rule" "openport" { - security_group_id = "${qingcloud_security_group.basic.id}" - protocol = "tcp" - priority = 0 - action = "accept" - direction = 0 - from_port = 22 - to_port = 40000 -} - -resource "qingcloud_instance" "init"{ - count = 1 - name = "cd-console" - image_id = "centos76x64a" - cpu = "8" - memory = "16384" - instance_class = "0" - managed_vxnet_id="vxnet-0" - login_passwd = "${var.password}" - security_group_id ="${qingcloud_security_group.basic.id}" - eip_id = "${var.eip_id}" - os_disk_size = "100" -} - -resource "null_resource" "install_kubesphere" { - provisioner "file" { - destination = "./install.sh" - source = "./install.sh" - - connection { - type = "ssh" - user = "root" - host = "${var.eip}" - password = "${var.password}" - port = "22" - } - } - - provisioner "remote-exec" { - inline = [ - "sh install.sh" - ] - - connection { - type = "ssh" - user = "root" - host = "${var.eip}" - password = "${var.password}" - port = "22" - } - } -} \ No newline at end of file diff --git a/.github/workflows/deploy-backend/var.tf b/.github/workflows/deploy-backend/var.tf deleted file mode 100644 index 65c763eac3d..00000000000 --- a/.github/workflows/deploy-backend/var.tf +++ /dev/null @@ -1,52 +0,0 @@ -variable "access_key" { - default = "QING_ACCESS_KEY" -} - -variable "secret_key" { - default = "QING_SECRET_KEY" -} - -variable "eip_id" { - default = "QING_EIP_ID" -} - -variable "eip" { - default = "QING_EIP" -} - -variable "password" { - default = "QING_PASSWORD" -} - -variable "zone" { - default = "ap2a" -} - -terraform { - required_providers { - qingcloud = { - source = "shaowenchen/qingcloud" - version = "1.2.6" - } - } -} - -terraform { - backend "s3" { - bucket = "terraform-deploy" - key = "GITHUB_REPOSITORY" - region = "sh1a" - endpoint = "s3.sh1a.qingstor.com" - skip_region_validation = true - skip_metadata_api_check = true - skip_credentials_validation = true - access_key = "QING_ACCESS_KEY" - secret_key = "QING_SECRET_KEY" - } -} - -provider "qingcloud" { - access_key = "${var.access_key}" - secret_key = "${var.secret_key}" - zone = "${var.zone}" -} \ No newline at end of file diff --git a/.github/workflows/deploy-pr-close.yml b/.github/workflows/deploy-pr-close.yml deleted file mode 100644 index c8240e784ea..00000000000 --- a/.github/workflows/deploy-pr-close.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Deploy-PullRequestClose - -on: - issue_comment: - types: [created] - -env: - SERVICE_NAME: ks-console-actions-pr-${{ github.event.issue.number }} - -jobs: - delete-check: - runs-on: ubuntu-latest - steps: - - name: acknowledge deployment request to commenter - id: check - uses: khan/pull-request-comment-trigger@master - with: - trigger: "/clear" - reaction: rocket - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - outputs: - triggered: ${{ steps.check.outputs.triggered }} - - delete-workload: - if: needs.delete-check.outputs.triggered == 'true' - runs-on: ubuntu-latest - needs: delete-check - steps: - - name: executing remote ssh commands - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.QING_EIP }} - username: root - password: ${{ secrets.QING_PASSWORD }} - port: 22 - script: | - kubectl -n kubesphere-system delete deploy,svc ${{ env.SERVICE_NAME }} || exit 0 - - name: Create comment - uses: peter-evans/create-or-update-comment@v1 - with: - issue-number: ${{ github.event.issue.number }} - body: | - Congratulations! Deployment cleaned. diff --git a/.github/workflows/deploy-pr.yml b/.github/workflows/deploy-pr.yml deleted file mode 100644 index f7b514ea792..00000000000 --- a/.github/workflows/deploy-pr.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: Deploy-PullRequest - -on: - issue_comment: - types: [created] -env: - IMAGE_NAME: ks-console:actions-pr-${{ github.event.issue.number }} - SERVICE_NAME: ks-console-actions-pr-${{ github.event.issue.number }} - -jobs: - deploy-check: - runs-on: ubuntu-latest - steps: - - name: acknowledge deployment request to commenter - id: check - uses: khan/pull-request-comment-trigger@master - with: - trigger: "/deploy" - reaction: rocket - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - outputs: - triggered: ${{ steps.check.outputs.triggered }} - - build-and-push: - if: needs.deploy-check.outputs.triggered == 'true' - runs-on: ubuntu-latest - needs: deploy-check - strategy: - matrix: - node-version: [16.x] - steps: - - name: get pull request ref - id: get_pull_request_ref - uses: octokit/request-action@v2.x - with: - route: GET /repos/:repository/pulls/:issue_id - repository: ${{ github.repository }} - issue_id: ${{ github.event.issue.number }} - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v2 - with: - repository: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.repo.full_name }} - ref: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.ref }} - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - name: Build - run: | - echo "start build" - yarn - yarn build - yarn test - docker build . --file Dockerfile --tag kubespheredev/${{ env.IMAGE_NAME }} - - - name: Docker login - uses: azure/docker-login@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Push image - run: | - echo "push image" - docker push kubespheredev/${{ env.IMAGE_NAME }} - - deploy: - runs-on: ubuntu-latest - needs: build-and-push - steps: - - name: get pull request ref - id: get_pull_request_ref - uses: octokit/request-action@v2.x - with: - route: GET /repos/:repository/pulls/:issue_id - repository: ${{ github.repository }} - issue_id: ${{ github.event.issue.number }} - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - - name: executing remote ssh commands - id: deploy_console - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.QING_EIP }} - username: root - password: ${{ secrets.QING_PASSWORD }} - port: 22 - script: | - kubectl -n kubesphere-system get deploy ks-console -o yaml | kubectl neat | sed "s/kubespheredev\/ks-console:latest/kubespheredev\/${{ env.IMAGE_NAME }}/g" | sed "s/app:\ ks-console/app:\ ${{ env.SERVICE_NAME }}/g" | sed "0,/name:\ ks-console/{s/name:\ ks-console/name:\ ${{ env.SERVICE_NAME }}/}" | kubectl apply -n kubesphere-system -f - - - kubectl -n kubesphere-system rollout restart deploy ${{ env.SERVICE_NAME }} - kubectl -n kubesphere-system expose deploy ${{ env.SERVICE_NAME }} --type=NodePort --port=80 --target-port=8000 - kubectl -n kubesphere-system get svc ${{ env.SERVICE_NAME }} - - - name: set SERVICE_PORT - id: set_port - run: | - sudo apt-get install -y sshpass - echo "::set-output name=SERVICE_PORT::$(sshpass -p "${{ secrets.QING_PASSWORD }}" ssh -o StrictHostKeyChecking=no root@${{ secrets.QING_EIP }} "kubectl -n kubesphere-system get svc ${{ env.SERVICE_NAME }} -o json | jq .spec.ports[].nodePort")" - - - name: Create comment - uses: peter-evans/create-or-update-comment@v1 - with: - issue-number: ${{ github.event.issue.number }} - body: | - Congratulations! The image of this pr is kubespheredev/${{ env.IMAGE_NAME }}. Deployment succeeded. This is the [preview link](http://${{ secrets.QING_EIP }}:${{ steps.set_port.outputs.SERVICE_PORT }}/) . - reactions: heart, hooray, laugh diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 4a442cd9332..8a59c39099c 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -35,3 +35,11 @@ jobs: run: | TAG=${GITHUB_REF#refs/*/} REPO=$IMAGE_REPO make container-cross-push echo "Push $IMAGE success!" + - name: slack + uses: 8398a7/action-slack@v3 + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + with: + status: ${{ job.status }} + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took + if: failure() diff --git a/.github/workflows/manually.yaml b/.github/workflows/manually.yaml index 65cb26e8ca1..fee6f9b6693 100644 --- a/.github/workflows/manually.yaml +++ b/.github/workflows/manually.yaml @@ -53,11 +53,11 @@ jobs: run: | TAG=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') REPO=docker.io/kubespheredev make container-cross-push -# - name: slack -# uses: 8398a7/action-slack@v3 -# env: -# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} -# with: -# status: ${{ job.status }} -# fields: repo,message,commit,author,action,eventName,ref,workflow,job,took -# if: failure() + - name: slack + uses: 8398a7/action-slack@v3 + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + with: + status: ${{ job.status }} + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took + if: failure() diff --git a/.github/workflows/nightly-builds.yaml b/.github/workflows/nightly-builds.yml similarity index 97% rename from .github/workflows/nightly-builds.yaml rename to .github/workflows/nightly-builds.yml index c62bb2005cc..d6af3d26b43 100644 --- a/.github/workflows/nightly-builds.yaml +++ b/.github/workflows/nightly-builds.yml @@ -31,8 +31,8 @@ jobs: - name: Build run: yarn build - - name: Test - run: yarn test + # - name: Test + # run: yarn test - name: Set up QEMU uses: docker/setup-qemu-action@v1 diff --git a/.github/workflows/npm-release-canary.yml b/.github/workflows/npm-release-canary.yml new file mode 100644 index 00000000000..1891864f171 --- /dev/null +++ b/.github/workflows/npm-release-canary.yml @@ -0,0 +1,56 @@ +name: npm Release - Canary + +on: + push: + branches: + - ksc-npm-canary + - ksc-npm-canary-* + - ksc-npm-*-canary + - ksc-npm-*-canary-* + workflow_dispatch: + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 16 + + - name: Install Yarn + run: npm install -g yarn + + - name: Install Dependencies + run: yarn install + + - name: Build + run: | + yarn build:locales + yarn build:server + yarn build:packages + + - name: Version + run: yarn changeset version --snapshot canary + + - name: Create .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish + run: yarn changeset publish --no-git-tag --tag canary + + - name: Delete Branch + run: | + branch=${GITHUB_REF#refs/heads/} + git push origin --delete $branch diff --git a/.github/workflows/npm-release-next.yml b/.github/workflows/npm-release-next.yml new file mode 100644 index 00000000000..6fdbcfe2bc4 --- /dev/null +++ b/.github/workflows/npm-release-next.yml @@ -0,0 +1,55 @@ +name: npm Release - Next + +on: + push: + branches: + - ksc-npm-next + - ksc-npm-next-* + - ksc-npm-*-next + - ksc-npm-*-next-* + workflow_dispatch: + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 16 + + - name: Install Yarn + run: npm install -g yarn + + - name: Install Dependencies + run: yarn install + + - name: Build + run: | + yarn build:locales + yarn build:packages + + - name: Version + run: yarn changeset version --snapshot next + + - name: Create .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish + run: yarn changeset publish --no-git-tag --tag next + + - name: Delete Branch + run: | + branch=${GITHUB_REF#refs/heads/} + git push origin --delete $branch diff --git a/.github/workflows/npm-release.yml b/.github/workflows/npm-release.yml new file mode 100644 index 00000000000..bc36ad8442b --- /dev/null +++ b/.github/workflows/npm-release.yml @@ -0,0 +1,46 @@ +name: npm Release + +on: + push: + branches: + # - ksc + - ksc-release-4.1 + workflow_dispatch: + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + release: + runs-on: self-runner-kubesphere + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 16 + + - name: Install Yarn + run: npm install -g yarn + + - name: Install Dependencies + run: yarn install + + - name: Build + run: | + yarn build:locales + yarn build:server + yarn build:packages + + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@v1 + with: + publish: yarn release:packages + commit: 'chore(npm-release): version packages' + title: 'chore(npm-release): version packages' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/v3dist-delete.yml b/.github/workflows/v3dist-delete.yml new file mode 100644 index 00000000000..ca6d75b2bf8 --- /dev/null +++ b/.github/workflows/v3dist-delete.yml @@ -0,0 +1,30 @@ +name: Delete v3dist + +on: + workflow_dispatch: + +jobs: + delete-v3dist: + runs-on: ubuntu-latest + steps: + - name: 'Checkout' + uses: actions/checkout@v4 + + - name: Delete v3dist + run: rm -rf packages/bootstrap/assets/v3dist/ + + - name: 'Create Pull Request' + env: + COMMIT_MESSAGE: 'chore(bot): delete packages/bootstrap/assets/v3dist/' + uses: peter-evans/create-pull-request@v6 + with: + commit-message: ${{ env.COMMIT_MESSAGE }} + signoff: true + delete-branch: true + branch-suffix: timestamp + title: ${{ env.COMMIT_MESSAGE }} + body: | + ```release-note + none + ``` + labels: approved