Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev to Main #726

Merged
merged 14 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions .github/actions/bake-test-push/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: 'Build/Test/Scan/Push Image'
inputs:
target:
description: Target or group to bake
required: true
type: string
bakefile:
description: Path to the bakefile
required: true
default: "docker-bake.hcl"
type: string
env-vars:
description: A semicolon delimited list of environment variables to set as overrides for the bake definition
required: false
type: string
test-image:
description: Flag to test image once built
default: true
type: boolean
push-image:
description: Flag to push image once built
default: false
type: boolean
ghcr-token:
description: Username for authentication with GHCR.io
required: true
type: string
dockerhub-username:
description: Username for authentication with DockerHub
required: true
type: string
dockerhub-token:
description: Username for authentication with DockerHub
required: true
type: string
gcp-json:
description: JSON for authenticating Google Cloud Platform
default: ""
type: string

runs:
using: "composite"
steps:
# Setup dependencies and tools
- name: Set up Just
uses: extractions/setup-just@v2
env:
GITHUB_TOKEN: ${{ inputs.ghcr-token }}

- uses: actions/setup-python@v5
with:
python-version: '3.12'

# Authenticate to registries
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ inputs.ghcr-token }}

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ inputs.dockerhub-username }}
password: ${{ inputs.dockerhub-token }}

- name: Login to GCAR us-central1
continue-on-error: true
uses: docker/login-action@v3
with:
registry: us-central1-docker.pkg.dev
username: _json_key
password: '${{ inputs.gcp-json }}'

- name: Login to GCAR us
continue-on-error: true
uses: docker/login-action@v3
with:
registry: us-docker.pkg.dev
username: _json_key
password: '${{ inputs.gcp-json }}'

- name: Login to GCAR asia
continue-on-error: true
uses: docker/login-action@v3
with:
registry: asia-docker.pkg.dev
username: _json_key
password: '${{ inputs.gcp-json }}'

- name: Login to GCAR europe
continue-on-error: true
uses: docker/login-action@v3
with:
registry: europe-docker.pkg.dev
username: _json_key
password: '${{ inputs.gcp-json }}'

# Build, test, and push image
- name: Build
id: build
uses: docker/bake-action@v4
with:
targets: "${{ inputs.target }}"
push: false
files: ${{ inputs.bakefile }}

- name: Test
shell: bash
run: |
just test "${{ inputs.target }}" "${{ inputs.bakefile }}"

- name: Push - ${{ inputs.push-image }}
uses: docker/bake-action@v4
with:
targets: "${{ inputs.target }}"
push: ${{ inputs.push-image }}
files: ${{ inputs.bakefile }}
Loading
Loading