-
Notifications
You must be signed in to change notification settings - Fork 38
ENT-13030: fixup ubuntu 24 buildhost policy and added containers scripts to test the policy #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
Draft
craigcomstock
wants to merge
3
commits into
cfengine:master
Choose a base branch
from
craigcomstock:platform-containers
base: master
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.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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-upgraded | ||
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 @@ | ||
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,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 | ||
./upgrade-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,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
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,18 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
platform=$1 | ||
upgraded=$platform-upgraded | ||
if buildah images --format '{{.Name}}:{{.Tag}}' | grep $upgraded; then | ||
echo "container image $upgraded already exists. buildah rm $upgraded 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 apt update -y | ||
buildah run $platform apt upgrade -y | ||
buildah tag $platform $platform-$(date +%F) | ||
buildah commit $platform $upgraded | ||
buildah rm $platform |
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.