-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
chore: Specify uid for consistent uids over images #4304
Open
kvanzuijlen
wants to merge
11
commits into
runatlantis:main
Choose a base branch
from
kvanzuijlen:patch-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+11
−9
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6da77d8
chore: Specify uid for consistent uids over images
kvanzuijlen 2bab703
chore: Make Atlantis system user on Debian
kvanzuijlen 55691cf
chore: Changed uid to 100
kvanzuijlen 51416cb
Merge branch 'main' into patch-1
jamengual a1d739c
chore: Added another user with uid 1000
kvanzuijlen 3f1134c
Merge remote-tracking branch 'origin/patch-1' into patch-1
kvanzuijlen 36e2e19
Merge branch 'main' into patch-1
jamengual f5c3b4f
Merge branch 'main' into patch-1
kvanzuijlen 4a509dc
Merge branch 'main' into patch-1
jamengual 3a8196b
chore: Pinned gid as well
kvanzuijlen 4489774
Merge branch 'main' into patch-1
jamengual File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,14 @@ RUN --mount=type=cache,target=/go/pkg/mod \ | |
--mount=type=cache,target=/root/.cache/go-build \ | ||
CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X 'main.version=${ATLANTIS_VERSION}' -X 'main.commit=${ATLANTIS_COMMIT}' -X 'main.date=${ATLANTIS_DATE}'" -v -o atlantis . | ||
|
||
FROM debian:${DEBIAN_TAG} as debian-base | ||
FROM debian:${DEBIAN_TAG} AS debian-base | ||
|
||
# Set up the 'atlantis' user and adjust permissions. User with uid 1000 is for backwards compatibility | ||
RUN groupadd --gid 1000 atlantis && \ | ||
useradd --uid 100 --system --create-home --gid 1000 --shell /bin/bash atlantis && \ | ||
useradd --uid 1000 --system --home=/home/atlantis/ --gid 1000 --shell /bin/bash atlantis2 && \ | ||
chown atlantis:atlantis /home/atlantis/ && \ | ||
chmod ug+rwx /home/atlantis/ | ||
|
||
# Install packages needed to run Atlantis. | ||
# We place this last as it will bust less docker layer caches when packages update | ||
|
@@ -64,7 +71,7 @@ RUN apt-get update && \ | |
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
FROM debian-base as deps | ||
FROM debian-base AS deps | ||
|
||
# Get the architecture the image is being built for | ||
ARG TARGETPLATFORM | ||
|
@@ -139,8 +146,8 @@ HEALTHCHECK --interval=5m --timeout=3s \ | |
CMD curl -f http://localhost:${ATLANTIS_PORT:-4141}/healthz || exit 1 | ||
|
||
# Set up the 'atlantis' user and adjust permissions | ||
RUN addgroup atlantis && \ | ||
adduser -S -G atlantis atlantis && \ | ||
RUN addgroup --gid 1000 atlantis && \ | ||
adduser -u 100 -S -G atlantis atlantis && \ | ||
chown atlantis:root /home/atlantis/ && \ | ||
chmod u+rwx /home/atlantis/ | ||
Comment on lines
+149
to
152
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dupe of line no. 50 RUN cmds? |
||
|
||
|
@@ -179,11 +186,6 @@ EXPOSE ${ATLANTIS_PORT:-4141} | |
HEALTHCHECK --interval=5m --timeout=3s \ | ||
CMD curl -f http://localhost:${ATLANTIS_PORT:-4141}/healthz || exit 1 | ||
|
||
# Set up the 'atlantis' user and adjust permissions | ||
RUN useradd --create-home --user-group --shell /bin/bash atlantis && \ | ||
chown atlantis:root /home/atlantis/ && \ | ||
chmod u+rwx /home/atlantis/ | ||
|
||
# copy atlantis binary | ||
COPY --from=builder /app/atlantis /usr/local/bin/atlantis | ||
# copy terraform binaries | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to discuss this.
We need to keep backward compatibility or make the breaking change.
A lot of people is already using this and if we change it it could bring some deployments down
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GMartinez-Sisti @nitrocode @GenPage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The atlantis user does not need a shell to start, so a system user was used.
the problem is that in Alpine we have a different UUID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean. But not making it equal makes it harder to make the helm chart work for both. The helm chart defaults to 100 so that was what we were trying to ensure here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not saying this is wrong but changing it will break backwards compatibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A possible option is to add both users (100 and 1000) on debian. This way the helm chart will be correct and existing users won't have issues. Otherwise we will need to do a breaking change release indeed. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that could work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like two maintainers agreed, so I'd say let's go with this. @kvanzuijlen can you please update it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! I'll have a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for alpine and should stay on 100, as it already was the default