|
1 | | -name: Lint, test and security scan |
| 1 | +name: Build workflow - Forwarder |
2 | 2 | on: |
3 | 3 | push: |
4 | 4 | branches: |
5 | 5 | - master |
| 6 | + paths: |
| 7 | + - .github/workflows/build-forwarder.yml |
| 8 | + - AKSKubeAuditReceiverSolution/ |
6 | 9 | pull_request: |
7 | 10 | branches: |
8 | 11 | - master |
9 | | - page_build: |
| 12 | + paths: |
| 13 | + - .github/workflows/build-forwarder.yml |
| 14 | + - AKSKubeAuditReceiverSolution/ |
10 | 15 | workflow_dispatch: |
11 | 16 | release: |
12 | 17 | types: |
13 | 18 | - published |
14 | 19 |
|
15 | 20 | jobs: |
16 | | - check_bash_installer: |
17 | | - name: Bash shell lint check |
18 | | - if: github.event_name != 'release' |
19 | | - # This action fails for release event because it can't find the commit SHA |
20 | | - runs-on: ubuntu-16.04 |
21 | | - steps: |
22 | | - - name: Checkout repo |
23 | | - uses: actions/checkout@v2 |
24 | | - - name: Bash shell lint check with shellcheck |
25 | | - uses: reviewdog/action-shellcheck@v1 |
26 | | - with: |
27 | | - github_token: ${{ secrets.GITHUB_TOKEN }} |
28 | | - reporter: github-check |
29 | | - level: error |
30 | | - pattern: '*.sh' |
31 | | - path: '.' |
32 | | - exclude: './test/*' |
33 | 21 |
|
34 | 22 | check_yaml: |
35 | 23 | name: YAML lint check |
|
76 | 64 | - name: Dotnet test solution |
77 | 65 | run: dotnet test AKSKubeAuditReceiverSolution/AKSKubeAuditReceiver.sln |
78 | 66 |
|
79 | | - sysdig_dockerfile_cis_benchmark_forwarder: |
80 | | - name: Sysdig Dockerfile CIS benchmark - Forwarder |
| 67 | + sysdig_dockerfile_cis_benchmark: |
| 68 | + name: Sysdig Dockerfile CIS benchmark |
81 | 69 | needs: [check_yaml, check_dotnet] |
82 | 70 | runs-on: ubuntu-16.04 |
83 | 71 | steps: |
@@ -108,87 +96,26 @@ jobs: |
108 | 96 | curl -X POST -s https://app.sysdigcloud.com/api/events -H 'Content-Type: application/json; charset=UTF-8' -H 'Authorization: Bearer '"${SYSDIG_SECURE_TOKEN}"'' -d '{"event":{"name":"CIS Dockerfile Benchmark - PR: '"${PR_TITLE}"' ","description":"'"${reportString}"'","severity":"6"}}' --compressed |
109 | 97 | echo "###" |
110 | 98 |
|
111 | | - sysdig_dockerfile_cis_benchmark_installer: |
112 | | - name: Sysdig Dockerfile CIS benchmark - Installer |
113 | | - needs: [check_bash_installer] |
114 | | - runs-on: ubuntu-16.04 |
115 | | - steps: |
116 | | - - name: Checkout repo |
117 | | - uses: actions/checkout@v2 |
118 | | - - name: Sysdig CIS dockerfile benchmark |
119 | | - uses: sysdiglabs/[email protected] |
120 | | - id: cis_dockerfile_benchmark |
121 | | - with: |
122 | | - directory: './build' |
123 | | - dockerfilePattern: 'Dockerfile' |
124 | | - disallowedPackages: 'netcat' |
125 | | - secretPatterns: 'aws_secret,pass' |
126 | | - - name: Post run Sysdig CIS dockerfile benchmark |
127 | | - env: |
128 | | - SYSDIG_SECURE_TOKEN: ${{ secrets.KUBELAB_SECURE_API_TOKEN }} |
129 | | - PR_TITLE: ${{ github.event.pull_request.title }} |
130 | | - PR_SHA: ${{ github.event.pull_request.head.sha }} |
131 | | - PR_OWNER: ${{ github.event.pull_request.head.user.login }} |
132 | | - run: | |
133 | | - echo "###" |
134 | | - echo "{\"pr_name\": \"${PR_TITLE}\", \"pr_sha\": \"${PR_SHA}\", \"pr_owner\": \"${PR_OWNER}\"}" > /tmp/report.json |
135 | | - echo ${{ toJSON(steps.cis_dockerfile_benchmark.outputs.violation_report) }} > /tmp/report |
136 | | - reportString=$(sed 's/"/\\"/g' /tmp/report) |
137 | | - echo $reportString |
138 | | - # send result to Sysdig monitor |
139 | | - curl -X POST -s https://app.sysdigcloud.com/api/events -H 'Content-Type: application/json; charset=UTF-8' -H 'Authorization: Bearer '"${SYSDIG_SECURE_TOKEN}"'' -d '{"event":{"name":"CIS Dockerfile Benchmark - PR: '"${PR_TITLE}"' ","description":"'"${reportString}"'","severity":"6"}}' --compressed |
140 | | - echo "###" |
141 | | -
|
142 | | -
|
143 | | - sysdig_image_scan_forwarder: |
144 | | - name: Sysdig image scan - Forwarder |
| 99 | + sysdig_image_scan: |
| 100 | + name: Sysdig image scan |
145 | 101 | needs: [check_yaml, check_dotnet] |
146 | 102 | runs-on: ubuntu-16.04 |
147 | 103 | steps: |
148 | 104 | - name: Checkout repo |
149 | 105 | uses: actions/checkout@v2 |
150 | 106 | - name: Build the Docker image |
151 | | - run: docker build -f ./AKSKubeAuditReceiverSolution/AKSKubeAuditReceiver/Dockerfile ./AKSKubeAuditReceiverSolution --tag sysdiglabs/aks-audit-log-forwarder |
| 107 | + run: | |
| 108 | + docker build -f ./AKSKubeAuditReceiverSolution/AKSKubeAuditReceiver/Dockerfile \ |
| 109 | + ./AKSKubeAuditReceiverSolution --tag sysdiglabs/aks-audit-log-forwarder |
152 | 110 | - name: Sysdig Secure inline image scan |
153 | 111 | uses: sysdiglabs/scan-action@v2 |
154 | 112 | with: |
155 | 113 | image-tag: "sysdiglabs/aks-audit-log-forwarder" |
156 | 114 | sysdig-secure-token: ${{ secrets.KUBELAB_SECURE_API_TOKEN }} |
157 | 115 |
|
158 | | - sysdig_image_scan_installer: |
159 | | - name: Sysdig image scan - Installer |
160 | | - needs: [check_bash_installer] |
161 | | - runs-on: ubuntu-16.04 |
162 | | - steps: |
163 | | - - name: Checkout repo |
164 | | - uses: actions/checkout@v2 |
165 | | - - name: Build the Docker image |
166 | | - run: docker build -f ./build/Dockerfile . --tag sysdiglabs/aks-audit-log-installer |
167 | | - - name: Pull Sysdig inline scan |
168 | | - run: docker pull sysdiglabs/secure-inline-scan:2 |
169 | | - - name: Run Sysdig inline image scan |
170 | | - id: run_sysdig_inline_scan |
171 | | - env: |
172 | | - SYSDIG_SECURE_TOKEN: ${{ secrets.KUBELAB_SECURE_API_TOKEN }} |
173 | | - run: | |
174 | | - docker run sysdiglabs/secure-inline-scan:2 -s https://secure.sysdig.com -k $SYSDIG_SECURE_TOKEN sysdiglabs/aks-audit-log-installer \ |
175 | | - | tee sysdig_image_scan_installer_result.txt |
176 | | - SCAN_RESULT=${PIPESTATUS[0]} |
177 | | - echo "::set-output name=SCAN_RESULT::$SCAN_RESULT" |
178 | | - echo "Scan finished with result: $SCAN_RESULT" |
179 | | - - name: Scan result |
180 | | - env: |
181 | | - SCAN_RESULT: ${{ steps.run_sysdig_inline_scan.outputs.SCAN_RESULT }} |
182 | | - run: | |
183 | | - cat sysdig_image_scan_installer_result.txt |
184 | | - echo "Scan result: $SCAN_RESULT" |
185 | | - # exit $SCAN_RESULT |
186 | | -
|
187 | | - publish_images: |
188 | | - name: Publish container images to registries |
189 | | - needs: [sysdig_image_scan_forwarder] |
190 | | - # We do not depend on scan of installer as check_shell can't run on release, |
191 | | - # and scan for installer result is skipped |
| 116 | + publish_image: |
| 117 | + name: Publish container image to registries |
| 118 | + needs: [sysdig_image_scan] |
192 | 119 | runs-on: ubuntu-16.04 |
193 | 120 | if: github.event_name == 'release' |
194 | 121 | steps: |
@@ -217,22 +144,13 @@ jobs: |
217 | 144 | echo "Version tag: $VERSION_TAG" |
218 | 145 | VERSION_MAJOR=$(echo $VERSION_TAG | sed 's/[^0-9]*\([0-9]\+\).*/\1/') |
219 | 146 | VERSION_FULL=$(echo $VERSION_TAG | sed 's/[^0-9]*\([0-9]\+.*\)/\1/') |
| 147 | + [ -z $VERSION_FULL ] VERSION_FULL="master" |
| 148 | + [ -z $VERSION_MAJOR ] VERSION_FULL="master" |
220 | 149 | echo "Version major: $VERSION_MAJOR" |
221 | 150 | echo "Version full: $VERSION_FULL" |
222 | 151 | echo "::set-output name=VERSION_MAJOR::$VERSION_MAJOR" |
223 | 152 | echo "::set-output name=VERSION_FULL::$VERSION_FULL" |
224 | | - - name: Build and push - Installer |
225 | | - uses: docker/build-push-action@v2 |
226 | | - with: |
227 | | - context: . |
228 | | - file: ./build/Dockerfile |
229 | | - platforms: linux/amd64 |
230 | | - push: true |
231 | | - tags: | |
232 | | - sysdiglabs/aks-audit-log-installer:latest |
233 | | - sysdiglabs/aks-audit-log-installer:${{ steps.prepare_version_labels.outputs.VERSION_MAJOR }} |
234 | | - sysdiglabs/aks-audit-log-installer:${{ steps.prepare_version_labels.outputs.VERSION_FULL }} |
235 | | - - name: Build and push - Forwarder |
| 153 | + - name: Build and push |
236 | 154 | uses: docker/build-push-action@v2 |
237 | 155 | with: |
238 | 156 | context: AKSKubeAuditReceiverSolution/ |
|
0 commit comments