Pipeline uses old zip file - clear artifacts?

I have a pipeline that zips up my codebase and copies it to AWS, triggering CodePipeline to build a Drupal site. This has been working for about a year, but lately instead of zipping up the latest repository, it loads the old zip and copies that instead.

This is the line of code that zips everything up:
zip -r data-code-master.zip composer.json composer.lock composer.patches.json load.environment.php Dockerfile-ECR buildspec.yml config web server-settings scripts -x web/sites/default

I am wondering if I am loading zip incorrectly, I did change this part recently.

  • image: “python:3.8-slim”
  • apt update && apt install -y python3-pip
  • python3 --version
  • pip3 --version
  • pip3 install awscli
  • aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
  • aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
  • apt-get install -y zip unzip

Any thoughts would be appreciated. Thanks.

Hi,

maybe the version of zip available in the package manager of the base image changed its behaviour.

One simple approach to ensure you do not have old files around - delete them before creating them. Add a step to your pipeline script before creating the zip file:

test -f data-code-master.zip || rm data-code-master.zip

This tests whether the file exists, returns true, and deletes it in case.

Kind regards,
Michael