diff --git a/.github/workflows/kubecover-actions-flow.yaml b/.github/workflows/kubecover-actions-flow.yaml new file mode 100644 index 00000000..814e8532 --- /dev/null +++ b/.github/workflows/kubecover-actions-flow.yaml @@ -0,0 +1,241 @@ +name: Kubecover Reusable Workflow + +on: + workflow_call: + inputs: + platform_builder_version: + required: true + type: string + default: "stable" + kubecover_version: + required: true + type: string + default: "stable" + platform_version: + required: true + type: string + platform: + required: true + type: string + operator_version: + required: true + type: string + node_container: + required: true + type: string + tests_regex: + required: true + type: string + use_existing_cluster: + required: true + type: string + workers_num: + required: true + type: string + disk_size: + required: true + type: string + instance_type: + required: true + type: string + csi_cluster_driver_registrar_container: + required: false + type: string + default: "" + csi_external_attacher_container: + required: false + type: string + default: "" + csi_external_provisioner_container: + required: false + type: string + default: "" + csi_liveness_probe_container: + required: false + type: string + default: "" + csi_node_driver_registrar_container: + required: false + type: string + default: "" + etcd_host: + required: false + type: string + default: "" + init_container: + required: false + type: string + default: "" + nfs_container: + required: false + type: string + default: "" + secrets: + ONDAT_ORG_TOKEN: + required: true + CR_USER: + required: true + CR_PAT: + required: true + OPENSHIFT_IAM_USER_ACCESS_ID: + required: true + OPENSHIFT_IAM_USER_SECRET_KEY: + required: true + +jobs: + build_image: + runs-on: self-hosted + steps: + - name: Init + uses: actions/checkout@v2 + - name: Build & push container image + run: | + docker login -u "${{ secrets.CR_USER }}" -p "${{ secrets.CR_PAT }}" docker.io + docker build -t storageos/api-manager:build-$GITHUB_HEAD_REF . + docker push storageos/api-manager:build-$GITHUB_HEAD_REF + + create: + container: + image: 120921464587.dkr.ecr.eu-west-2.amazonaws.com/platform-builder:${{ inputs.platform_builder_version }} + runs-on: self-hosted + steps: + - name: Echo Inputs + run: | + echo Platform Builder version: ${{ inputs.platform_builder_version }} + echo Platform version: ${{ inputs.platform_version }} + echo Platfrom: ${{ inputs.platform }} + echo Ondat version: ${{ inputs.operator_version }} + echo Tests Regex: ${{ inputs.tests_regex }} + echo Use existing cluster: ${{ inputs.use_existing_cluster }} + echo Workers Num: ${{ inputs.workers_num }} + echo Disk size: ${{ inputs.disk_size }} + echo csi_cluster_driver_registrar_container: ${{ inputs.csi_cluster_driver_registrar_container }} + echo csi_external_attacher_container: ${{ inputs.csi_external_attacher_container }} + echo csi_external_provisioner_container: ${{ inputs.csi_external_provisioner_container }} + echo csi_liveness_probe_container: ${{ inputs.csi_liveness_probe_container }} + echo csi_node_driver_registrar_container: ${{ inputs.csi_node_driver_registrar_container }} + echo api_manager_container: storageos/api-manager:build-$GITHUB_HEAD_REF + echo etcd_host: ${{ inputs.etcd_host }} + echo init_container: ${{ inputs.init_container }} + echo nfs_container: ${{ inputs.nfs_container }} + echo node_container: ${{ inputs.node_container }} + echo secret: ${{ secrets.gh_token }} + + - name: Init + uses: actions/checkout@v2 + - name: Checkout GitHub Action Repo + uses: actions/checkout@v2 + with: + path: .github/actions/github-actions + ref: stable + repository: ondat/github_actions + token: ${{ secrets.ONDAT_ORG_TOKEN }} + + - name: Get Cluster + id: get_cluster + uses: ./.github/actions/github-actions/get_cluster + env: + OCP_AWS_ACCESS_KEY_ID: ${{ secrets.OPENSHIFT_IAM_USER_ACCESS_ID }} + OCP_AWS_SECRET_ACCESS_KEY: ${{ secrets.OPENSHIFT_IAM_USER_SECRET_KEY }} + with: + platform: ${{ inputs.platform }} + platform_version: ${{ inputs.platform_version }} + use_existing_cluster: ${{ inputs.use_existing_cluster }} + workers_num: ${{ inputs.workers_num }} + disk_size: ${{ inputs.disk_size }} + instance_type: ${{ inputs.instance_type }} + + install_ondat: + needs: [create, build_image] + container: + image: 120921464587.dkr.ecr.eu-west-2.amazonaws.com/kubecover:${{ inputs.kubecover_version }} + runs-on: self-hosted + steps: + - name: Init + uses: actions/checkout@v2 + + - name: Checkout GitHub Action Repo + uses: actions/checkout@v2 + with: + path: .github/actions/github-actions + ref: stable + repository: ondat/github_actions + token: ${{ secrets.ONDAT_ORG_TOKEN }} + + - name: Install Ondat + id: install_ondat + uses: ./.github/actions/github-actions/install_ondat + with: + csi_cluster_driver_registrar_container: ${{ inputs.csi_cluster_driver_registrar_container }} + csi_external_attacher_container: ${{ inputs.csi_external_attacher_container }} + csi_external_provisioner_container: ${{ inputs.csi_external_provisioner_container }} + csi_liveness_probe_container: ${{ inputs.csi_liveness_probe_container }} + csi_node_driver_registrar_container: ${{ inputs.csi_node_driver_registrar_container }} + api_manager_container: storageos/api-manager:build-$GITHUB_HEAD_REF + etcd_host: ${{ inputs.etcd_host }} + init_container: ${{ inputs.init_container }} + nfs_container: ${{ inputs.nfs_container }} + node_container: ${{ inputs.node_container }} + operator_version: ${{ inputs.operator_version }} + platform: ${{ inputs.platform }} + + run-tests: + needs: [install_ondat] + container: + image: 120921464587.dkr.ecr.eu-west-2.amazonaws.com/kubecover:${{ inputs.kubecover_version }} + runs-on: self-hosted + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Checkout GitHub Action Repo + uses: actions/checkout@v2 + with: + path: .github/actions/github-actions + ref: stable + repository: ondat/github_actions + token: ${{ secrets.ONDAT_ORG_TOKEN }} + + - name: Run Tests + id: kubecover_tests + uses: ./.github/actions/github-actions/kubecover_tests + env: + ACTIONS_TOKEN: ${{ secrets.ONDAT_ORG_TOKEN }} + with: + tests_regex: ${{ inputs.tests_regex }} + + cleanup: + needs: [run-tests] + if: always() + container: + image: 120921464587.dkr.ecr.eu-west-2.amazonaws.com/platform-builder:${{ inputs.platform_builder_version }} + runs-on: self-hosted + steps: + - name: Checkout GitHub Action Repo + uses: actions/checkout@v2 + with: + path: .github/actions/github-actions + ref: stable + repository: ondat/github_actions + token: ${{ secrets.ONDAT_ORG_TOKEN }} + + - uses: actions/download-artifact@v2 + with: + name: cluster_name + + - name: Set cluster name var from artefact + id: vars + shell: bash + run: | + echo "CLUSTER_NAME=$(cat cluster_name)" >> $GITHUB_ENV + export CLUSTER_NAME=$(cat cluster_name) + + - name: Destroy Cluster + id: destroy_cluster + uses: ./.github/actions/github-actions/destroy_cluster + env: + OCP_AWS_ACCESS_KEY_ID: ${{ secrets.OPENSHIFT_IAM_USER_ACCESS_ID }} + OCP_AWS_SECRET_ACCESS_KEY: ${{ secrets.OPENSHIFT_IAM_USER_SECRET_KEY }} + name: + platform: ${{ inputs.platform }} + cluster_name: ${{ env.cluster_name }} \ No newline at end of file diff --git a/.github/workflows/run-kubecover-api-manager.yaml b/.github/workflows/run-kubecover-api-manager.yaml new file mode 100644 index 00000000..fc42d7df --- /dev/null +++ b/.github/workflows/run-kubecover-api-manager.yaml @@ -0,0 +1,26 @@ +name: API Manager Kubecover Flow + +on: [pull_request] + +jobs: + kubecover: + uses: storageos/api-manager/.github/workflows/kubecover-actions-flow.yaml@pr_k8s_tests + with: + platform_builder_version: "stable" + kubecover_version: "latest" + platform: 'k8s' + platform_version: '1.22' + operator_version: 'v2.6.0' + node_container: 'storageos/node:v2.6.0' + init_container: 'storageos/init:v2.1.1' + tests_regex: "." + use_existing_cluster: 'n' + workers_num: '3' + disk_size: '100' + instance_type: 't3.large' + secrets: + ONDAT_ORG_TOKEN: ${{ secrets.ONDAT_ORG_TOKEN }} + CR_USER: ${{ secrets.CR_USER }} + CR_PAT: ${{ secrets.CR_PAT }} + OCP_AWS_ACCESS_KEY_ID: ${{ secrets.OPENSHIFT_IAM_USER_ACCESS_ID }} + OCP_AWS_SECRET_ACCESS_KEY: ${{ secrets.OPENSHIFT_IAM_USER_SECRET_KEY }}