Skip to content

Commit 0d569df

Browse files
Add debug mode and stop script on error
1 parent 656fdcb commit 0d569df

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Docker QEMU Buildx ECR
18-
uses: bbharathkumarreddy/ec2-docker-service-deploy-action@v1.0
18+
uses: bbharathkumarreddy/ec2-docker-service-deploy-action@v2.0
1919
with:
2020
ssh-host: ${{ vars.ssh-host }}
2121
ssh-key: ${{ secrets.ssh-key }}
@@ -55,7 +55,8 @@ The following inputs can be used as `step.with` keys:
5555
| `docker-target-port` | String | `80` | Docker target port of container. |
5656
| `docker-opts` | String | | More docker options to create docker service. eg. `--log-driver=awslogs --log-opt awslogs-group=my-logs --log-opt awslogs-region=us-east-1`. |
5757
| `prune` | Boolean | `true` | On prune true, Will cleanup exitied containers and unused images. |
58-
| `restart-only` | Boolean | `false` | On restart-only true, Service will be force restarted with set replicas. |
58+
| `restart-only` | Boolean | `false` | On restart-only true, Service will be force restarted with set replicas. |
59+
| `debug` | Boolean | `false` | Enable debug mode. |
5960

6061
## Contributing
6162

action.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ inputs:
6767
description: "On restart-only true, Service will be force restarted with set replicas."
6868
default: false
6969
required: false
70+
debug:
71+
description: "Enable debug mode."
72+
default: false
73+
required: false
7074

7175
runs:
7276
using: "composite"
@@ -100,11 +104,13 @@ runs:
100104

101105
- name: EC2 Docker Service Deploy
102106
if: ${{ inputs.restart-only != 'true' }}
103-
uses: appleboy/ssh-action@master
107+
uses: appleboy/ssh-action@v1.0.3
104108
with:
105109
host: ${{ inputs.ssh-host }}
106110
username: ${{ inputs.ssh-username }}
107111
key: ${{ inputs.ssh-key }}
112+
debug: : ${{ inputs.debug }}
113+
script_stop: true
108114
script: |
109115
sudo docker login --username AWS -p $(aws ecr get-login-password --region ${{ inputs.aws-region }}) ${{ steps.login-ecr.outputs.registry }}
110116
sudo docker pull ${{ inputs.ecr-image-uri }}
@@ -127,11 +133,13 @@ runs:
127133
128134
- name: EC2 Docker Restart Service
129135
if: ${{ inputs.restart-only == 'true' }}
130-
uses: appleboy/ssh-action@master
136+
uses: appleboy/ssh-action@v1.0.3
131137
with:
132138
host: ${{ inputs.ssh-host }}
133139
username: ${{ inputs.ssh-username }}
134140
key: ${{ inputs.ssh-key }}
141+
debug: : ${{ inputs.debug }}
142+
script_stop: true
135143
script: |
136144
sudo docker login --username AWS -p $(aws ecr get-login-password --region ${{ inputs.aws-region }}) ${{ steps.login-ecr.outputs.registry }}
137145
sudo docker pull ${{ inputs.ecr-image-uri }}
@@ -142,11 +150,13 @@ runs:
142150
143151
- name: EC2 Prune conatiner and images
144152
if: ${{ inputs.prune == 'true' }}
145-
uses: appleboy/ssh-action@master
153+
uses: appleboy/ssh-action@v1.0.3
146154
with:
147155
host: ${{ inputs.ssh-host }}
148156
username: ${{ inputs.ssh-username }}
149157
key: ${{ inputs.ssh-key }}
158+
debug: : ${{ inputs.debug }}
159+
script_stop: true
150160
script: |
151161
sudo -S docker container prune -f
152162
sudo -S docker image prune -af

0 commit comments

Comments
 (0)