Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow arbitrary user to run atlantis #346

Merged
merged 1 commit into from
Nov 28, 2018

Conversation

jocelynthode
Copy link
Contributor

This PR should allow atlantis to run with an arbitrary uid.

This is particularly useful when running on Openshift for example where by default the uid is arbitrary.

Fixes issue #345

@codecov
Copy link

codecov bot commented Nov 8, 2018

Codecov Report

Merging #346 into master will increase coverage by 0.12%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #346      +/-   ##
==========================================
+ Coverage    70.6%   70.72%   +0.12%     
==========================================
  Files          61       61              
  Lines        3681     3676       -5     
==========================================
+ Hits         2599     2600       +1     
+ Misses        901      895       -6     
  Partials      181      181
Impacted Files Coverage Δ
server/events/vcs/github_client.go 74.11% <0%> (+0.3%) ⬆️
server/server.go 64.12% <0%> (+1.43%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67f7054...176bbd8. Read the comment docs.

@jocelynthode jocelynthode changed the title [WIP] Allow arbitrary user to run atlantis Allow arbitrary user to run atlantis Nov 12, 2018
@jocelynthode
Copy link
Contributor Author

@lkysow I removed the fsGroup from the helm chart is there something else to consider as well ?

Dockerfile Outdated Show resolved Hide resolved
docker-base/Dockerfile Outdated Show resolved Hide resolved
docker-base/Dockerfile Outdated Show resolved Hide resolved

ENV ATLANTIS_HOME_DIR=/home/atlantis
ENV HOME=/home/atlantis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this line.

Copy link
Contributor Author

@jocelynthode jocelynthode Nov 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed the HOME environment variable.

However in the docker-entrypoint.sh I have changed the line added to /etc/passwd to:

echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:/home/atlantis:/sbin/nologin" >> /etc/passwd

This way a user running the image on an openshift cluster won't have to set the HOME variable in their deployment to "/home/atlantis" and this way the shell is still setting it.

Is this ok with you ?

docker-base/Dockerfile Outdated Show resolved Hide resolved
docker-entrypoint.sh Outdated Show resolved Hide resolved
@jocelynthode
Copy link
Contributor Author

I won't be able to test the image incorporating your changes and mine before monday. Could we wait until this to confirm everything is working as expected ?

@lkysow
Copy link
Member

lkysow commented Nov 26, 2018

@jocelynthode sounds good. Please squash your commits into one if everything works.

@jocelynthode
Copy link
Contributor Author

@lkysow I was able to test and everything works. However as expected the user has to specify the data dir or specify a HOME environment variable otherwise atlantis tries to clone in /.

I think we should maybe specify somewhere in the doc that the docker image expects either the HOME variable to be "/home/atlantis" or the data-dir variable to be set to "/home/atlantis" as this is currently the only folder that has the correct permissions

@lkysow lkysow merged commit 8f4bf27 into runatlantis:master Nov 28, 2018
@lkysow
Copy link
Member

lkysow commented Nov 28, 2018

Thanks for all your hard work! Yes I think I'll add an OpenShift section to the deployment docs.

lkysow added a commit that referenced this pull request Nov 28, 2018
- Upon merging #346 I
manually built and pushed a new version of runatlantis/atlantis-base and
tagged it as runatlantis/atlantis-base:v2.0. This change uses that new
tag. Before it was using :latest which isn't good if other people see
that and use atlantis-base:latest because we could break it for them.
- I've also put back the fsContext to 1000 because the atlantis user is
still in that group so we need that for kubernetes.
@lkysow lkysow mentioned this pull request Nov 28, 2018
lkysow added a commit that referenced this pull request Nov 28, 2018
After merging #346, we now
support OpenShift however users need an additional flag to atlantis
server for it to work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants