|
1 | 1 | name: Verify PR |
2 | 2 |
|
3 | 3 | # Controls when the action will run. Triggers the workflow on push or pull request |
4 | | -# events but only for the master branch |
| 4 | +# events but only for the main branch |
5 | 5 | on: |
6 | 6 | pull_request: |
7 | 7 | branches: [ master ] |
8 | 8 |
|
9 | 9 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel |
10 | 10 | jobs: |
11 | 11 | verify: |
12 | | - # The type of runner that the job will run on |
13 | 12 | if: ${{ !contains( github.event.pull_request.labels.*.name, 'skip ci' ) }} |
14 | 13 | runs-on: ubuntu-latest |
15 | 14 | container: quay.io/ibmgaragecloud/cli-tools:v0.10.0-lite |
16 | 15 |
|
17 | 16 | strategy: |
18 | 17 | matrix: |
19 | | - platform: [ocp44_vpc] |
| 18 | + platform: [ocp4_latest] |
20 | 19 | # max-parallel: 1 |
21 | 20 | fail-fast: false |
22 | 21 |
|
23 | 22 | env: |
24 | 23 | HOME: /home/devops |
25 | | - NAMESPACE: ${{ secrets.NAMESPACE }} |
26 | | - TF_VAR_tools_namespace: ${{ secrets.NAMESPACE }} |
27 | | - TF_VAR_ibmcloud_api_key: ${{ secrets.IBMCLOUD_API_KEY }} |
28 | | - IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }} |
29 | | - TF_VAR_resource_group_name: ${{ secrets.TEST_RESOURCE_GROUP }} |
30 | | - TF_VAR_region: ${{ secrets.TEST_REGION }} |
31 | | - TF_VAR_cluster_name: ${{ secrets[format('TEST_CLUSTER_{0}', matrix.platform)] }} |
32 | | - TF_VAR_cluster_type: ${{ matrix.platform }} |
33 | | - TF_VAR_vpc_cluster: ${{ endswith(matrix.platform, 'vpc') }} |
34 | | - TF_VAR_logdna_exists: "true" |
35 | | - TF_VAR_sysdig_exists: "true" |
36 | | - TF_VAR_cluster_exists: "true" |
37 | 24 |
|
38 | 25 | # Steps represent a sequence of tasks that will be executed as part of the job |
39 | 26 | steps: |
40 | | - - name: Validate config |
41 | | - run: | |
42 | | - echo "Github sha: ${{ github.sha }}" |
43 | | - echo "Github ref: ${{ github.ref }}" |
44 | | - if [ -z "${NAMESPACE}" ]; then |
45 | | - echo "The NAMESPACE secret has not been set within the Git repo" |
46 | | - exit 1 |
47 | | - fi |
48 | | -
|
49 | 27 | - name: Checkout |
50 | 28 | uses: actions/checkout@v1 |
51 | 29 |
|
52 | | - # Setups up the task |
53 | | - - name: Setup ${{ matrix.platform }} |
54 | | - run: | |
55 | | - ls -lA |
56 | | - mkdir -p /tmp/workspace |
57 | | - cp -R ./terraform/scripts-workspace/* /tmp/workspace |
58 | | - cp -R ./terraform/stages/* /tmp/workspace |
59 | | - cp -R ./test/stages/* /tmp/workspace |
60 | | -
|
61 | | - # Deploy |
62 | | - - name: Deploy ${{ matrix.platform }} |
63 | | - run: | |
64 | | - cd /tmp/workspace |
65 | | - ./apply.sh |
66 | | -
|
67 | | - # Test deploy |
68 | | -# - name: Validate deploy ${{ matrix.platform }} |
69 | | -# run: | |
70 | | -# cd /tmp/workspace |
71 | | -# ./validate-deploy.sh ${{ matrix.platform }} ${{ env.NAMESPACE }} |
72 | | - |
73 | | - # Destroy |
74 | | -# - name: Destroy ${{ matrix.platform }} |
75 | | -# run: | |
76 | | -# cd /tmp/workspace |
77 | | -# ./destroy.sh |
| 30 | + - name: Verify deploy on ${{ matrix.platform }} |
| 31 | + uses: ibm-garage-cloud/action-module-verify-deploy@main |
| 32 | + with: |
| 33 | + clusterId: ${{ matrix.platform }} |
| 34 | + validateDeployScript: .github/scripts/validate-deploy.sh |
| 35 | + testStagesDir: ./terraform/stages |
| 36 | + env: |
| 37 | + TF_VAR_ibmcloud_api_key: ${{ secrets.IBMCLOUD_API_KEY }} |
| 38 | + IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }} |
| 39 | + |
| 40 | + - name: Verify destroy on ${{ matrix.platform }} |
| 41 | + uses: ibm-garage-cloud/action-module-verify-destroy@main |
| 42 | + if: ${{ always() }} |
| 43 | + with: |
| 44 | + clusterId: ${{ matrix.platform }} |
| 45 | + testStagesDir: ./terraform/stages |
| 46 | + env: |
| 47 | + TF_VAR_ibmcloud_api_key: ${{ secrets.IBMCLOUD_API_KEY }} |
| 48 | + IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }} |
78 | 49 |
|
79 | | - # Test destroy |
80 | | -# - name: Validate destroy ${{ matrix.platform }} |
81 | | -# run: | |
82 | | -# cd /tmp/workspace |
83 | | -# ./capture-cluster-state.sh ${{ matrix.platform }} $PWD/cluster-state/before $PWD/cluster-state/after |
84 | | -# if diff -q $PWD/cluster-state/before $PWD/cluster-state/after 1> /dev/null; then |
85 | | -# echo "Destroy completed successfully" |
86 | | -# else |
87 | | -# echo "Resources don't match" |
88 | | -# diff $PWD/cluster-state/before $PWD/cluster-state/after |
89 | | -# exit 1 |
90 | | -# fi |
91 | 50 | label: |
92 | 51 | # The type of runner that the job will run on |
93 | 52 | needs: verify |
|
0 commit comments