Skip to content

Commit 95e3a23

Browse files
authored
Merge pull request #304 from silinternational/fix-task-def-update
Release 3.10.22 -- fix task definition creation with multiple similar images defined
2 parents 0c9cfdd + 2ff29a2 commit 95e3a23

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Continuous Integration
22

33
on:
44
push:
5-
branches: ['master','main'] # Trigger on the pushes to master & main branches
6-
tags: [ '[0-9]+.[0-9]+.[0-9]+' ]
75

86
jobs:
97
test:
@@ -18,25 +16,23 @@ jobs:
1816
name: Build and Publish
1917
needs: test
2018
runs-on: ubuntu-latest
19+
if: github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/')
2120
steps:
2221
- uses: actions/checkout@v4
23-
24-
# Step to login to DockerHub
22+
2523
- name: Log in to Docker Hub
2624
uses: docker/login-action@v3
2725
with:
2826
username: ${{ secrets.DOCKERHUB_USERNAME }}
2927
password: ${{ secrets.DOCKERHUB_TOKEN }}
30-
31-
# Step to login to GitHub Container Registry
28+
3229
- name: Log in to GHCR
3330
uses: docker/login-action@v3
3431
with:
3532
registry: ghcr.io
3633
username: ${{ github.actor}}
3734
password: ${{ secrets.GITHUB_TOKEN}}
38-
39-
# Extract metadata for the Docker images using the semver
35+
4036
- name: Extract metadata (tags, labels) for Docker
4137
id: meta
4238
uses: docker/metadata-action@v5
@@ -50,12 +46,10 @@ jobs:
5046
type=semver,pattern={{major.minor}}
5147
5248
53-
# Build and push Docker image to GHCR and Docker Hub
5449
- name: Build and push Docker image
5550
uses: docker/build-push-action@v5
5651
with:
5752
context: .
5853
push: true
5954
tags: ${{ steps.meta.outputs.tags }}
60-
labels: ${{ steps.meta.outputs.labels }}
61-
55+
labels: ${{ steps.meta.outputs.labels }}

ecs-deploy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
# Setup default values for variables
4-
VERSION="3.10.21"
4+
VERSION="3.10.22"
55
CLUSTER=false
66
SERVICE=false
77
TASK_DEFINITION=false
@@ -292,7 +292,7 @@ function parseImageName() {
292292
tag=${!TAGVAR}
293293
if [[ "x$tag" == "x" ]]; then
294294
tag="latest"
295-
else
295+
else
296296
# If !TAGVAR isn't empty, we should use the value of the env var as the tag whether IMAGE contains a digest or not.
297297
emptyOrSha=""
298298
fi
@@ -379,7 +379,7 @@ function createNewTaskDefJson() {
379379
# + Filter the def
380380
if [[ "x$TAGONLY" == "x" ]]; then
381381
DEF=$( echo "$taskDefinition" \
382-
| sed -e 's~"image":.*'"${imageWithoutTag}"'.*,~"image": "'"${useImage}"'",~g' \
382+
| sed -e 's~"image":.*'"${imageWithoutTag}:"'.*,~"image": "'"${useImage}"'",~g' \
383383
| jq '.taskDefinition' )
384384
else
385385
DEF=$( echo "$taskDefinition" \

test.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ EOF
467467
"name": "cache",
468468
"links": [],
469469
"mountPoints": [],
470-
"image": "redis:latest",
470+
"image": "121212345678.dkr.ecr.us-east-1.amazonaws.com/acct/repo-two:1487623908",
471471
"essential": true,
472472
"portMappings": [
473473
{
@@ -491,7 +491,7 @@ EOF
491491
}
492492
EOF
493493
)
494-
expected='{ "family": "app-task-def", "volumes": [], "containerDefinitions": [ { "environment": [ { "name": "KEY", "value": "value" } ], "name": "API", "links": [], "mountPoints": [], "image": "121212345678.dkr.ecr.us-east-1.amazonaws.com/acct/repo:1111111111", "essential": true, "portMappings": [ { "protocol": "tcp", "containerPort": 80, "hostPort": 10080 } ], "entryPoint": [], "memory": 128, "command": [ "/data/run.sh" ], "cpu": 200, "volumesFrom": [] }, { "environment": [ { "name": "KEY", "value": "value" } ], "name": "cache", "links": [], "mountPoints": [], "image": "redis:latest", "essential": true, "portMappings": [ { "protocol": "tcp", "containerPort": 6376, "hostPort": 10376 } ], "entryPoint": [], "memory": 128, "command": [ "/data/run.sh" ], "cpu": 200, "volumesFrom": [] } ], "placementConstraints": null, "networkMode": "bridge" }'
494+
expected='{ "family": "app-task-def", "volumes": [], "containerDefinitions": [ { "environment": [ { "name": "KEY", "value": "value" } ], "name": "API", "links": [], "mountPoints": [], "image": "121212345678.dkr.ecr.us-east-1.amazonaws.com/acct/repo:1111111111", "essential": true, "portMappings": [ { "protocol": "tcp", "containerPort": 80, "hostPort": 10080 } ], "entryPoint": [], "memory": 128, "command": [ "/data/run.sh" ], "cpu": 200, "volumesFrom": [] }, { "environment": [ { "name": "KEY", "value": "value" } ], "name": "cache", "links": [], "mountPoints": [], "image": "121212345678.dkr.ecr.us-east-1.amazonaws.com/acct/repo-two:1487623908", "essential": true, "portMappings": [ { "protocol": "tcp", "containerPort": 6376, "hostPort": 10376 } ], "entryPoint": [], "memory": 128, "command": [ "/data/run.sh" ], "cpu": 200, "volumesFrom": [] } ], "placementConstraints": null, "networkMode": "bridge" }'
495495
run createNewTaskDefJson
496496
[ ! -z $status ]
497497
[ "$(echo "$output" | jq .)" == "$(echo "$expected" | jq .)" ]

0 commit comments

Comments
 (0)