-
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.
- Loading branch information
Showing
20 changed files
with
609 additions
and
65 deletions.
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
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
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
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,173 @@ | ||
name: Publish Docker images | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*-*' | ||
env: | ||
REGISTRY: docker.io | ||
|
||
# Ensure we don't have multiple workflows running for the same ref | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
outputs: | ||
docker_login: ${{ steps.docker_login.outcome }} | ||
steps: | ||
- name: Log in to Docker Hub | ||
id: docker_login | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
federation-server: | ||
needs: setup | ||
if: needs.setup.outputs.docker_login == 'success' | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Gradle cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Install Syft | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin | ||
- name: Setup Snyk | ||
uses: snyk/actions/setup@master | ||
|
||
- name: Authenticate Snyk | ||
run: snyk auth ${{ secrets.SNYK_TOKEN }} | ||
- name: Extract metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-server | ||
strip.prefix: true | ||
tags: | | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=sha,format=long | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
- name: Build and push image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./.docker/federation-server/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: | | ||
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-server:buildcache | ||
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-base:buildcache | ||
cache-to: | | ||
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-server:buildcache,mode=max | ||
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-base:buildcache,mode=max | ||
- name: Scan Federation Server dependencies | ||
run: timeout 300s snyk test --all-projects --severity-threshold=high || exit 1 | ||
|
||
admin-server: | ||
needs: setup | ||
if: needs.setup.outputs.docker_login == 'success' | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Gradle cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Install Syft | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin | ||
- name: Setup Snyk | ||
uses: snyk/actions/setup@master | ||
|
||
- name: Authenticate Snyk | ||
run: snyk auth ${{ secrets.SNYK_TOKEN }} | ||
|
||
- name: Extract metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-admin-server | ||
strip.prefix: true | ||
tags: | | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=sha,format=long | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
- name: Build and push image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./.docker/admin-server/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: | | ||
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-admin-server:buildcache | ||
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-base:buildcache | ||
cache-to: | | ||
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-admin-server:buildcache,mode=max | ||
type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-base:buildcache,mode=max | ||
- name: Generate SBOM | ||
run: syft ${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-admin-server:latest -o spdx-json > admin-server-sbom.json | ||
|
||
- name: Scan Admin Server dependencies | ||
run: timeout 300s snyk test --all-projects --severity-threshold=high || exit 1 | ||
|
||
- name: Scan Admin Server container | ||
run: timeout 300s snyk container test ${{ secrets.DOCKERHUB_USERNAME }}/openid-federation-admin-server:latest --severity-threshold=high --file=./.docker/admin-server/Dockerfile || exit 1 | ||
|
||
- name: Upload SBOM | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: admin-server-sbom | ||
path: admin-server-sbom.json |
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
Oops, something went wrong.