Problem to solve
AWS SAM deployment stuck, it successfully deployed 2 weeks ago. Not it is suddenly not working, i haven’t changed anything on the gitlab-ci.yml file
Configuration
image: docker:19.03.15
services:
- docker:19.03.15-dind
before_script:
- apk add --update python3 py-pip python3-dev build-base libffi-dev
- apk update && apk add bash
- apk update && apk add gettext
- pip install --upgrade pip
- pip install awscli==1.32.98
- pip install aws-sam-cli==1.116.0
stages:
- unit-test
- build
- testing
- prod
# uncomment and modify the following step for running the unit-tests
#
#unit-test:
# stage: unit-test
# only:
# - master
# - /^feature-.*$/
# script: |
# This stage is triggered only for feature branches (feature*),
# which will build the stack and deploy to a stack named with branch name.
build-and-deploy-feature:
stage: build
only:
- develop
script:
- envsubst < template.yaml > sam-template.yaml
- envsubst < _samconfig.toml > samconfig.toml
- cat sam-template.yaml
- cat samconfig.toml
- . assume-role.sh ${TESTING_PIPELINE_EXECUTION_ROLE} feature-deployment "${PERMISSIONS_PROVIDER}"
- sam build --template ${SAM_TEMPLATE} --use-container
- sam deploy --stack-name ${STAGING_STACK_NAME}
--capabilities CAPABILITY_IAM
--region ${TESTING_REGION}
--s3-bucket ${TESTING_ARTIFACTS_BUCKET}
--no-confirm-changeset
--no-fail-on-empty-changeset
--role-arn ${TESTING_CLOUDFORMATION_EXECUTION_ROLE}
# This stage is triggered for main branch you set in the question,
# which will build the stack, package the application, upload the
# applications artifacts to Amazon S3 and output the SAM template file.
build-and-package:
stage: build
only:
- master
script:
- sam build --template ${SAM_TEMPLATE} --use-container
- . assume-role.sh ${TESTING_PIPELINE_EXECUTION_ROLE} testing-stage-packaging "${PERMISSIONS_PROVIDER}"
- sam package --s3-bucket ${TESTING_ARTIFACTS_BUCKET}
--region ${TESTING_REGION}
--output-template-file packaged-testing.yaml
- . assume-role.sh ${PROD_PIPELINE_EXECUTION_ROLE} prod-stage-packaging "${PERMISSIONS_PROVIDER}"
- sam package --s3-bucket ${PROD_ARTIFACTS_BUCKET}
--region ${PROD_REGION}
--output-template-file packaged-prod.yaml
artifacts:
paths:
- packaged-testing.yaml
- packaged-prod.yaml
# This stage is triggered for main branch you set in the question,
# which will deploy the testing stage SAM application using
# the templated file generated.
deploy-testing:
stage: testing
only:
- master
script:
- . assume-role.sh ${TESTING_PIPELINE_EXECUTION_ROLE} testing-deployment "${PERMISSIONS_PROVIDER}"
- sam deploy --stack-name ${TESTING_STACK_NAME}
--template packaged-testing.yaml
--capabilities CAPABILITY_IAM
--region ${TESTING_REGION}
--s3-bucket ${TESTING_ARTIFACTS_BUCKET}
--no-fail-on-empty-changeset
--role-arn ${TESTING_CLOUDFORMATION_EXECUTION_ROLE}
# Uncomment and modify the following stage for integration tests
#
#integration-test:
# stage: testing
# only:
# - master
# script: |
# #trigger the integration tests here
# This stage is triggered for main branch you set in the question,
# which will deploy the prod stage SAM application using
# the templated file generated.
deploy-prod:
stage: prod
# uncomment this to have a manual approval step before deployment to production
# when: manual
only:
- master
script:
- . assume-role.sh ${PROD_PIPELINE_EXECUTION_ROLE} prod-deployment "${PERMISSIONS_PROVIDER}"
- sam deploy --stack-name ${PROD_STACK_NAME}
--template packaged-prod.yaml
--capabilities CAPABILITY_IAM
--region ${PROD_REGION}
--s3-bucket ${PROD_ARTIFACTS_BUCKET}
--no-fail-on-empty-changeset
--role-arn ${PROD_CLOUDFORMATION_EXECUTION_ROLE}
Versions
Versions
- Running with gitlab-runner 17.0.0~pre.88.g761ae5dd (761ae5dd)
- awscli 1.32.98
- aws-sam-cli 1.116.0