Skip to content

Commit

Permalink
Add timeouts and names
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Nov 7, 2024
1 parent a78de90 commit c7f0982
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 44 deletions.
1 change: 1 addition & 0 deletions .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ runs:
with:
dockerfile: ${{ inputs.dockerfile-location }}/Dockerfile
ignore: SC1091,${{ inputs.ignore-linting-rules }}

- name: ShellCheck
run: |
cd ${{ inputs.dockerfile-location }}
Expand Down
5 changes: 5 additions & 0 deletions .github/actions/push/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ runs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ inputs.github-token }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push image
uses: docker/build-push-action@v6
with:
Expand All @@ -56,9 +59,11 @@ runs:
push: true
tags: ${{ inputs.image-id }}:${{ inputs.image-tag }}
provenance: false

- name: List manifest
run: docker buildx imagetools inspect ${{ inputs.image-id }}:${{ inputs.image-tag }}
shell: bash

- name: Build and push versioned and latest image tags
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v6
Expand Down
1 change: 1 addition & 0 deletions .github/actions/scan/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ runs:
format: "sarif"
output: "trivy-results.sarif"
ignore-unfixed: true

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build test Docker image
name: Test Docker image build

inputs:
image-name:
Expand All @@ -15,17 +15,6 @@ inputs:
type: string
default: app

outputs:
image-id:
value: ${{ steps.generate-tags.outputs.image-id }}
tag:
description: "The generated tag"
value: ${{ steps.generate-tags.outputs.tag }}
major-version:
value: ${{ steps.generate-tags.outputs.major-version }}
minor-version:
value: ${{ steps.generate-tags.outputs.minor-version }}

runs:
using: "composite"
steps:
Expand All @@ -48,6 +37,7 @@ runs:
echo "major-version=$MAJOR_VERSION" >> "$GITHUB_OUTPUT"
echo "minor-version=$MINOR_VERSION" >> "$GITHUB_OUTPUT"
shell: bash

- name: Build images
uses: docker/build-push-action@v6
with:
Expand All @@ -64,3 +54,14 @@ runs:
load: true
tags: ${{ steps.generate-tags.outputs.image-id }}:${{ steps.generate-tags.outputs.tag }}
provenance: false

outputs:
image-id:
value: ${{ steps.generate-tags.outputs.image-id }}
tag:
description: "The generated tag"
value: ${{ steps.generate-tags.outputs.tag }}
major-version:
value: ${{ steps.generate-tags.outputs.major-version }}
minor-version:
value: ${{ steps.generate-tags.outputs.minor-version }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test the Docker image user
name: Test Docker image

inputs:
application-repository:
Expand All @@ -25,6 +25,7 @@ runs:
with:
repository: ${{ inputs.application-repository }}
path: ${{ inputs.application-repository }}

- name: Start application
run: |
cd ${{ inputs.application-repository }}
Expand All @@ -35,9 +36,11 @@ runs:
echo "PORT=$PORT" >> "$GITHUB_ENV"
docker compose up ${{ inputs.service }} -d
shell: bash

- name: Check healthcheck endpoint
run: for c in {1..30}; do sleep 1 && curl -s -w '%{http_code}' -o /dev/null http://localhost:${{ env.PORT }}/healthcheck/live/ | grep -o "200" && break; done
shell: bash

- name: Check user
run: |
cd ${{ inputs.application-repository }}
Expand Down
Loading

0 comments on commit c7f0982

Please sign in to comment.