#atlantis (2024-12)
Discuss the Atlantis (<http://runatlantis.io | runatlantis.io>) |
**Archive: ** https://archive.sweetops.com/atlantis/
2024-12-12
Question about atlantis integration with atmos does atlantis honor settings.depends_on config from the stack file
Atlantis does not know about those Atmos settings
@jose.amengual can provide you with more info on how to use Atlantis with Atmos
no, it does not @Alcp
@Andriy Knysh (Cloud Posse) I believe this map is not a free map, right ?
config_templates:
config-1:
version: 3
automerge: true
delete_source_branch_on_merge: true
parallel_plan: true
parallel_apply: true
allowed_regexp_prefixes:
- automation/
- dev/
- qa/
- staging/
- prod/
any suggestions on how to manage the dependent items first
same with this:
project_templates:
project-1:
# generate a project entry for each component in every stack
name: "{namespace}-{environment}-{component}"
workspace: "{workspace}"
dir: "{component-path}"
terraform_version: v1.2.9
delete_source_branch_on_merge: true
apply_requirements:
- "approved"
autoplan:
enabled: false
when_modified:
- "**/*.tf"
- "$PROJECT_NAME.tfvars.json"
Ideally Atmos could allow to have a free map on those two settings butI’m not sure if that is possible
otherwise we will need Atmos code updates every time we add something to those file when we release new versions of Atlantis
@jose.amengual those are not free-form maps
so for order of execution is that something atlantis support?
yes
execution_order_group: 1
depends_on:
- project-1
So basically we need to have a custom solution to generate the atlantis.yaml that creates the execution group
you can have Atmos generate the atlantis.yaml and after run another script that adds the depends on, that , until CloudPosse can integrate the newest atlantis aditions to the atlantis.yaml info the Atmos integration
ok that could work.. will try it
pre_workflow_hook
I have the script that generates the atlantis.yaml in the pre_workflow_hook with this setup, every first time we run atlantis plan we get this error
Ran Plan for dir: . workspace: default
Plan Error
running "terraform init -input=false -backend-config backends/$PROJECT_NAME.tf" in "/atlantis-data/repos/SIE/cratos/300/default": exit status 1: running "terraform init -input=false -backend-config backends/$PROJECT_NAME.tf" in "/atlantis-data/repos/SIE/cratos/300/default":
Initializing the backend...
╷
│ Error: Failed to read file
│
│ The file "backends/.tf" could not be read.
when we run the atlantis plan again, it works again correctly .. not sure whats happens here
the problem is this : /default
your PR from Atmos uses a workspace other than default
so make sure the selection of the workspace happens correctly in Atlantis otherwise it will not see the files from the PR
Atlantis clones the PR on the Workspace repo
so it should look like
"/atlantis-data/repos/SIE/cratos/300/${{atmos.workspace}}"
We intend to make it a free form map, but we’re slammed with client work right now and not sure when we can get to it.
@Alcp if you want to take a look at the code, let us know. We also have a atmos-dev channel.
@jose.amengual wrt to the above error when I do atlantis plan the first time, the pre-workflow-hook get’s triggered and it generates the atlantis.yaml file in the default workspace, during this run atlantis plan ignores the atlantis.yaml file generated and just runs with default repo autodiscover mode.
The second time atlantis plan is run, this time it sees the atlantis.yaml already in the default workspace and works correctly. I disabled ATLANTIS_AUTODISCOVER_MODE=disabled
this avoids the error but the behavior is same the first atlantis plan it doesn’t plan any projects but the second run of plan works correctly
do you have an atlantis.yaml committed to the repo?, or is always autogenerated?
for this kind of setups, autoplan is not very helful
there is a long oustanding issue in atlantis to improve the locks and add better support for workspaces that could avoid this issue
but no one to work on it. It requires Advance golang knowledge
atlantis.yaml is always autogenerated in our case, so the work around is to plan twice?
do you have an issue at git…
Community Note
• Please vote on this issue by adding a :+1: 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.
• I’d be willing to implement this feature (contributing guide)
Describe the user story
Pre workflow hooks happen before any atlantis.yaml file is parsed and they are generally used to generate atlantis.yaml files dynamically which work in that case since the generated atlantis.yaml
file is parsed on the default workspace, but if you generate an atlantis.yaml file that uses a different workspace any run command that tries to generate other files on the fly will work but save the files within the default workspace dir instead of the one that will be used in the generated atlantis.yaml file.
atlantis/server/events/pre_workflow_hooks_command_runner.go
Line 50 in485c4b5
| unlockFn, err := w.WorkingDirLocker.TryLock(baseRepo.FullName, pull.Num, DefaultWorkspace, DefaultRepoRelDir) | | ————————————————————————————————————- |
a server side repo config like this :
pre_workflow_hooks:
- run: generate_file_for_workspace.sh
- run: generate_atlantis.yaml
will save all generated files on the repo dir structure inside the atlantis dir like so:
.atlantis/repos/jamengual/atlantmos/1/default\
and the DefaultWorkspace = `default.
Describe the solution you’d like
it will be ideal if the pre_workflow_hooks can allow for the selection of the $WORKSPACE dir instead of assume the default workspace will be used
for example:
pre_workflow_hooks:
- run: WORKSPACE=`select_workspace.sh`
- run: generate_file_for_workspace.sh
- run: WORKSPACE="default" generate_atlantis.yaml
or any other way that makes it easier to define and use.
Describe the drawbacks of your solution
This could potentially require changes to how the atlantis.yaml
file could be parsed when generated dynamically or at the very least updated documentation explaining how this happens so the user is aware that the default workspace must be used for the parsing of the atlantis.yaml file.
btw the version I am using is v0.27.3 wrt automerge, after all applys are successful, the PR gets merged… my question here I don’t have automerge flags set anywhere in repo config or server config .. the default behavior is to merge?
no, is to do nothing, it will not automerge for you
Via @psalaberria002, would like Atlantis to run plan and apply in parallel when running a command that needs to run on multiple projects. This would make things much faster.
what
I’m opening this as a draft to receive feedback early, I don’t expect this to break anything but I believe it could be hidden behind a flag and with better default values for timeout and retries (maybe exponential retry?).
This adds a retry logic to the lock mechanism to mitigate the issue described in here and also in this ADR.
The locking issue itself is more complex and requires much more work, this is just a small step so users don’t have to see the error anymore effectively making the code wait instead of asking the user to retry.
why
Currently the user has to rerun any operations that fail because a certain workspace path is locked, this tries just to automate the process.
tests
Will add if this approach receive support.
references
Did my best to try to understand which issues this would affect.
Relates to #3345
Relates to #2921
Relates to #2882
Relates to #4489
Relates to #305
Relates to #4829
Relates to #1847
Relates to #4566
Closes #1618
Closes #2200
Closes #3785
Closes #4489
Closes #4368
no, is to do nothing, it will not automerge for you
but the behavior I am seeing is it auto merges after all applies are successful
and you do not have automerge enabled?
as a startup option maybe?
no I don’t have it at startup or at the repo or server config
I do not recall us setting that as default
do you have any other tool that could be doing that?
not really .. its merged by the atlantis github account
that is weird, I will have to check the changelog to see if we defaulted that to true
2024-12-13
2024-12-19
v0.32.0 We have moved to the CNCF Slack, join our new slack community using this link https://communityinviter.com/apps/cloud-native/cncf What’s Changed Other Changes
chore(deps): update [ghcr.io/runatlantis/atlantis//ghcr.io/runatlantis/atlantis:latest) docker digest to f9e0b6f in dockerfile.dev (main) by <a class=”user-mention notranslate” data-hovercard-type=”user” data-hovercard-url=”/users/renovate/hovercard”…
We have moved to the CNCF Slack, join our new slack community using this link https://communityinviter.com/apps/cloud-native/cncf What’s Changed Other Changes
chore(deps): update ghcr.io/runatla…
Join Cloud Native Computing Foundation on Slack. Powered by Community Inviter. You will get an invitation soon. Check your inbox.
2024-12-20
v0.32.0 We have moved to the CNCF Slack, join our new slack community using this link https://communityinviter.com/apps/cloud-native/cncf What’s Changed Exciting New Features
@notdurson made…
We have moved to the CNCF Slack, join our new slack community using this link https://communityinviter.com/apps/cloud-native/cncf What’s Changed Exciting New Features
@notdurson made their first…
Join Cloud Native Computing Foundation on Slack. Powered by Community Inviter. You will get an invitation soon. Check your inbox.
SecEng at @cresta . notdurson has 3 repositories available. Follow their code on GitHub.