Skip to content

Commit e66f12d

Browse files
committed
Merge branch 'main' into github
2 parents 62f291b + 37f3ff1 commit e66f12d

2 files changed

Lines changed: 110 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
tags: ["**"]
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
name: Build ${{ matrix.service }}
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
service:
16+
- correctedforecaster
17+
- healthz
18+
- jsonfrontend
19+
- moxfrontend
20+
- rawdataforecaster
21+
- xmlfrontend
22+
env:
23+
IMAGE: fortiregistry.azurecr.io/${{ matrix.service }}:${{ github.run_id }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Log in to Azure Container Registry
28+
run: docker login -u ${{ secrets.AZURE_REGISTRY_USERNAME }} -p ${{ secrets.AZURE_REGISTRY_PASSWORD }} fortiregistry.azurecr.io
29+
30+
- name: Build and push
31+
run: |
32+
docker build -t $IMAGE -f ${{ matrix.service }}/build/package/Dockerfile .
33+
docker push $IMAGE
34+
35+
fortiup:
36+
name: Build fortiup
37+
runs-on: ubuntu-latest
38+
if: startsWith(github.ref, 'refs/tags/fortiup')
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
# Produce a filesystem-safe slug from the tag name (e.g. fortiup/0.4.0 -> fortiup-0-4-0),
43+
# mirroring GitLab's $CI_COMMIT_REF_SLUG behaviour.
44+
- name: Create ref slug
45+
id: slug
46+
run: echo "slug=$(echo '${{ github.ref_name }}' | tr '/.' '-')" >> "$GITHUB_OUTPUT"
47+
48+
- name: Build image and extract binary
49+
env:
50+
IMAGE: fortiregistry.azurecr.io/fortiup:${{ github.run_id }}
51+
run: |
52+
docker build -t $IMAGE -f fortiup/build/package/Dockerfile .
53+
docker run --rm --entrypoint cat $IMAGE /usr/local/bin/fortiup > ${{ steps.slug.outputs.slug }}
54+
chmod +x ${{ steps.slug.outputs.slug }}
55+
56+
- name: Upload binary artifact
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: ${{ steps.slug.outputs.slug }}
60+
path: ${{ steps.slug.outputs.slug }}
61+
62+
vulncheck:
63+
name: Vulnerability check
64+
needs: [build]
65+
runs-on: ubuntu-latest
66+
container:
67+
# Requires AZURE_REGISTRY_USERNAME and AZURE_REGISTRY_PASSWORD secrets to pull the image.
68+
# Build/push the devcontainer image via the devcontainer.yml workflow when it changes.
69+
image: fortiregistry.azurecr.io/devcontainer:latest
70+
credentials:
71+
username: ${{ secrets.AZURE_REGISTRY_USERNAME }}
72+
password: ${{ secrets.AZURE_REGISTRY_PASSWORD }}
73+
steps:
74+
- uses: actions/checkout@v4
75+
- run: govulncheck ./...
76+
77+
# trivy-scan:
78+
# name: Trivy Dockerfile scan
79+
# needs: [build]
80+
# runs-on: ubuntu-latest
81+
# container:
82+
# image: aquasec/trivy
83+
# steps:
84+
# - uses: actions/checkout@v4
85+
# - name: Scan all Dockerfiles
86+
# run: |
87+
# for dockerfile in */build/package/Dockerfile; do
88+
# echo "Scanning $dockerfile"
89+
# trivy fs --exit-code 1 --severity MEDIUM,HIGH,CRITICAL \
90+
# --scanners vuln,secret,license,misconfig "$dockerfile"
91+
# done

.github/workflows/devcontainer.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Devcontainer image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
devcontainer:
8+
name: Build and push devcontainer image
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Log in to Azure Container Registry
14+
run: docker login -u ${{ secrets.AZURE_REGISTRY_USERNAME }} -p ${{ secrets.AZURE_REGISTRY_PASSWORD }} fortiregistry.azurecr.io
15+
16+
- name: Build and push
17+
run: |
18+
docker build -t fortiregistry.azurecr.io/devcontainer:latest -f .devcontainer/Dockerfile .
19+
docker push fortiregistry.azurecr.io/devcontainer:latest

0 commit comments

Comments
 (0)