mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-28 21:01:57 +03:00
codepipeline - fixes
This commit is contained in:
@@ -10,10 +10,11 @@ phases:
|
|||||||
post_build:
|
post_build:
|
||||||
commands:
|
commands:
|
||||||
# push
|
# push
|
||||||
|
- docker tag $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$CODEBUILD_RESOLVED_SOURCE_VERSION $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:latest
|
||||||
- docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$CODEBUILD_RESOLVED_SOURCE_VERSION
|
- docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$CODEBUILD_RESOLVED_SOURCE_VERSION
|
||||||
|
- docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:latest
|
||||||
# create new task definition
|
# create new task definition
|
||||||
- ./create-new-task-def.sh $IMAGE_REPO_NAME
|
- ./create-new-task-def.sh $IMAGE_REPO_NAME
|
||||||
- ./set-network-configuration.sh $IMAGE_REPO_NAME
|
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
files:
|
files:
|
||||||
|
|||||||
@@ -15,4 +15,3 @@ REQUIRES_COMPATIBILITIES=$(echo $CURRENT_TASKDEF |jq '.taskDefinition.requiresCo
|
|||||||
echo '{"family": "'${SERVICE_NAME}'", "taskRoleArn": "'${TASKDEF_ROLE_ARN}'", "executionRoleArn": "'${EXECUTION_ROLE_ARN}'", "containerDefinitions": '$TASKDEF', "cpu": "'$CPU'", "memory": "'$MEMORY'", "requiresCompatibilities": ['$REQUIRES_COMPATIBILITIES'], "networkMode": "'${NETWORK_MODE}'" }' > taskdef.json
|
echo '{"family": "'${SERVICE_NAME}'", "taskRoleArn": "'${TASKDEF_ROLE_ARN}'", "executionRoleArn": "'${EXECUTION_ROLE_ARN}'", "containerDefinitions": '$TASKDEF', "cpu": "'$CPU'", "memory": "'$MEMORY'", "requiresCompatibilities": ['$REQUIRES_COMPATIBILITIES'], "networkMode": "'${NETWORK_MODE}'" }' > taskdef.json
|
||||||
#aws ecs register-task-definition --cli-input-json file://task-def-template.json.new > task-def-template.json.out
|
#aws ecs register-task-definition --cli-input-json file://task-def-template.json.new > task-def-template.json.out
|
||||||
#NEW_TASKDEF_ARN=`cat task-def-template.json.out |jq -r '.taskDefinition.taskDefinitionArn'`
|
#NEW_TASKDEF_ARN=`cat task-def-template.json.out |jq -r '.taskDefinition.taskDefinitionArn'`
|
||||||
sed -i 's#$TASKDEF#'$NEW_TASKDEF_ARN'#' appspec.yaml
|
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ resource "aws_codebuild_project" "demo" {
|
|||||||
type = "CODEPIPELINE"
|
type = "CODEPIPELINE"
|
||||||
}
|
}
|
||||||
|
|
||||||
cache {
|
#cache {
|
||||||
type = "S3"
|
# type = "S3"
|
||||||
location = aws_s3_bucket.codebuild-cache.bucket
|
# location = aws_s3_bucket.codebuild-cache.bucket
|
||||||
}
|
#}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
compute_type = "BUILD_GENERAL1_SMALL"
|
compute_type = "BUILD_GENERAL1_SMALL"
|
||||||
@@ -39,5 +39,7 @@ resource "aws_codebuild_project" "demo" {
|
|||||||
type = "CODEPIPELINE"
|
type = "CODEPIPELINE"
|
||||||
buildspec = "buildspec.yml"
|
buildspec = "buildspec.yml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#depends_on = [aws_s3_bucket.codebuild-cache]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ resource "aws_ecs_task_definition" "demo" {
|
|||||||
"healthCheck": {
|
"healthCheck": {
|
||||||
"command": [ "CMD-SHELL", "curl -f http://localhost:3000/ || exit 1" ],
|
"command": [ "CMD-SHELL", "curl -f http://localhost:3000/ || exit 1" ],
|
||||||
"interval": 30,
|
"interval": 30,
|
||||||
"retries": 3
|
"retries": 3,
|
||||||
|
"timeout": 5
|
||||||
},
|
},
|
||||||
"portMappings": [
|
"portMappings": [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user