Skip to content

Commit 12ebedb

Browse files
Added docker compose version input (#4)
## what * Added docker-compose version input * Added docker login inputs ## Why * Setup docker-compose specific version * Login to docker registry to pull private images required for test run Co-authored-by: goruha <goruha@users.noreply.github.com> Co-authored-by: Cloud Posse Bot (CI/CD) <bot@cloudposse.com>
1 parent f04ad83 commit 12ebedb

5 files changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/test-negative.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
file: test/docker-compose.yml
2929
service: app
3030
command: test/test-failure.sh
31+
registry: registry.hub.docker.com
32+
login: ${{ secrets.DOCKERHUB_USERNAME }}
33+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
3134

3235
outputs:
3336
result: ${{ steps.current.conclusion }}

.github/workflows/test-positive.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
file: test/docker-compose.yml
2929
service: app
3030
command: test/test-success.sh
31+
registry: registry.hub.docker.com
32+
login: ${{ secrets.DOCKERHUB_USERNAME }}
33+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
3134

3235
outputs:
3336
result: ${{ steps.current.conclusion }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ Run tests in enviroment defined with Docker Compose
102102
| Name | Description | Default | Required |
103103
|------|-------------|---------|----------|
104104
| command | Command to run tests | N/A | true |
105+
| docker-compose-version | Docker compose version | 1.29.2 | false |
105106
| entrypoint | Entrypoint | /bin/sh | false |
106107
| file | Docker compose file | N/A | true |
107108
| login | Docker login | | false |

action.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,37 @@ inputs:
2222
command:
2323
description: 'Command to run tests'
2424
required: true
25+
docker-compose-version:
26+
description: 'Docker compose version'
27+
required: false
28+
default: '1.29.2'
29+
registry:
30+
description: 'Docker registry'
31+
required: true
32+
login:
33+
description: 'Docker login'
34+
required: false
35+
default: ''
36+
password:
37+
description: 'Docker password'
38+
required: false
39+
default: ''
2540
outputs: {}
2641
runs:
2742
using: "composite"
2843
steps:
44+
- uses: KengoTODA/actions-setup-docker-compose@main
45+
with:
46+
version: ${{ inputs.docker-compose-version }}
47+
48+
- name: Login
49+
uses: docker/login-action@v2
50+
if: ${{ contains(inputs.registry, '.amazonaws.com') || ( inputs.login != '' && inputs.password != '' ) }}
51+
with:
52+
registry: ${{ inputs.registry }}
53+
username: ${{ inputs.login }}
54+
password: ${{ inputs.password }}
55+
2956
- name: Start stack
3057
shell: bash
3158
run: docker-compose -f ${{ inputs.file }} up -d

docs/github-action.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
| Name | Description | Default | Required |
55
|------|-------------|---------|----------|
66
| command | Command to run tests | N/A | true |
7+
| docker-compose-version | Docker compose version | 1.29.2 | false |
78
| entrypoint | Entrypoint | /bin/sh | false |
89
| file | Docker compose file | N/A | true |
910
| login | Docker login | | false |

0 commit comments

Comments
 (0)