|
1 | 1 | name: Verify and release module |
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 | push: |
7 | | - branches: [ master ] |
| 7 | + branches: [ main ] |
8 | 8 | pull_request: |
9 | | - branches: [ master ] |
| 9 | + branches: [ main ] |
10 | 10 |
|
11 | 11 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel |
12 | 12 | jobs: |
13 | 13 | verify: |
14 | | - # The type of runner that the job will run on |
15 | | - if: "!contains(github.event.commits[0].message, '[skip ci]')" |
| 14 | + if: ${{ !contains( github.event.pull_request.labels.*.name, 'skip ci' ) }} |
16 | 15 | runs-on: ubuntu-latest |
17 | | - container: ibmgaragecloud/cli-tools:0.8.0-lite |
| 16 | + container: quay.io/ibmgaragecloud/cli-tools:v0.9.0-lite |
18 | 17 |
|
19 | 18 | strategy: |
20 | 19 | matrix: |
21 | | - platform: [ocp44_vpc] |
22 | | -# max-parallel: 1 |
| 20 | + platform: [ocp4_latest] |
| 21 | + # max-parallel: 1 |
23 | 22 | fail-fast: false |
24 | 23 |
|
25 | 24 | env: |
26 | 25 | HOME: /home/devops |
27 | | - NAMESPACE: ${{ secrets.NAMESPACE }} |
28 | | - TF_VAR_tools_namespace: ${{ secrets.NAMESPACE }} |
29 | | - TF_VAR_ibmcloud_api_key: ${{ secrets.IBMCLOUD_API_KEY }} |
30 | | - IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }} |
31 | | - TF_VAR_resource_group_name: ${{ secrets.TEST_RESOURCE_GROUP }} |
32 | | - TF_VAR_region: ${{ secrets.TEST_REGION }} |
33 | | - TF_VAR_cluster_name: ${{ secrets[format('TEST_CLUSTER_{0}', matrix.platform)] }} |
34 | | - TF_VAR_cluster_type: ${{ matrix.platform }} |
35 | | - TF_VAR_vpc_cluster: ${{ endswith(matrix.platform, 'vpc') }} |
36 | | - TF_VAR_cluster_exists: "true" |
37 | 26 |
|
38 | 27 | # Steps represent a sequence of tasks that will be executed as part of the job |
39 | 28 | 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 | 29 | - name: Checkout |
50 | 30 | uses: actions/checkout@v1 |
51 | 31 |
|
52 | 32 | # Setups up the task |
53 | | - - name: Setup ${{ matrix.platform }} |
54 | | - run: | |
55 | | - ls -lA |
56 | | - mkdir -p /tmp/workspace/module |
57 | | - cp -R ./.github/scripts/* /tmp/workspace |
58 | | - cp -R ./test/stages/* /tmp/workspace |
59 | | - cp -R . /tmp/workspace/module |
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 |
78 | | -
|
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 |
| 33 | + - name: Verify on ${{ matrix.platform }} |
| 34 | + uses: ibm-garage-cloud/action-module-verify@main |
| 35 | + with: |
| 36 | + clusterId: ${{ matrix.platform }} |
| 37 | + env: |
| 38 | + TF_VAR_ibmcloud_api_key: ${{ secrets.IBMCLOUD_API_KEY }} |
| 39 | + IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }} |
91 | 40 |
|
92 | 41 | release: |
93 | | - # Steps represent a sequence of tasks that will be executed as part of the job |
94 | 42 | # if: ${{ github.event_name == 'push' }} |
95 | 43 | needs: verify |
96 | 44 | runs-on: ubuntu-latest |
97 | | - if: ${{ github.event_name == 'push' && !contains(github.event.commits[0].message, '[skip release]') }} |
| 45 | + if: ${{ github.event_name == 'push' }} |
98 | 46 |
|
99 | 47 | # Steps represent a sequence of tasks that will be executed as part of the job |
100 | 48 | steps: |
101 | | - # Drafts your next Release notes as Pull Requests are merged into "master" |
| 49 | + # Drafts your next Release notes as Pull Requests are merged into "main" |
102 | 50 | - uses: release-drafter/release-drafter@v5 |
103 | 51 | with: |
104 | 52 | # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml |
105 | 53 | config-name: release-drafter.yaml |
106 | 54 | publish: true |
107 | 55 | env: |
108 | 56 | GITHUB_TOKEN: ${{ secrets.TOKEN }} |
109 | | - |
0 commit comments