Skip to content

Commit 0a1ed5a

Browse files
author
Sean Sundberg
authored
Updates workflow scripts to use actions (#16)
1 parent eb5e87c commit 0a1ed5a

File tree

3 files changed

+27
-96
lines changed

3 files changed

+27
-96
lines changed

.github/workflows/notify.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
name: Notify Iteration Zero
21
on:
32
release:
43
types: [published]
@@ -7,10 +6,11 @@ jobs:
76
notify:
87
runs-on: ubuntu-latest
98

10-
env:
11-
NOTIFY_SLUG: ibm-garage-cloud/ibm-garage-iteration-zero
12-
139
steps:
1410
- name: Publish repository dispatch
15-
run: |
16-
curl -XPOST -u "${{secrets.USERNAME}}:${{secrets.TOKEN}}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/${{env.NOTIFY_SLUG}}/dispatches --data '{"event_type": "released"}'
11+
uses: ibm-garage-cloud/action-repository-dispatch@main
12+
with:
13+
notifyRepo: ibm-garage-cloud/ibm-garage-iteration-zero
14+
eventType: released
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.TOKEN }}

.github/workflows/publish-assets.yaml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,12 @@ jobs:
1919
with:
2020
ref: ${{ github.event.release.tag_name }}
2121

22-
- name: Install yq
23-
run: |
24-
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CC86BB64
25-
sudo add-apt-repository ppa:rmescandon/yq
26-
sudo apt update
27-
sudo apt install yq -y
28-
29-
- name: Build module.yaml
30-
run: |
31-
./.github/scripts/build-module-metadata.sh ${{ github.event.release.tag_name }} ${{ env.DIST_DIR }} ${{ github.repository }}
32-
cp README.md ${{ env.DIST_DIR }}
33-
mkdir ./scripts && cp ./.github/scripts/merge-module-metadata.sh ./scripts
34-
35-
- name: Checkout
36-
uses: actions/checkout@v2
22+
- name: Build catalog
23+
uses: ibm-garage-cloud/action-module-catalog@main
3724
with:
38-
ref: ${{ env.PUBLISH_BRANCH }}
39-
clean: false
40-
41-
- name: Build index.yaml
42-
run: |
43-
./scripts/merge-module-metadata.sh ${{ env.DIST_DIR }}
25+
tagName: ${{ github.event.release.tag_name }}
26+
distDir: ${{ env.DIST_DIR }}
27+
publishBranch: ${{ env.PUBLISH_BRANCH }}
4428

4529
- name: Deploy
4630
uses: peaceiris/actions-gh-pages@v3

.github/workflows/verify.yaml

Lines changed: 16 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,56 @@
11
name: Verify and release module
22

33
# 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
55
on:
66
push:
7-
branches: [ master ]
7+
branches: [ main ]
88
pull_request:
9-
branches: [ master ]
9+
branches: [ main ]
1010

1111
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1212
jobs:
1313
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' ) }}
1615
runs-on: ubuntu-latest
17-
container: ibmgaragecloud/cli-tools:0.8.0-lite
16+
container: quay.io/ibmgaragecloud/cli-tools:v0.9.0-lite
1817

1918
strategy:
2019
matrix:
21-
platform: [ocp44_vpc]
22-
# max-parallel: 1
20+
platform: [ocp4_latest]
21+
# max-parallel: 1
2322
fail-fast: false
2423

2524
env:
2625
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"
3726

3827
# Steps represent a sequence of tasks that will be executed as part of the job
3928
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-
4929
- name: Checkout
5030
uses: actions/checkout@v1
5131

5232
# 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 }}
9140

9241
release:
93-
# Steps represent a sequence of tasks that will be executed as part of the job
9442
# if: ${{ github.event_name == 'push' }}
9543
needs: verify
9644
runs-on: ubuntu-latest
97-
if: ${{ github.event_name == 'push' && !contains(github.event.commits[0].message, '[skip release]') }}
45+
if: ${{ github.event_name == 'push' }}
9846

9947
# Steps represent a sequence of tasks that will be executed as part of the job
10048
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"
10250
- uses: release-drafter/release-drafter@v5
10351
with:
10452
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
10553
config-name: release-drafter.yaml
10654
publish: true
10755
env:
10856
GITHUB_TOKEN: ${{ secrets.TOKEN }}
109-

0 commit comments

Comments
 (0)