atlantis: gcp: cloudrun: data dir flag fails on existing directory

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave β€œ+1” or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

I’m trying to set the environment variable ATLANTIS_DATA_DIR to a /mnt/gcs When atlantis server is invoked, a cache dir and bin dir is supposed to be created, but this fails:

Error: initializing server: unable to create dir "/mnt/gcs/bin": mkdir /mnt/gcs: file exists

Reproduction Steps

  • Create a dir: /mnt/gcs
  • Set an environment variable: ATLANTIS_DATA_DIR to /mnt/gcs
  • Initiate atlantis server

Logs

Error: initializing server: unable to create dir "/mnt/gcs/bin": mkdir /mnt/gcs: file exists

Environment details

Deploying to Cloud Run, using gcsfuse to mount a Cloud Storage Bucket.

Additional Context

Before the docker-entrypoint.sh is ran I run the following:

# Create mount directory for service
mkdir -p $MNT_DIR

echo "Mounting GCS Fuse."
gcsfuse --debug_gcs --debug_fuse $BUCKET $MNT_DIR 
echo "Mounting completed."

It seems like that Atlantis trips over that the data dir is already created.

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 24 (19 by maintainers)

Most upvoted comments

@kamilkrampa @bschaatsbergen making atlantis stateless is probably the correct way to go. I do not think there is a way to store the plan in an external storage (database or s3 bucket or similar) but that would be a great feature request.

If the clone isn’t working, I’m unsure how that can be done in a stateless way unless we used a server + agent model.

related issue https://stackoverflow.com/questions/74913423/error-chmod-on-config-lock-failed-operation-not-permitted