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

fix: container start test #275

Merged
merged 38 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
06ec03b
Debug container start test
ryanwi Apr 30, 2024
38cb1f5
debug
ryanwi Apr 30, 2024
3808d15
debug
ryanwi Apr 30, 2024
1794dcb
debug
ryanwi Apr 30, 2024
e13fc34
ignore
ryanwi Apr 30, 2024
9c2ad43
debug
ryanwi Apr 30, 2024
e9ccfb6
debug
ryanwi Apr 30, 2024
64fae3b
debug
ryanwi Apr 30, 2024
4c34af6
Update ref for ci-build workflow and set REF
Null-Is-Null Apr 30, 2024
702193e
no main
ryanwi May 1, 2024
5c98a03
no main
ryanwi May 1, 2024
e14e3b7
speed up debugging
ryanwi May 1, 2024
e492fb5
speed up debugging
ryanwi May 1, 2024
51ed366
speed up debugging
ryanwi May 1, 2024
d75e572
speed up debugging
ryanwi May 1, 2024
d9a909f
speed up debugging
ryanwi May 1, 2024
3629865
speed up debugging
ryanwi May 1, 2024
952a36c
speed up debugging
ryanwi May 1, 2024
a3644ad
speed up debugging
ryanwi May 1, 2024
b8ad0ac
speed up debugging
ryanwi May 1, 2024
3c3c867
speed up debugging
ryanwi May 1, 2024
4bee1ca
speed up debugging
ryanwi May 1, 2024
2784510
move test command
ryanwi May 1, 2024
a5132cb
container test command
ryanwi May 1, 2024
ee3eab2
container test command
ryanwi May 1, 2024
91f9489
container test command
ryanwi May 1, 2024
0560dcc
container test command
ryanwi May 1, 2024
c938fbf
container test command
ryanwi May 1, 2024
4465bda
container test command
ryanwi May 1, 2024
56234d2
container test command
ryanwi May 1, 2024
8a216aa
container test command
ryanwi May 1, 2024
e7ef85f
container test command
ryanwi May 1, 2024
76118ce
container test command
ryanwi May 1, 2024
ff1ab71
reduce changes
ryanwi May 1, 2024
bf67306
reduce changes
ryanwi May 1, 2024
cd67dd1
reduce changes
ryanwi May 1, 2024
6b045c0
reduce changes
ryanwi May 1, 2024
a7e0b1b
reduce changes
ryanwi May 1, 2024
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
18 changes: 9 additions & 9 deletions .github/actions/docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ runs:

- name: Build and export to Docker
uses: docker/build-push-action@v5
if: inputs.PLATFORMS == 'linux/amd64' && inputs.TAG_ONLY == 'false'
if: inputs.TAG_ONLY == 'false'
with:
load: true
tags: |
Expand All @@ -133,7 +133,8 @@ runs:
# cache-to: type=gha,mode=max
file: ${{ inputs.FILE }}
context: ${{ inputs.CONTEXT }}
platforms: ${{ inputs.PLATFORMS }}
# cannot use multiple platforms with `load`, build a single arch image for validation purposes in CI
platforms: linux/amd64
build-args: ${{ env.BUILD_ARGS }}
secrets: ${{ env.DOCKER_SECRETS }}

Expand All @@ -142,14 +143,13 @@ runs:
id: test
shell: bash
run: |
docker run -d --rm --name test ${{ fromJSON(steps.meta.outputs.json).tags[0] }} ${{ inputs.CONTAINER_TEST_COMMAND }}
docker images
echo "Starting container for image: ${{ steps.meta.outputs.tags }}"
docker run -d --rm --name test ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
sleep 20
docker logs test > logs.txt
EXECUTIONLOG=$(cat logs.txt)
EXECUTIONLOG="${EXECUTIONLOG//'%'/'%25'}"
EXECUTIONLOG="${EXECUTIONLOG//$'\n'/'%0A'}"
EXECUTIONLOG="${EXECUTIONLOG//$'\r'/'%0D'}"
echo "name=container-logs::$EXECUTIONLOG" >> $GITHUB_OUTPUT
docker ps
docker logs test
${{ inputs.CONTAINER_TEST_COMMAND }}

- name: Build and push
if: inputs.PUSH == 'true' # && inputs.TAG_ONY == 'false'
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ on:
type: boolean
default: true
description: 'Whenever the container should be tested on pr.'
CONTAINER_TEST_COMMAND:
type: string
default: ''
description: 'A custom command to test the docker container.'
RUNNER:
type: string
default: 'ubuntu-latest'
Expand Down Expand Up @@ -251,6 +255,7 @@ jobs:
PLATFORMS: ${{ inputs.PLATFORMS }}
CONTAINER_SCAN: ${{ inputs.CONTAINER_SCAN }}
CONTAINER_TEST: ${{ inputs.CONTAINER_TEST }}
CONTAINER_TEST_COMMAND: ${{ inputs.CONTAINER_TEST_COMMAND }}
RUNNER: ${{ inputs.RUNNER }}
TAG: ${{ inputs.TAG }}
BUILD_ARGS: ${{ inputs.BUILD_ARGS }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
./sonarscanner
./sonarscanner
.DS_Store