-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bats): construction de l'image via GitHub Actions (#1)
* feat(bats): construction de l'image via GitHub Actions * feat: worklow on changes * feat: push docker image * fix: image tag * fix: image tag * feat: docker linter * feat: scan de vulnérabilité * fix: container registry authentification * fix: security issues * Update bats/README.md Co-authored-by: hvle <[email protected]> * feat(pipeline): trigger workflow on main branch * docs: MIT licence --------- Co-authored-by: Hong Viet Le <[email protected]> Co-authored-by: Joseph Page <[email protected]>
- Loading branch information
1 parent
d5fac11
commit 2435317
Showing
5 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
name: Build bats docker image | ||
run-name: ${{ github.actor }} is building bats | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
paths: | ||
- 'bats/**' | ||
pull_request: | ||
branches: [ "main" ] | ||
paths: | ||
- 'bats/**' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_TAG: ${{ github.repository }}/bats:v1.10.0-curl | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: bats | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_TAG }} | ||
|
||
scan: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: read | ||
needs: build | ||
steps: | ||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_TAG }} | ||
format: 'table' | ||
exit-code: '1' | ||
ignore-unfixed: true | ||
vuln-type: 'os,library' | ||
severity: 'CRITICAL,HIGH' | ||
env: | ||
TRIVY_USERNAME: ${{ github.actor }} | ||
TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Dockerfile linting | ||
uses: hadolint/[email protected] | ||
with: | ||
dockerfile: bats/Dockerfile | ||
ignore: DL3018 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 OCTO Technology | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# Formation-DKADM | ||
# Docker images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM bats/bats:v1.10.0 | ||
|
||
RUN apk update && apk upgrade --no-cache && \ | ||
apk add --no-cache curl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# BATS | ||
|
||
## Pourquoi | ||
|
||
L'image précédemment utilisée `dduportal/bats:0.4.0` n'est plus disponible sur Docker Hub. | ||
|
||
## Références | ||
|
||
Cette image est utilisée dans les formations suivantes : | ||
- 🦊 [GITLA](https://www.octo.academy/catalogue/formation/gitla-gitlab-ci-et-cd-gestion-des-sources-et-integration-continue-avec-gitlab/), repo : https://gitlab.com/octo-technology/octo-ops/gitlab-formation |