-
Notifications
You must be signed in to change notification settings - Fork 229
USHIFT-2924: Add support for templates in bootc image and container files #3320
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
381d0c3
Add support for gomplate in bootc image and container files
ggiguash 6ada90b
Switch to using rhocp and fastdatapath repos in rhel images
ggiguash 3c4f0ec
Fix template destination file names
ggiguash a53d3c9
Reimplement templating to work on bootc-sources contents
ggiguash dfa3bcf
Use repository template files instead of configuration script
ggiguash 0366319
Revert "Use repository template files instead of configuration script"
ggiguash babb466
Add repository content printout
ggiguash 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 hidden or 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 hidden or 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 hidden or 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,115 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| USHIFT_LOCAL_REPO_FILE=/etc/yum.repos.d/microshift-local.repo | ||
| OCP_MIRROR_REPO_FILE=/etc/yum.repos.d/openshift-mirror-beta.repo | ||
| OCP_DTPATH_REPO_FILE=/etc/yum.repos.d/openshift-fast-datapath.repo | ||
| OCP_RHOCP_REPO_FILE=/etc/yum.repos.d/openshift-rhocp.repo | ||
|
|
||
| usage() { | ||
| echo "Usage: $(basename $0) <-create microshift_local_repo_path | -delete>" | ||
| [ -n "$1" ] && echo "ERROR: $1" | ||
| exit 1 | ||
| } | ||
|
|
||
| del_repo_files() { | ||
| rm -f "${USHIFT_LOCAL_REPO_FILE}" | ||
| rm -f "${OCP_MIRROR_REPO_FILE}" | ||
| rm -f "${OCP_DTPATH_REPO_FILE}" | ||
| rm -f "${OCP_RHOCP_REPO_FILE}" | ||
| } | ||
|
|
||
| config_local_repos() { | ||
| local -r repo_path=$1 | ||
| cat > "${USHIFT_LOCAL_REPO_FILE}" <<EOF | ||
| [microshift-local] | ||
| name=MicroShift Local Repository | ||
| baseurl=${repo_path} | ||
| enabled=1 | ||
| gpgcheck=0 | ||
| skip_if_unavailable=0 | ||
| EOF | ||
| } | ||
|
|
||
| config_centos9_repos() { | ||
| cat > "${OCP_MIRROR_REPO_FILE}" <<EOF | ||
| [openshift-mirror-beta] | ||
| name=OpenShift Mirror Beta Repository | ||
| baseurl=https://mirror.openshift.com/pub/openshift-v4/{{ .Env.UNAME_M }}/dependencies/rpms/4.{{ .Env.PREVIOUS_MINOR_VERSION }}-el9-beta/ | ||
| enabled=1 | ||
| gpgcheck=0 | ||
| skip_if_unavailable=0 | ||
| EOF | ||
| } | ||
|
|
||
| config_rhel9_repos() { | ||
| local -r sslkey=$(find /etc/pki/entitlement-host/ -type f -name "*-key.pem" -print -quit) | ||
| local -r sslcrt=$(find /etc/pki/entitlement-host/ -type f -name "*.pem" ! -name "*-key.pem" -print -quit) | ||
|
|
||
| cat > "${OCP_DTPATH_REPO_FILE}" <<EOF | ||
| [openshift-fast-datapath] | ||
| name=Fast Datapath for RHEL 9 | ||
| baseurl=https://cdn.redhat.com/content/dist/layered/rhel9/{{ .Env.UNAME_M }}/fast-datapath/os | ||
| enabled=1 | ||
| gpgcheck=1 | ||
| gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release | ||
| sslverify=1 | ||
| sslcacert = /etc/rhsm/ca/redhat-uep.pem | ||
| sslclientkey = ${sslkey} | ||
| sslclientcert = ${sslcrt} | ||
| skip_if_unavailable=0 | ||
| EOF | ||
|
|
||
| cat > "${OCP_RHOCP_REPO_FILE}" <<EOF | ||
| [openshift-rhocp] | ||
| name=OpenShift Dependencies RHEL 9 | ||
| baseurl=https://cdn.redhat.com/content/dist/layered/rhel9/{{ .Env.UNAME_M }}/rhocp/4.{{ .Env.PREVIOUS_MINOR_VERSION }}/os | ||
| enabled=1 | ||
| gpgcheck=1 | ||
| gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release | ||
| sslverify=1 | ||
| sslcacert = /etc/rhsm/ca/redhat-uep.pem | ||
| sslclientkey = ${sslkey} | ||
| sslclientcert = ${sslcrt} | ||
| skip_if_unavailable=0 | ||
| EOF | ||
| } | ||
|
|
||
| # Parse command line | ||
| if [ $# -ne 1 ] && [ $# -ne 2 ] ; then | ||
| usage "Wrong number of arguments" | ||
| fi | ||
| RUN_MODE=$1 | ||
|
|
||
| # Exit if the current user is not 'root' | ||
| if [ "$(id -u)" -ne 0 ] ; then | ||
| echo "The '$(basename $0)' script must be run with the 'root' user privileges" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Install the repository files | ||
| case "${RUN_MODE}" in | ||
| -create) | ||
| LOCAL_REPO_PATH=$2 | ||
| [ -z "${LOCAL_REPO_PATH}" ] && usage "MicroShift local repository path argument is missing" | ||
| # Configure the local repositories | ||
| config_local_repos "${LOCAL_REPO_PATH}" | ||
| # Configure the OS-specific remote repositories | ||
| os_id=$(awk -F= '$1=="ID" { print $2 }' /etc/os-release | xargs) | ||
| if [ "${os_id}" == "centos" ] ; then | ||
| config_centos9_repos | ||
| elif [ "${os_id}" == "rhel" ] ; then | ||
| config_rhel9_repos | ||
| else | ||
| usage "Only RHEL or CentOS operating systems are supported" | ||
| fi | ||
| # Print the repository contents | ||
| awk 'FNR==1 {print "=== " FILENAME " ==="} {print}' /etc/yum.repos.d/*.repo | ||
| ;; | ||
| -delete) | ||
| del_repo_files | ||
| ;; | ||
| *) | ||
| usage "Wrong arguments" | ||
| ;; | ||
| esac |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.