-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
b854525
commit 90ee2e0
Showing
7 changed files
with
349 additions
and
349 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,72 @@ | ||
name: docker-build-push | ||
# name: docker-build-push | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
IMAGE: | ||
required: true | ||
type: string | ||
IMAGE_REGISTRY: | ||
required: true | ||
type: string | ||
WORKDIR: | ||
required: true | ||
type: string | ||
secrets: | ||
IMAGE_REGISTRY_USER: | ||
required: true | ||
IMAGE_REGISTRY_PASSWORD: | ||
required: true | ||
jobs: | ||
build: | ||
name: Docker Build | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
steps: | ||
- name: Inject slug/short variables | ||
uses: rlespinasse/[email protected] | ||
- uses: actions/checkout@v2 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.IMAGE_REGISTRY_USER }} | ||
password: ${{ secrets.IMAGE_REGISTRY_PASSWORD }} | ||
- name: Build | ||
working-directory: ${{ inputs.WORKDIR }} | ||
run: > | ||
docker buildx build | ||
--platform=linux/amd64 | ||
-t ${{ inputs.IMAGE_REGISTRY }}/${{ inputs.IMAGE }}:${{ env.GITHUB_SHA_SHORT }} | ||
--output=type=image,push=true | ||
${GITHUB_WORKSPACE}/${{ inputs.WORKDIR }} | ||
push: | ||
name: Docker Push | ||
needs: build | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
steps: | ||
- name: Inject slug/short variables | ||
uses: rlespinasse/[email protected] | ||
- uses: actions/checkout@v2 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.IMAGE_REGISTRY_USER }} | ||
password: ${{ secrets.IMAGE_REGISTRY_PASSWORD }} | ||
- name: Tag Push Latest | ||
working-directory: ${{ inputs.WORKDIR }} | ||
run: > | ||
docker buildx build | ||
--platform=linux/amd64 | ||
-t ${{ inputs.IMAGE }}:${{ env.GITHUB_SHA_SHORT }} | ||
-t ${{ inputs.IMAGE }}:latest | ||
--output=type=image,push=true | ||
${GITHUB_WORKSPACE}/${{ inputs.WORKDIR }} | ||
# on: | ||
# workflow_call: | ||
# inputs: | ||
# IMAGE: | ||
# required: true | ||
# type: string | ||
# IMAGE_REGISTRY: | ||
# required: true | ||
# type: string | ||
# WORKDIR: | ||
# required: true | ||
# type: string | ||
# secrets: | ||
# IMAGE_REGISTRY_USER: | ||
# required: true | ||
# IMAGE_REGISTRY_PASSWORD: | ||
# required: true | ||
# jobs: | ||
# build: | ||
# name: Docker Build | ||
# runs-on: ubuntu-latest | ||
# timeout-minutes: 60 | ||
# steps: | ||
# - name: Inject slug/short variables | ||
# uses: rlespinasse/[email protected] | ||
# - uses: actions/checkout@v2 | ||
# - name: Set up QEMU | ||
# uses: docker/setup-qemu-action@v1 | ||
# - name: Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@v1 | ||
# - name: Login to DockerHub | ||
# uses: docker/login-action@v1 | ||
# with: | ||
# username: ${{ secrets.IMAGE_REGISTRY_USER }} | ||
# password: ${{ secrets.IMAGE_REGISTRY_PASSWORD }} | ||
# - name: Build | ||
# working-directory: ${{ inputs.WORKDIR }} | ||
# run: > | ||
# docker buildx build | ||
# --platform=linux/amd64 | ||
# -t ${{ inputs.IMAGE_REGISTRY }}/${{ inputs.IMAGE }}:${{ env.GITHUB_SHA_SHORT }} | ||
# --output=type=image,push=true | ||
# ${GITHUB_WORKSPACE}/${{ inputs.WORKDIR }} | ||
# push: | ||
# name: Docker Push | ||
# needs: build | ||
# runs-on: ubuntu-latest | ||
# timeout-minutes: 60 | ||
# steps: | ||
# - name: Inject slug/short variables | ||
# uses: rlespinasse/[email protected] | ||
# - uses: actions/checkout@v2 | ||
# - name: Set up QEMU | ||
# uses: docker/setup-qemu-action@v1 | ||
# - name: Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@v1 | ||
# - name: Login to DockerHub | ||
# uses: docker/login-action@v1 | ||
# with: | ||
# username: ${{ secrets.IMAGE_REGISTRY_USER }} | ||
# password: ${{ secrets.IMAGE_REGISTRY_PASSWORD }} | ||
# - name: Tag Push Latest | ||
# working-directory: ${{ inputs.WORKDIR }} | ||
# run: > | ||
# docker buildx build | ||
# --platform=linux/amd64 | ||
# -t ${{ inputs.IMAGE }}:${{ env.GITHUB_SHA_SHORT }} | ||
# -t ${{ inputs.IMAGE }}:latest | ||
# --output=type=image,push=true | ||
# ${GITHUB_WORKSPACE}/${{ inputs.WORKDIR }} |
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 |
---|---|---|
@@ -1,93 +1,93 @@ | ||
name: owasp-scan | ||
on: | ||
workflow_call: | ||
inputs: | ||
ZAP_SCAN_TYPE: | ||
required: true | ||
type: string | ||
ZAP_TARGET_URL: | ||
required: true | ||
type: string | ||
ZAP_DURATION: | ||
required: true | ||
type: string | ||
ZAP_MAX_DURATION: | ||
required: true | ||
type: string | ||
ZAP_GCP_PUBLISH: | ||
required: true | ||
type: boolean | ||
ZAP_GCP_PROJECT: | ||
required: false | ||
type: string | ||
ZAP_GCP_BUCKET: | ||
required: false | ||
type: string | ||
secrets: | ||
GCP_SA_KEY: | ||
required: false | ||
jobs: | ||
owasp-scan: | ||
runs-on: ubuntu-latest | ||
name: owasp-scan | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
- name: Set up Cloud SDK | ||
if: ${{ inputs.ZAP_GCP_PUBLISH }} | ||
uses: google-github-actions/setup-gcloud@v1 | ||
with: | ||
project_id: ${{ inputs.ZAP_GCP_PROJECT }} | ||
service_account_key: ${{ secrets.GCP_SA_KEY }} | ||
export_default_credentials: true | ||
- name: ZAP Base Scan | ||
if: ${{ inputs.ZAP_SCAN_TYPE == 'base' }} | ||
uses: zaproxy/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
docker_name: 'owasp/zap2docker-stable' | ||
target: ${{ inputs.ZAP_TARGET_URL }} | ||
rules_file_name: '.zap/rules.tsv' | ||
cmd_options: '-a -d -T ${{ inputs.ZAP_MAX_DURATION }} -m ${{ inputs.ZAP_DURATION }}' | ||
issue_title: OWAP Baseline | ||
- name: ZAP Full Scan | ||
if: ${{ inputs.ZAP_SCAN_TYPE == 'full' }} | ||
uses: zaproxy/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
docker_name: 'owasp/zap2docker-stable' | ||
target: ${{ inputs.ZAP_TARGET_URL }} | ||
rules_file_name: '.zap/rules.tsv' | ||
cmd_options: '-a -d -T ${{ inputs.ZAP_MAX_DURATION }} -m ${{ inputs.ZAP_DURATION }}' | ||
- name: Create Artifact Directory | ||
if: ${{ inputs.ZAP_GCP_PUBLISH }} | ||
run: | | ||
mkdir -p public/zap | ||
- name: Publish Reports to Github | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: zap_scan | ||
path: public/zap | ||
- name: Rename Markdown | ||
if: ${{ inputs.ZAP_GCP_PUBLISH }} | ||
run: | | ||
mv public/zap/report_md.md public/zap/README.md | ||
- name: ZAP Results | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: zap-scan | ||
folder: public/zap | ||
- name: GCP Publish Results URL | ||
if: ${{ inputs.ZAP_GCP_PUBLISH }} | ||
run: | | ||
echo "$GCP_SA_KEY" > gcp-sa-key.json | ||
gsutil mb gs://${{ inputs.ZAP_GCP_BUCKET }} || echo "Bucket already exists..." | ||
gsutil cp public/zap/report_html.html gs://${{ inputs.ZAP_GCP_BUCKET }} | ||
echo "URL expires in 10 minutes..." | ||
gsutil signurl -d 10m gcp-sa-key.json gs://${{ inputs.ZAP_GCP_BUCKET }}/report_html.html | ||
env: | ||
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} | ||
# name: owasp-scan | ||
# on: | ||
# workflow_call: | ||
# inputs: | ||
# ZAP_SCAN_TYPE: | ||
# required: true | ||
# type: string | ||
# ZAP_TARGET_URL: | ||
# required: true | ||
# type: string | ||
# ZAP_DURATION: | ||
# required: true | ||
# type: string | ||
# ZAP_MAX_DURATION: | ||
# required: true | ||
# type: string | ||
# ZAP_GCP_PUBLISH: | ||
# required: true | ||
# type: boolean | ||
# ZAP_GCP_PROJECT: | ||
# required: false | ||
# type: string | ||
# ZAP_GCP_BUCKET: | ||
# required: false | ||
# type: string | ||
# secrets: | ||
# GCP_SA_KEY: | ||
# required: false | ||
# jobs: | ||
# owasp-scan: | ||
# runs-on: ubuntu-latest | ||
# name: owasp-scan | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v2 | ||
# - name: Set up Python | ||
# uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: '3.9' | ||
# - name: Set up Cloud SDK | ||
# if: ${{ inputs.ZAP_GCP_PUBLISH }} | ||
# uses: google-github-actions/setup-gcloud@v1 | ||
# with: | ||
# project_id: ${{ inputs.ZAP_GCP_PROJECT }} | ||
# service_account_key: ${{ secrets.GCP_SA_KEY }} | ||
# export_default_credentials: true | ||
# - name: ZAP Base Scan | ||
# if: ${{ inputs.ZAP_SCAN_TYPE == 'base' }} | ||
# uses: zaproxy/[email protected] | ||
# with: | ||
# token: ${{ secrets.GITHUB_TOKEN }} | ||
# docker_name: 'owasp/zap2docker-stable' | ||
# target: ${{ inputs.ZAP_TARGET_URL }} | ||
# rules_file_name: '.zap/rules.tsv' | ||
# cmd_options: '-a -d -T ${{ inputs.ZAP_MAX_DURATION }} -m ${{ inputs.ZAP_DURATION }}' | ||
# issue_title: OWAP Baseline | ||
# - name: ZAP Full Scan | ||
# if: ${{ inputs.ZAP_SCAN_TYPE == 'full' }} | ||
# uses: zaproxy/[email protected] | ||
# with: | ||
# token: ${{ secrets.GITHUB_TOKEN }} | ||
# docker_name: 'owasp/zap2docker-stable' | ||
# target: ${{ inputs.ZAP_TARGET_URL }} | ||
# rules_file_name: '.zap/rules.tsv' | ||
# cmd_options: '-a -d -T ${{ inputs.ZAP_MAX_DURATION }} -m ${{ inputs.ZAP_DURATION }}' | ||
# - name: Create Artifact Directory | ||
# if: ${{ inputs.ZAP_GCP_PUBLISH }} | ||
# run: | | ||
# mkdir -p public/zap | ||
# - name: Publish Reports to Github | ||
# uses: actions/download-artifact@v2 | ||
# with: | ||
# name: zap_scan | ||
# path: public/zap | ||
# - name: Rename Markdown | ||
# if: ${{ inputs.ZAP_GCP_PUBLISH }} | ||
# run: | | ||
# mv public/zap/report_md.md public/zap/README.md | ||
# - name: ZAP Results | ||
# uses: JamesIves/[email protected] | ||
# with: | ||
# branch: zap-scan | ||
# folder: public/zap | ||
# - name: GCP Publish Results URL | ||
# if: ${{ inputs.ZAP_GCP_PUBLISH }} | ||
# run: | | ||
# echo "$GCP_SA_KEY" > gcp-sa-key.json | ||
# gsutil mb gs://${{ inputs.ZAP_GCP_BUCKET }} || echo "Bucket already exists..." | ||
# gsutil cp public/zap/report_html.html gs://${{ inputs.ZAP_GCP_BUCKET }} | ||
# echo "URL expires in 10 minutes..." | ||
# gsutil signurl -d 10m gcp-sa-key.json gs://${{ inputs.ZAP_GCP_BUCKET }}/report_html.html | ||
# env: | ||
# GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} |
Oops, something went wrong.