Skip to content

Commit 40c1e1e

Browse files
Update lab04.md
1 parent 52c5d05 commit 40c1e1e

1 file changed

Lines changed: 6 additions & 134 deletions

File tree

labs/lab04.md

Lines changed: 6 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 4 - Workflow Templates
1+
# 4 - Adding Additional DevSecOps Controls
22
In this lab you will reuse workflow templates.
33
> Duration: 10-15 minutes
44
@@ -8,144 +8,16 @@ References:
88
- [Sharing actions and workflows with your enterprise](https://docs.github.com/en/enterprise-cloud@latest/actions/creating-actions/sharing-actions-and-workflows-with-your-enterprise)
99
- [Using starter workflows](https://docs.github.com/en/actions/using-workflows/advanced-workflow-features#using-starter-workflows)
1010

11-
## 4.1 Create a reusable workflow
11+
## 4.1 Secret Scanning with Gitleaks
1212

1313
1. For a workflow to be reusable, the `on` must include the `workflow_call` event
14-
2. Open the workflow file [job-dependencies.yml](/.github/workflows/job-dependencies.yml)
15-
3. Edit the file and update the workflow to run on workflow call event
16-
```YAML
17-
on:
18-
workflow_call:
19-
```
20-
4. Commit the changes into a new `feature/lab04` branch
21-
5. Go to `Code` and select the `feature/lab04` from the branches drop down list
22-
6. Open the workflow file [reusable-workflow-template.yml](/.github/workflows/reusable-workflow-template.yml)
23-
7. Edit the file and copy the following YAML content at the end of the file:
24-
```YAML
25-
call_dependencies_workflow_job:
26-
needs: call_reusable_workflow_job
27-
uses: <YOUR_USER_ACCOUNT>/gh-abcs-actions/.github/workflows/job-dependencies.yml@main
28-
```
29-
8. Update the workflow to run on push events
30-
```YAML
31-
on:
32-
push:
33-
branches: [main]
34-
workflow_dispatch:
35-
```
36-
9. Commit the changes into the same `feature/lab04` branch
37-
10. Open a new pull request from `Pull requests`
38-
> Make sure it is your repository pull request to not propose changes to the upstream repository. From the drop-down list choose the base repository to be yours.
39-
11. Complete the pull request and delete the source branch
40-
12. Go to `Actions` and see the details of your running workflow
4114

42-
## 4.2 Final
43-
<details>
44-
<summary>job-dependencies.yml</summary>
45-
46-
```YAML
47-
name: 02-2. Dependencies
4815

49-
on:
50-
workflow_dispatch:
51-
push:
52-
branches:
53-
- main
54-
workflow_call:
55-
56-
jobs:
57-
initial:
58-
runs-on: ubuntu-latest
59-
steps:
60-
- run: echo "This job will be run first."
61-
fanout1:
62-
runs-on: ubuntu-latest
63-
needs: initial
64-
steps:
65-
- run: echo "This job will run after the initial job, in parallel with fanout2."
66-
fanout2:
67-
runs-on: ubuntu-latest
68-
needs: initial
69-
steps:
70-
- run: echo "This job will run after the initial job, in parallel with fanout1."
71-
fanout3:
72-
runs-on: ubuntu-latest
73-
needs: fanout1
74-
steps:
75-
- run: echo "This job will run after the initial job, in parallel with fanout2."
76-
fanin:
77-
runs-on: ubuntu-latest
78-
needs: [fanout1, fanout2]
79-
steps:
80-
- run: echo "This job will run after fanout1 and fanout2 have finished."
81-
build:
82-
runs-on: ubuntu-latest
83-
strategy:
84-
matrix:
85-
configuration: [debug, release]
86-
steps:
87-
- run: echo "This job builds the cofiguration ${{ matrix.configuration }}."
88-
test:
89-
runs-on: ubuntu-latest
90-
needs: build
91-
steps:
92-
- run: echo "This job will be run after the build job."
93-
ring01:
94-
runs-on: ubuntu-latest
95-
needs: test
96-
steps:
97-
- run: echo "This job will be run after the test job."
98-
ring02:
99-
runs-on: macos-latest
100-
needs: test
101-
steps:
102-
- run: echo "This job will be run after the test job."
103-
ring03:
104-
runs-on: ubuntu-latest
105-
needs: test
106-
steps:
107-
- run: echo "This job will be run after the test job."
108-
ring04:
109-
runs-on: ubuntu-latest
110-
needs: [ring01,ring02,ring03]
111-
steps:
112-
- run: echo "This job will be run after the ring01,ring02,ring03 jobs."
113-
prod:
114-
runs-on: ubuntu-latest
115-
needs: [ring04]
116-
steps:
117-
- run: echo "This job will be run after the ring04 job."
118-
```
119-
</details>
16+
## 4.2 Software Composition Analysis with OWASP Dependency Check
12017

121-
<details>
122-
<summary>reusable-workflow-template.yml</summary>
123-
124-
```YAML
125-
name: 04-1. Call Reusable Workflow Templates
18+
1. Uncommant the action
12619

127-
on:
128-
push:
129-
branches: [main]
130-
workflow_dispatch:
20+
## 4.3 Static Application Security Test with CodeQL
13121

132-
jobs:
133-
call_greet_everyone_workflow_job:
134-
uses: githubabcs/gh-abcs-actions/.github/workflows/greet-everyone.yml@main
135-
with:
136-
name: 'Reusable Workflow Templates'
137-
138-
call_reusable_workflow_job:
139-
uses: githubabcs/gh-abcs-actions/.github/workflows/super-linter.yml@main
140-
141-
call_demo_workflow_job:
142-
needs: call_greet_everyone_workflow_job
143-
uses: githubabcs/gh-abcs-actions/.github/workflows/github-actions-demo.yml@main
144-
145-
call_dependencies_workflow_job:
146-
needs: call_reusable_workflow_job
147-
uses: <YOUR_USER_ACCOUNT>/gh-abcs-actions/.github/workflows/job-dependencies.yml@main
148-
149-
```
150-
</details>
22+
1. Enable
15123

0 commit comments

Comments
 (0)