-
Notifications
You must be signed in to change notification settings - Fork 39
ENT-13030: various fixes for build host setup scripts during jenkins node yaml refactoring and simplification #1769
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
craigcomstock
merged 5 commits into
cfengine:master
from
craigcomstock:platform-containers
Jun 24, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6b6706b
Added ci scripts to use buildah to build upgraded platform images and…
craigcomstock 17651a1
Adjusted buildhost policy for ubuntu-24 regarding libncurses
craigcomstock 2ca11e6
Adjusted several ci components to work well with containers
craigcomstock 0d6fe1e
Added build host policy to resize /tmp mount if present to needed 5G …
craigcomstock 236f900
Fixed several things for older platforms, especially using older vers…
craigcomstock 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/usr/bin/env bash | ||
| set -ex | ||
|
|
||
| platform=$1 | ||
| c=$platform | ||
| base=$platform-patched | ||
| built=$platform-buildhost | ||
| if buildah images --format '{{.Name}}:{{.Tag}}' | grep $built; then | ||
| echo "container image $built already exists, remove if you want to rebuild" | ||
| continue | ||
| fi | ||
|
|
||
| buildah rm $c || true | ||
| buildah --name $c from $base | ||
| buildah copy $c . /buildscripts/ci | ||
|
|
||
| # This section is debian specific for now. TODO: add alternatives when we add more platforms. | ||
| buildah run $c apt install -y procps wget sudo | ||
| buildah run $c apt remove -y cfengine-nova || true | ||
|
|
||
| buildah run $c rm -rf /var/cfengine || true | ||
| # touch flag file for policy to know it is in a container and avoid some aspects of configuration | ||
| buildah run $c touch /etc/cfengine-in-container.flag | ||
| buildah run $c /buildscripts/ci/setup-cfengine-build-host.sh | tee setup-cfengine-build-host.log | ||
| # the above, if errored out, is not causing an error, need to fix that. | ||
| grep -i error setup-cfengine-build-host.log && exit 1 | ||
| buildah tag $c $c-$(date +%F) | ||
| buildah commit $c $c-buildhost | ||
| buildah rm $c |
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 @@ | ||
| b9afe61210c43880aada212eb6119506c00bcc030b17c2cbdd0bf88a1514bd82 cfengine-masterfiles-3.21.7-1.pkg.tar.gz |
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 @@ | ||
| 1217b72455f09776442c5abb40b66f49629175b298c0b7baf0d5ba5ffe94e5ed cfengine-masterfiles-3.26.0-1.pkg.tar.gz |
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 @@ | ||
| buildah images | grep buildhost | awk '{print $3}' | xargs buildah rmi |
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,34 @@ | ||
| #!/usr/bin/env bash | ||
| set -ex | ||
| if grep CODENAME=stretch /etc/os-release; then | ||
| echo "deb http://archive.debian.org/debian-archive/debian stretch main" >/etc/apt/sources.list | ||
| echo "deb http://archive.debian.org/debian-archive/debian stretch-backports main" >>/etc/apt/sources.list | ||
| fi | ||
| if grep "CentOS Linux 7" /etc/os-release; then | ||
| sed -i 's/mirror.centos.org/vault.centos.org/;/^mirrorlist/d;s/^#baseurl/baseurl/' /etc/yum.repos.d/CentOS-Base.repo | ||
| fi | ||
| if command -v yum; then | ||
| yum -e 0 -d 0 -y update | ||
| yum -e 0 -d 0 -y install git rsync | ||
| fi | ||
| if command -v apt; then | ||
| DEBIAN_FRONTEND=noninteractive apt -yqq update | ||
| DEBIAN_FRONTEND=noninteractive apt -yqq upgrade | ||
| DEBIAN_FRONTEND=noninteractive apt install -yqq git rsync | ||
| fi | ||
| if command -v zypper; then | ||
| source /etc/os-release | ||
| rpm --import https://download.opensuse.org/distribution/leap/$VERSION_ID/repo/oss/repodata/repomd.xml.key | ||
| zypper ar -cfp 90 https://download.opensuse.org/distribution/leap/$VERSION_ID/repo/oss/ oss | ||
| for repo in oss sle backports; do | ||
| rpm --import https://download.opensuse.org/update/leap/$VERSION_ID/$repo/repodata/repomd.xml.key | ||
| zypper ar -cfp 70 https://download.opensuse.org/update/leap/$VERSION_ID/$repo/ update-$repo | ||
| done | ||
| zypper -qn ref | ||
| zypper lr # diagnostic to see what repos are enabled | ||
| zypper -qn update | ||
| zypper -qn rm libsnmp15 | ||
| zypper -qn install git rsync | ||
| groupadd jenkins || true | ||
| useradd -m -u 1010 -g jenkins jenkins || true | ||
| fi |
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,9 @@ | ||
| #!/usr/bin/env bash | ||
| set -ex | ||
|
|
||
| # todo: centos7, opensuse/leap:15 (no :12), registry.access.redhat.com/ubi9 (-minimal, -init, -micro (standard)) | ||
| # run this on x86 and arm hardware to cover "all the bases" :) | ||
| for platform in $(cat platform-container-image.list); do | ||
| ./patched-image.sh $platform | ||
| ./buildhost-image.sh $platform | ||
| done |
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 |
|---|---|---|
| @@ -1,29 +1,38 @@ | ||
| #!/usr/bin/env bash | ||
| set -e | ||
| # install jdk "manually" | ||
| # depending on os, might want to do something like `apt remove default-jre openjdk-*-jre-*` | ||
| cd /opt | ||
| baseurl=https://download.oracle.com/java/21/latest/ | ||
| version=21.0.7 | ||
| if uname -m | grep aarch64; then | ||
| tarball=jdk-21_linux-aarch64_bin.tar.gz | ||
| sha=47372cfa9244dc74ec783a1b287381502419b564fbd0b18abc8f2d6b19ac865e | ||
| else | ||
| tarball=jdk-21_linux-x64_bin.tar.gz | ||
| sha=267b10b14b4e5fada19aca3be3b961ce4f81f1bd3ffcd070e90a5586106125eb | ||
| fi | ||
| wget --quiet "$baseurl$tarball" | ||
| echo "$sha" "$tarball" | sha256sum --check - | ||
| sudo tar xf "$tarball" | ||
| sudo tee /etc/profile.d/jdk.sh << EOF | ||
|
|
||
| install_jdk() { | ||
| # install jdk "manually" | ||
| # depending on os, might want to do something like `apt remove default-jre openjdk-*-jre-*` | ||
| cd /opt | ||
| baseurl=https://download.oracle.com/java/21/latest/ | ||
| version=21.0.7 | ||
| if uname -m | grep aarch64; then | ||
| tarball=jdk-21_linux-aarch64_bin.tar.gz | ||
| sha=47372cfa9244dc74ec783a1b287381502419b564fbd0b18abc8f2d6b19ac865e | ||
| else | ||
| tarball=jdk-21_linux-x64_bin.tar.gz | ||
| sha=267b10b14b4e5fada19aca3be3b961ce4f81f1bd3ffcd070e90a5586106125eb | ||
| fi | ||
| wget --quiet "$baseurl$tarball" | ||
| echo "$sha" "$tarball" | sha256sum --check - | ||
| tar xf "$tarball" | ||
| tee /etc/profile.d/jdk.sh << EOF | ||
| export JAVA_HOME="/opt/jdk-$version" | ||
| export PATH=\$PATH:\$JAVA_HOME/bin | ||
| EOF | ||
| sudo chown -R root:jenkins "/opt/jdk-$version" | ||
| sudo chmod -R g+rx "/opt/jdk-$version" | ||
| if command -v update-alternatives; then | ||
| sudo update-alternatives --install /usr/bin/java java "/opt/jdk-$version/bin/java" 9999 | ||
| chown -R root:jenkins "/opt/jdk-$version" | ||
| chmod -R g+rx "/opt/jdk-$version" | ||
| if command -v update-alternatives; then | ||
| update-alternatives --install /usr/bin/java java "/opt/jdk-$version/bin/java" 9999 | ||
| else | ||
| ln -s "/opt/jdk-$version/bin/java" /usr/bin/java | ||
| fi | ||
| cd - | ||
| } | ||
|
|
||
| if [ "$(whoami)" = "root" ]; then | ||
| install_jdk | ||
| else | ||
| sudo ln -s "/opt/jdk-$version/bin/java" /usr/bin/java | ||
| sudo bash -c install_jdk | ||
| fi | ||
| cd - |
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,17 @@ | ||
| #!/usr/bin/env bash | ||
| set -ex | ||
|
|
||
| platform=$1 | ||
| patched=$platform-patched | ||
| if buildah images --format '{{.Name}}:{{.Tag}}' | grep $patched; then | ||
| echo "container image $patched already exists. buildah rm $patched if you want to regenerate" | ||
| continue | ||
| fi | ||
| if ! buildah ps | grep $platform; then | ||
| buildah --name $platform from $platform | ||
| fi | ||
| buildah copy $platform . /buildscripts/ci | ||
| buildah run $platform /buildscripts/ci/distribution-patched.sh | ||
| #buildah tag $platform $platform-$(date +%F) | ||
| #buildah commit $platform $patched | ||
| #buildah rm $platform |
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,5 @@ | ||
| debian:11 | ||
| debian:12 | ||
| ubuntu:20.04 | ||
| ubuntu:22.04 | ||
| ubuntu:24.04 |
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.