forked from openshift/os
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1963562
commit 0221a60
Showing
3 changed files
with
34 additions
and
6 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# This script is used to update the /etc/passwd file within the COSA container | ||
# at test-time. The need for this comes from the fact that OpenShift will run a | ||
# container with a randomized user ID by default to enhance security. Because | ||
# COSA runs with an unprivileged user ("builder") instead of (container) root, | ||
# this presents special challenges for file and disk permissions. This particular | ||
# pattern was inspired by: | ||
# - https://cloud.redhat.com/blog/jupyter-on-openshift-part-6-running-as-an-assigned-user-id | ||
# - https://cloud.redhat.com/blog/a-guide-to-openshift-and-uids | ||
|
||
set -xeuo | ||
|
||
user_id="$(id -u)" | ||
group_id="$(id -g)" | ||
|
||
cat /etc/passwd | grep -v "^builder" > /tmp/passwd | ||
echo "builder:x:${user_id}:${group_id}::/home/builder:/bin/bash" >> /tmp/passwd | ||
cat /tmp/passwd > /etc/passwd | ||
rm /tmp/passwd | ||
|
||
# Not strictly required, but nice for debugging. | ||
id | ||
whoami |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
# Give the newly-built OCI archive a predictable filename to make OCI archive | ||
# extraction / ingestion simpler in Prow. | ||
|
||
set -xeuo | ||
|
||
arch="x86_64" | ||
cosa_build_id="$(cat "${COSA_DIR}/builds/builds.json" | jq -r '.builds[0].id')" | ||
current_build_dir="${COSA_DIR}/builds/latest/${arch}" | ||
mv "${current_build_dir}/rhcos-${cosa_build_id}-ostree.${arch}.ociarchive" "${current_build_dir}/rhcos.${arch}.ociarchive" |