Search code examples
amazon-web-servicescontinuous-integrationpipelinegitlab-ci-runnersam

.gitlab-ci.yaml throws "Cleaning up file based variables 00:01 ERROR: Job failed: exit code 1" at the end after successfully run the job


When I am trying to commit changes to gitlab for continuous integrations i am facing this error even though all my steps pass successfully, Gitlab CI shows this

  • Cleaning up file based variables 00:01 ERROR: Job failed: exit code 1

I am running 1 stages "deploy" at the moment here is my script for deploy:

image: python:3.8

stages:
  - deploy

default:
 before_script:
    - wget https://golang.org/dl/go1.16.5.linux-amd64.tar.gz
    - rm -rf /usr/local/go && tar -C /usr/local -xzf go1.16.5.linux-amd64.tar.gz
    - export PATH=$PATH:/usr/local/go/bin
    - source ~/.bashrc
    - pip3 install awscli --upgrade
    - pip3 install aws-sam-cli --upgrade

deploy-development:
 only:
  - feature/backend/ci/cd
 stage: deploy
 script:
    - sam build -p
    - yes | sam deploy

Solution

  • This command probably creates an issue in the docker shell:

    yes | sam deploy
    

    Try this command:

    sam deploy --no-confirm-changeset --no-fail-on-empty-changeset
    

    From https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-deploy.html:

    --confirm-changeset | --no-confirm-changeset    Prompt to confirm whether the AWS SAM CLI deploys the computed changeset.
    --fail-on-empty-changeset | --no-fail-on-empty-changeset    Specify whether to return a non-zero exit code if there are no changes to be made to the stack. The default behavior is to return a non-zero exit code.