atlantis
atlantis copied to clipboard
workspace does not exist
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
My PRs get comments of
checking if workspace exists: stat /atlantis-data/repos/goldsky-io/goldsky-infra/1286/default: no such file or directory
My helm values are as follows
atlantisUrl: https://atlantis.goldsky.com
environment:
ATLANTIS_AUTOPLAN_FILE_LIST: '**/*.tf,**/*.tfvars,**/*.tfvars.json,**/cdk.tf.json'
ATLANTIS_GH_ORG: goldsky-io
ATLANTIS_INCLUDE_GIT_UNTRACKED_FILES: true
ATLANTIS_TFE_TOKEN: secret
githubApp:
id: 963113
installationId: "53537338"
key: |
key
secret: secret
slug: atlantis-for-atlantis-goldsky-com
image:
pullPolicy: Always
repository: public.ecr.aws/b0y6c8j0/atlantis
tag: v0.28.5-alpine
orgAllowlist: github.com/goldsky-io/goldsky-infra
readinessProbe:
enabled: true
failureThreshold: 5
initialDelaySeconds: 5
periodSeconds: 5
scheme: HTTP
successThreshold: 1
timeoutSeconds: 5
I'm using a custom docker image like so
FROM ghcr.io/runatlantis/atlantis:v0.28.5
USER root
# Install Doppler CLI and npm
RUN wget -q -t3 'https://packages.doppler.com/public/cli/rsa.8004D9FF50437357.key' -O /etc/apk/keys/[email protected] && \
echo 'https://packages.doppler.com/public/cli/alpine/any-version/main' | tee -a /etc/apk/repositories && \
apk add doppler npm
USER atlantis
I'm trying to follow the docs for getting CDKTF working.
I have the following atlantis.yaml in my repo
version: 3
projects:
- name: default
dir: .
branch: dev
pre_workflow_hooks:
- run: npm i && npm run get && npm run synth:dev:atlantis
Logs
{"level":"error","ts":"2024-08-06T20:37:29.512Z","caller":"events/instrumented_project_command_builder.go:75","msg":"Error building auto plan commands: checking if workspace exists: stat /atlantis-data/repos/goldsky-io/goldsky-infra/1286/default: no such file or directory","json":{},"stacktrace":"github.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandBuilder).buildAndEmitStats\n\tgithub.com/runatlantis/atlantis/server/events/instrumented_project_command_builder.go:75\ngithub.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandBuilder).BuildAutoplanCommands\n\tgithub.com/runatlantis/atlantis/server/events/instrumented_project_command_builder.go:26\ngithub.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).runAutoplan\n\tgithub.com/runatlantis/atlantis/server/events/plan_command_runner.go:86\ngithub.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).Run\n\tgithub.com/runatlantis/atlantis/server/events/plan_command_runner.go:305\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunAutoplanCommand\n\tgithub.com/runatlantis/atlantis/server/events/command_runner.go:223"}
{"level":"info","ts":"2024-08-06T20:37:29.512Z","caller":"vcs/instrumented_client.go:218","msg":"updating vcs status","json":{"repo":"goldsky-io/goldsky-infra","pull":"1286"}}
{"level":"error","ts":"2024-08-06T20:37:30.127Z","caller":"events/pull_updater.go:18","msg":"checking if workspace exists: stat /atlantis-data/repos/goldsky-io/goldsky-infra/1286/default: no such file or directory","json":{"repo":"goldsky-io/goldsky-infra","pull":"1286"},"stacktrace":"github.com/runatlantis/atlantis/server/events.(*PullUpdater).updatePull\n\tgithub.com/runatlantis/atlantis/server/events/pull_updater.go:18\ngithub.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).runAutoplan\n\tgithub.com/runatlantis/atlantis/server/events/plan_command_runner.go:91\ngithub.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).Run\n\tgithub.com/runatlantis/atlantis/server/events/plan_command_runner.go:305\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunAutoplanCommand\n\tgithub.com/runatlantis/atlantis/server/events/command_runner.go:223"}
Additional Context
Using helm chart 5.4.4
❮❮❮ kubectl exec --namespace default -it statefulset/atlantis -- /bin/bash
atlantis-0:/$ terraform workspace list
* default
It seems the default workspace does exist.
The path printed in the error does not exist though
atlantis-0:/$ cd /atlantis-data/repos/goldsky-io/goldsky-infra/
atlantis-0:/atlantis-data/repos/goldsky-io/goldsky-infra$ ls
atlantis-0:/atlantis-data/repos/goldsky-io/goldsky-infra$
ah, removing
ATLANTIS_INCLUDE_GIT_UNTRACKED_FILES: true
seems to fix the issue, now my logs say
atlantis-0 atlantis {"level":"info","ts":"2024-08-06T20:47:20.823Z","caller":"events/working_dir.go:235","msg":"creating dir '/atlantis-data/repos/goldsky-io/goldsky-infra/1286/default'","json":{"repo":"goldsky-io/goldsky-infra","pull":"1286"}}
but there are other issues for me to work though.
It seems that ATLANTIS_INCLUDE_GIT_UNTRACKED_FILES doesn't properly account for creating the missing directory (or there's other config I need which isn't well documented)
I just ran into this. Why is this no longer marked as a bug?
If include-git-untracked-files is set, Atlantis will try to check for untracked files before it checks out the PR:
2024-11-14T00:29:29.769Z events/project_command_builder.go:330 'include-git-untracked-files' option is set, getting
untracked files
2024-11-14T00:29:29.770Z events/instrumented_project_command_builder.go:75 Error building plan commands: checking i
f workspace exists: stat /home/deploy/.atlantis/repos/foo/bar/123/default: no such file or directory
github.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandBuilder).buildAndEmitStats
github.com/runatlantis/atlantis/server/events/instrumented_project_command_builder.go:75
github.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandBuilder).BuildPlanCommands
github.com/runatlantis/atlantis/server/events/instrumented_project_command_builder.go:35
github.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).run
github.com/runatlantis/atlantis/server/events/plan_command_runner.go:195
github.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).Run
github.com/runatlantis/atlantis/server/events/plan_command_runner.go:307
github.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand
github.com/runatlantis/atlantis/server/events/command_runner.go:367
(This is with Atlantis 0.28.5. I could try 0.30.0, but I don't see any bug fixes that seem relevant in the changelog.)
Have also been running into this issue on Atlantis 0.29.0. I tried to work around it by setting TF_WORKSPACE, but with @quentinmit's comment, it seems that inlcude-git-untracked-files kicks things off before Atlantis can read my repo config and know what it should be planning.
I don't see this error on my projects that use a repo config generated with a pre-workflow hook.