#atlantis (2024-12)

atlantis

Discuss the Atlantis (<http://runatlantis.iorunatlantis.io>)

**Archive: ** https://archive.sweetops.com/atlantis/

2024-12-12

Alcp avatar

Question about atlantis integration with atmos does atlantis honor settings.depends_on config from the stack file

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

Atlantis does not know about those Atmos settings

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

@jose.amengual can provide you with more info on how to use Atlantis with Atmos

jose.amengual avatar
jose.amengual

no, it does not @Alcp

jose.amengual avatar
jose.amengual

@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/
Alcp avatar

any suggestions on how to manage the dependent items first

jose.amengual avatar
jose.amengual

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"
jose.amengual avatar
jose.amengual

Ideally Atmos could allow to have a free map on those two settings butI’m not sure if that is possible

jose.amengual avatar
jose.amengual

otherwise we will need Atmos code updates every time we add something to those file when we release new versions of Atlantis

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

@jose.amengual those are not free-form maps

jose.amengual avatar
jose.amengual

Alcp avatar

so for order of execution is that something atlantis support?

jose.amengual avatar
jose.amengual

yes

jose.amengual avatar
jose.amengual
execution_order_group: 1
  depends_on:
    - project-1
Alcp avatar

So basically we need to have a custom solution to generate the atlantis.yaml that creates the execution group

jose.amengual avatar
jose.amengual

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

Alcp avatar

ok that could work.. will try it

jose.amengual avatar
jose.amengual

pre_workflow_hook

Alcp avatar

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

jose.amengual avatar
jose.amengual

the problem is this : /default

jose.amengual avatar
jose.amengual

your PR from Atmos uses a workspace other than default

jose.amengual avatar
jose.amengual

so make sure the selection of the workspace happens correctly in Atlantis otherwise it will not see the files from the PR

jose.amengual avatar
jose.amengual

Atlantis clones the PR on the Workspace repo

jose.amengual avatar
jose.amengual

so it should look like

"/atlantis-data/repos/SIE/cratos/300/${{atmos.workspace}}"
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

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.

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

@Alcp if you want to take a look at the code, let us know. We also have a atmos-dev channel.

Alcp avatar

@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

jose.amengual avatar
jose.amengual

do you have an atlantis.yaml committed to the repo?, or is always autogenerated?

jose.amengual avatar
jose.amengual

for this kind of setups, autoplan is not very helful

jose.amengual avatar
jose.amengual

there is a long oustanding issue in atlantis to improve the locks and add better support for workspaces that could avoid this issue

jose.amengual avatar
jose.amengual

but no one to work on it. It requires Advance golang knowledge

Alcp avatar

atlantis.yaml is always autogenerated in our case, so the work around is to plan twice?

Alcp avatar

do you have an issue at git…

jose.amengual avatar
jose.amengual
#2538 pre_workflow_hooks scope only works on the default workspace

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.

Alcp avatar

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?

jose.amengual avatar
jose.amengual

no, is to do nothing, it will not automerge for you

jose.amengual avatar
jose.amengual
#260 Run plan/apply for multiple projects in parallel

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.

jose.amengual avatar
jose.amengual
#4997 fix: Add retry on locks

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

Alcp avatar


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

jose.amengual avatar
jose.amengual

and you do not have automerge enabled?

jose.amengual avatar
jose.amengual

as a startup option maybe?

Alcp avatar

no I don’t have it at startup or at the repo or server config

jose.amengual avatar
jose.amengual

I do not recall us setting that as default

jose.amengual avatar
jose.amengual

do you have any other tool that could be doing that?

Alcp avatar

not really .. its merged by the atlantis github account

jose.amengual avatar
jose.amengual

that is weird, I will have to check the changelog to see if we defaulted that to true

2024-12-13

2024-12-19

Release notes from atlantis avatar
Release notes from atlantis
03:08:51 AM

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”…

Release v0.32.0 · runatlantis/atlantisattachment image

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 - Community Inviterattachment image

Join Cloud Native Computing Foundation on Slack. Powered by Community Inviter. You will get an invitation soon. Check your inbox.

2024-12-20

Release notes from atlantis avatar
Release notes from atlantis
05:08:52 PM

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…

Release v0.32.0 · runatlantis/atlantisattachment image

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 - Community Inviterattachment image

Join Cloud Native Computing Foundation on Slack. Powered by Community Inviter. You will get an invitation soon. Check your inbox.

notdurson - Overview

SecEng at @cresta . notdurson has 3 repositories available. Follow their code on GitHub.

    keyboard_arrow_up