-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from eugene-davis/pr-builds
Pr scoped images
- Loading branch information
Showing
6 changed files
with
91 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ name: PR Checks | |
on: | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
env: | ||
REQUIRED_COVERAGE: 30 | ||
|
@@ -12,7 +11,6 @@ jobs: | |
python: | ||
name: python checks | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
|
@@ -46,18 +44,56 @@ jobs: | |
- uses: hadolint/[email protected] | ||
with: | ||
dockerfile: Dockerfile | ||
|
||
- name: Build PR Check | ||
id: containers | ||
run: | | ||
if [[ "${{ secrets.BUILD_PR }}" != "" && \ | ||
"${{ secrets.PR_CONTAINERS_USER }}" != "" && \ | ||
"${{ secrets.PR_CONTAINERS }}" != "" ]] | ||
then | ||
echo "PR Builds configured" | ||
echo "::set-output name=BUILD_PR::true" | ||
else | ||
echo "PR Builds not configured" | ||
echo "::set-output name=BUILD_PR::false" | ||
fi | ||
- name: Get PR ID | ||
id: pr | ||
run: echo "::set-output name=id::$(echo ${{ github.ref_name }} | cut -d"/" -f1)" | ||
if: ${{ fromJSON(steps.containers.outputs.BUILD_PR) }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Test Cross Platform Build | ||
- name: Login to ghcr.io | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.PR_CONTAINERS_USER }} | ||
password: ${{ secrets.PR_CONTAINERS }} | ||
if: ${{ fromJSON(steps.containers.outputs.BUILD_PR) }} | ||
|
||
- name: PR Cross Platform Build and Push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:pr-${{ steps.pr.outputs.id }} | ||
platforms: linux/amd64,linux/arm64,linux/arm/v7 | ||
if: ${{ fromJSON(steps.containers.outputs.BUILD_PR) }} | ||
|
||
- name: PR Cross Platform Build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
tags: ghcr.io/${{ github.repository }}:pr-${{ steps.pr.outputs.id }} | ||
platforms: linux/amd64,linux/arm64,linux/arm/v7 | ||
if: ${{ !fromJSON(steps.containers.outputs.BUILD_PR) }} | ||
|
||
security: | ||
name: security checks | ||
|
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,33 @@ | ||
name: 'Clean up Docker images from PR' | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
|
||
jobs: | ||
purge-image: | ||
name: Delete image from ghcr.io | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Build PR Check | ||
id: containers | ||
run: | | ||
if [[ "${{ secrets.BUILD_PR }}" != "" && \ | ||
"${{ secrets.PR_CONTAINERS_USER }}" != "" && \ | ||
"${{ secrets.PR_CONTAINERS }}" != "" ]] | ||
then | ||
echo "PR Builds configured" | ||
echo "::set-output name=BUILD_PR::true" | ||
else | ||
echo "PR Builds not configured" | ||
echo "::set-output name=BUILD_PR::false" | ||
fi | ||
- uses: eugene-davis/[email protected] | ||
with: | ||
package-name: ${{ github.event.repository.name }} | ||
tag: pr-${{ github.event.pull_request.number }} | ||
github-token: ${{ secrets.PR_CONTAINERS }} | ||
github-org: ${{ secrets.ORG}} # Should only be set when running in an organization | ||
if: ${{ fromJSON(steps.containers.outputs.BUILD_PR) }} |
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ on: | |
workflow_dispatch: | ||
|
||
env: | ||
VERSION: 1.0.10 | ||
VERSION: 1.0.11 | ||
|
||
jobs: | ||
release: | ||
|
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,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "vault-assessment-prometheus-exporter" | ||
version = "1.0.10" | ||
version = "1.0.11" | ||
description = "Prometheus exporter to monitor custom metadata for KV2 secrets for (self-imposed) expiration." | ||
authors = ["Eugene Davis <[email protected]>"] | ||
readme = "README.md" | ||
|