I can create github status checks for the branch b...
# atlantis-community
e
I can create github status checks for the branch but sometimes we don’t need to run nonp and prod plan and apply. Since the change could only be for dev.
c
If you're not touching a prod project, Atlantis shouldn't require a prod plan/apply, at least the way ours is set up.
I see something like this in a PR like that:
s
You can also set different
apply_requirements
for different projects. for example some very lenient for dev and
mergeable
for prod. And you can also make
atlantis/apply
a required check in your branch protection to prevent from merging without apply. Then you will also need to follow https://www.runatlantis.io/docs/command-requirements.html#mergeable
n
@Chastity Blackwell I'm curious how you have atlantis setup. How many instances do you run and how do you make two atlantis instances play nice in one repo?
c
We have two atlantis servers, both look at the same repo, but there's two configuration files (
atlantis-nonprod.yaml
and
atlantis-prod.yaml
) which have projects configured -- so each project is only managed by one server.
Nonprod allows applies without merges by default, prod merges after applies by default. Nonprod allows applies without being mergeable, prod does not.
n
is there some way to configure each server to only look at a particular directory structure?
c
We just specify the projects specifically in atlantis.yaml and don't allow autodiscovery
n
ah interesting
e
Thank you @Chastity Blackwell and everyone. I just tried out the status checks and I accidentally specified the project itself not the environment. Also I’m curious how is your branching strategy? We have master as the truth for all environments and the PR triggers all Atlantis servers. Due to race condition, they can appear out of order
c
That is what we do too.
🙏 1
c
Did you happen to run into this issue? Where comment
atlantis apply -p production
triggers both atlantis instances, and causes an error because that project is not defined in the repo
atlantis-dev.yaml
set that to different values for each server
🙌 1
e
Hello, Yes I did and you have to change the executable name of the Atlantis service itself. It should be “atlantis-nonp apply” and “atlantis-prod apply”. You don’t need to do environments as a project name if you have environment-designated servers.
🙌 1
What @Nelson W said 🤗
c
That makes sense, thank you both. Does it matter that my checks have overlapping namespace? I notice in some of the other screenshots the checks have different prefixes but mine are all the same
e
The prefixes are the customized executable names set on the Atlantis server.
c
ah, maybe i just need to open a whole new pr or something so they update
ohh just had to set both, looks good now!
Copy code
ATLANTIS_EXECUTABLE_NAME="atlantis-nonprod"
ATLANTIS_VCS_STATUS_NAME="atlantis-nonprod"
🎉 1
c
Yeah, that's what you want to do -- sorry I didn't see this before!
c
No worries, thanks for all the help so far! Curious do you ever have tf repos which only have either an
atlantis-prod.yaml
or
atlantis-prod.yaml
but not both. For example, we have some projects that are only ever deployed to nonprod, but atlantis is still trying to run and getting an expected error. Not sure if there is a clean way of handling this.
I explicitly configure which repos are allowed and use that flag
c
Thanks that will work, it's an edge case that does not happen often so I don't mind adding those to the allowlist as an
!
exclusion