Skip to content
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

Add IBM Dockerfile #5599

Open
wants to merge 52 commits into
base: master-p10
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
eb78685
Add demo files
danlarson-ibm Aug 4, 2023
6b4ebf1
full compile
danlarson-ibm Aug 4, 2023
6dd9a54
add Jenkinsfile
danlarson-ibm Aug 4, 2023
66242b2
then
danlarson-ibm Aug 4, 2023
a8079ce
install git
danlarson-ibm Aug 4, 2023
38f8e5c
cd
danlarson-ibm Aug 4, 2023
63d2a5c
cd
danlarson-ibm Aug 4, 2023
08cbcc0
branch
danlarson-ibm Aug 4, 2023
e811b84
workspace
danlarson-ibm Aug 4, 2023
705579a
seperate podman files
danlarson-ibm Aug 7, 2023
984fcc2
Add artifactory upload
danlarson-ibm Aug 8, 2023
8bccbf0
remove jfrog token setting
danlarson-ibm Aug 8, 2023
6509070
spaces matter
danlarson-ibm Aug 8, 2023
feeeceb
no dir
danlarson-ibm Aug 8, 2023
6ae607d
add push
danlarson-ibm Aug 8, 2023
4e39aad
-
danlarson-ibm Aug 8, 2023
6b76bf1
tag_name
danlarson-ibm Aug 8, 2023
ee0f618
update tag
danlarson-ibm Aug 8, 2023
8e38682
different name
danlarson-ibm Aug 8, 2023
60c6cdb
chmod
danlarson-ibm Aug 8, 2023
83241b0
try again
danlarson-ibm Aug 8, 2023
d65800b
short
danlarson-ibm Aug 8, 2023
686554d
podman
danlarson-ibm Aug 8, 2023
6353f86
faster
danlarson-ibm Aug 8, 2023
ceb8612
why
danlarson-ibm Aug 8, 2023
2b892b8
spec is bad
danlarson-ibm Aug 8, 2023
3fab19c
cp
danlarson-ibm Aug 8, 2023
1f0e35d
W
danlarson-ibm Aug 8, 2023
c407587
{}
danlarson-ibm Aug 8, 2023
b112edd
idk
danlarson-ibm Aug 8, 2023
3309d4e
full
danlarson-ibm Aug 8, 2023
71a5772
back to spec
danlarson-ibm Aug 8, 2023
c9c4545
-x
danlarson-ibm Aug 8, 2023
dd0633f
-x
danlarson-ibm Aug 8, 2023
18995c9
pls work
danlarson-ibm Aug 8, 2023
f4a03dc
full
danlarson-ibm Aug 8, 2023
c390e80
will it work
danlarson-ibm Aug 8, 2023
a643cbb
remove
danlarson-ibm Aug 8, 2023
c14ebdf
idk
danlarson-ibm Aug 8, 2023
12cb23d
full path
danlarson-ibm Aug 8, 2023
9c0e96f
will it work
danlarson-ibm Aug 8, 2023
c2b1b4c
latest
danlarson-ibm Aug 8, 2023
7decca9
full latest
danlarson-ibm Aug 8, 2023
c2b214a
make it faster
danlarson-ibm Aug 8, 2023
2f9bc2a
commit
danlarson-ibm Aug 8, 2023
2fa4984
commit 2
danlarson-ibm Aug 8, 2023
c3472e5
how did this break
danlarson-ibm Aug 8, 2023
7c97085
line breaks
danlarson-ibm Aug 8, 2023
b2c4de2
full thing
danlarson-ibm Aug 8, 2023
667d05c
do demo
danlarson-ibm Aug 8, 2023
c3bfb1c
Update jenkinsfile
danlarson-ibm Mar 8, 2024
84c6746
Use new params
danlarson-ibm Mar 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added ci/ibm/DEMO.md
Empty file.
32 changes: 32 additions & 0 deletions ci/ibm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM fedora:37

ARG USER
ARG UID
ARG GID

ENV USER=${USER:-no-user-set}
ENV UID=${UID:-no-uid-set}
ENV GID=${GID:-no-gid-set}
ENV PYTHONUNBUFFERED=1
ENV HB_CONSOLE_TRACE_EN=False

WORKDIR /home/$USER

# Install packages
COPY dnf_packages.sh .
RUN ./dnf_packages.sh && dnf clean all

# Install jfrog-cli for artifactory transactions
RUN curl -fL https://install-cli.jfrog.io | sh
RUN chmod a+x /usr/local/bin/jf

# add $USER
RUN groupadd -g ${GID} -o ${USER}
RUN useradd -l --create-home --shell /bin/bash -u ${UID} -g ${GID} ${USER}
RUN chown -R $USER /home/$USER

# once we prompt USER, we are that user and no longer has sudo
USER ${USER}
RUN mkdir /home/${USER}/.ssh

ENTRYPOINT ["/bin/bash"]
153 changes: 153 additions & 0 deletions ci/ibm/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
properties([buildDiscarder(logRotator(daysToKeepStr: '30')),
parameters([
booleanParam( name: 'RESET_CI_PROGRESS',
defaultValue: false,
description: "Change to \'true\' to erase CI job progress. This will start again at the build, then simics and hardware<br>This is useful for picking up a newer backing build"),
string( name: 'EBMC_PIPELINES_BRANCH',
defaultValue: 'refs/remotes/origin/pr/1283',
description: "power-devops/ebmc-pipelines branch identifier, Can be branch name or refspec (refs/remotes/origin/pr/#)")
])
])

ansiColor('xterm') {
node('redhat-8') {
timestamps {
stage('Load libraries') {
cleanWs()
load_library ebmc_pipelines: env.EBMC_PIPELINES_BRANCH,
ebmc_verified: 'main'

}
def fw_level = 'fw1060' // master-p10
def job_build_path = "pse-jet-sys-powerfw-generic-local/${currentBuild.fullProjectName}/${currentBuild.id}/"
def change_identifiers = [:]
if (env.ghprbActualCommit) {
//ibm-release-fw1020
//release-fw1030
if (env.ghprbTargetBranch.contains('release-fw10')) {
fw_level = env.ghprbTargetBranch.split('-')[-1]
}
job_build_path = "pse-jet-sys-powerfw-generic-local/${github.get_org_name()}/${github.get_repo_name()}/${env.ghprbTargetBranch}/${github.get_pr_number()}/${github.get_short_hash()}/"
currentBuild.displayName = "#${env.BUILD_NUMBER} ${env?.ghprbPullTitle}"
currentBuild.description = "${env?.ghprbActualCommitAuthor}<br><a href=${env?.ghprbPullLink}>${github.get_short_hash()}</a>"

change_identifiers.CHANGE_URL = env?.ghprbPullLink
change_identifiers.CHANGE_REPO = env?.ghprbGhRepository
change_identifiers.CHANGE_ID = "pull/${github.get_pr_number()}"
change_identifiers.CHANGE_TARGET = env?.ghprbTargetBranch
change_identifiers.CHANGE_COMMIT_HASH = env?.ghprbActualCommit
change_identifiers.CHANGE_AUTHOR_DISPLAY_NAME = env?.ghprbActualCommitAuthor
change_identifiers.CHANGE_AUTHOR_EMAIL = env?.ghprbActualCommitAuthorEmail
change_identifiers.CHANGE_TITLE = env?.ghprbPullTitle
change_identifiers.EBMC_PIPELINES_BRANCH = env.EBMC_PIPELINES_BRANCH
change_identifiers += params
}

if (env?.RESET_CI_PROGRESS == 'true') {
sh script:"""#!/bin/bash -e
jf rt search ${job_build_path}
jf rt delete --quiet ${job_build_path}
"""
}

def simics_configs = [ "everest",
"rainier_2s2u",
"rainier_2s2u_opal_rhel",
"rainier_2s4u"]

// fw1060 is default
def hardware_configs = ["1060-rainier",
"1060-everest",
"bonnell"]

if (fw_level != 'fw1060') {
hardware_configs = ['1050-rainier']
}

def fw_config = load_ebmc_verified FW_LEVEL: fw_level

// unique to pr patchset and fw level
// these will be published to a

def opbuild = [ AGENT: 'redhat-8 && aus.stglabs.ibm.com', // needs austin machine
CONFIG: 'p10ebmc',
PATCHED_REPO: change_identifiers.CHANGE_REPO,
PATCHED_BRANCH: change_identifiers.CHANGE_TARGET,
PATCHED_CHANGE: github.get_pr_number(),
BUILD_PATH: "${job_build_path}/op-build/master-p10/p10ebmc",
POST_STATUS: 'IBM op-build']
opbuild += change_identifiers

def ebmc_pkg = [AGENT: 'redhat-8 && rchland.ibm.com', // closer to afs mounts
CHIP: 'p10ebmc',
OPBUILD_BUILD: opbuild.BUILD_PATH,
EBMC_BUILD: fw_config.EBMC_BUILD,
EBMC_PKG_TOOLS: fw_config.EBMC_PKG_TOOLS,
BUILD_PATH: "${job_build_path}/ebmc-pkg/p10ebmc",
POST_STATUS: 'IBM eBMC']
ebmc_pkg += change_identifiers

def simics_jobs = [:]
simics_configs.each { name ->
def job_params = [:]
job_params += change_identifiers
job_params.MACHINE = name
job_params.EBMC_BUILD = ebmc_pkg.BUILD_PATH
job_params.SIMICS_BUILD = fw_config.SIMICS_BUILD
job_params.SIMULATION_TEST = fw_config.SIMULATION_TEST
job_params.EBMC_TEST_AUTOMATION = fw_config.EBMC_TEST_AUTOMATION
job_params.OPENBMC_TEST_AUTOMATION = fw_config.OPENBMC_TEST_AUTOMATION
job_params.BUILD_PATH = "${job_build_path}/simics-ci/${name}"
job_params.POST_STATUS = "IBM simics ${name}"

simics_jobs."${name}" = {
stage("Simics ${name}") {
job retry: true,
job_path: "../simics-ci/${name}",
parameters: job_params
}
}
}
def hardware_jobs = [:]
hardware_configs.each { name ->
def job_params = [:]
job_params += change_identifiers
job_params.MACHINE = name
job_params.EBMC_BUILD = ebmc_pkg.BUILD_PATH
job_params.EBMC_TEST_AUTOMATION = fw_config.EBMC_TEST_AUTOMATION
job_params.OPENBMC_TEST_AUTOMATION = fw_config.OPENBMC_TEST_AUTOMATION
job_params.OPENBMC_BUILD_SCRIPTS = fw_config.OPENBMC_BUILD_SCRIPTS
job_params.BUILD_PATH = "${job_build_path}/hardware-ci/${name}"
job_params.POST_STATUS = "IBM hardware ${name}"

hardware_jobs."${name}" = {
stage("Hardware ${name}") {
job job_path: "../hardware-ci/${name}",
parameters: job_params
}
}
}

//jf rt delete pse-jet-sys-powerfw-generic-local/open-power/op-build/master-p10/5767/b385b7ba
def result = 'SUCCESS'
stage("Build op-build") {

job job_path: '../openpower-ci/p10ebmc',
parameters: opbuild

}

stage("Build eBMC") {

job job_path: '../ebmc-pkg/p10ebmc',
parameters: ebmc_pkg

}

parallel simics_jobs

parallel hardware_jobs

}
}
}
60 changes: 60 additions & 0 deletions ci/ibm/dnf_packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env bash

dnf makecache --refresh
dnf install -y \
sshpass \
iputils \
tree \
jq \
htop \
ipmitool \
which \
openssh-server \
openssh-clients \
wget \
git \
rustc \
python3 \
vim \
cscope \
expat-devel \
patch \
zlib-devel \
zlib-static \
texinfo \
"perl(bigint)" \
"perl(XML::Simple)" \
"perl(YAML)" \
"perl(XML::SAX)" \
"perl(Fatal)" \
"perl(Thread::Queue)" \
"perl(Env)" \
"perl(XML::LibXML)" \
"perl(Digest::SHA1)" \
"perl(ExtUtils::MakeMaker)" \
"perl(FindBin)" \
"perl(English)" \
"perl(Time::localtime)" \
libxml2-devel \
unzip \
tar \
findutils \
ncurses-devel \
openssl-devel \
make \
libxslt \
vim-common \
lzo-devel \
rsync \
hostname \
flex \
bzip2 \
cpio \
gcc-c++ \
bison \
ctags \
bc \
langpacks-en \
python3-devel \
python2

4 changes: 4 additions & 0 deletions ci/ibm/p10ebmc_upload_spec.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{"files": [{"pattern": "build/output_img/**/*",
"target": "pse-jet-sys-powerfw-generic-local/op-build/pr-$CHANGE_ID/$BUILD_NUMBER/",
"flat": "false"}
]}
56 changes: 56 additions & 0 deletions ci/ibm/podman_jenkins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
set -xeo pipefail

# used by jenkins processes
WORKSPACE=${WORKSPACE:-${HOME}}
# allows user to volume mount a op-build repo
opbuild_dir=${1:-${WORKSPACE}/op-build}
# uses git branch name by default
local_tag=${2:-op-build:pr-${CHANGE_ID}}
# create unique tag for artifactory
remote_tag=${3:-docker-na-public.artifactory.swg-devops.com/pse-jet-docker-local/op-build/pr-${CHANGE_ID}:${BUILD_NUMBER}}
latest_tag=${4:-docker-na-public.artifactory.swg-devops.com/pse-jet-docker-local/op-build/pr-${CHANGE_ID}:latest}

working_dir=/home/$USER/op-build

#--no-cache
podman build --build-arg UID=$UID --build-arg GID=$(id -g) --build-arg USER=$USER -t $local_tag -f ci/ibm/Dockerfile ci/ibm

# start the environment in the background
container_id=$(podman run -dit --userns=keep-id \
-e BUILD_NUMBER=$BUILD_NUMBER \
-e CHANGE_ID=$CHANGE_ID \
-v /home/$USER/.ssh:/home/$USER/.ssh:z \
-v /home/$USER/.jfrog:/home/$USER/.jfrog:z \
$local_tag)

# copy the repo in. all files now stay inside container
podman cp $opbuild_dir $container_id:$working_dir

# do the compile
#podman exec -w $working_dir $container_id /bin/bash -c "./op-build p10ebmc_defconfig && ./op-build"
podman exec -w $working_dir $container_id /bin/bash -c "./op-build p10ebmc_defconfig"

# Upload build images to artifactory
podman exec -w $working_dir $container_id /bin/bash -c "./ci/ibm/upload_artifactory.sh"
podman cp $container_id:$working_dir/upload.log $WORKSPACE
echo "Browse https://na-public.artifactory.swg-devops.com/ui/native/pse-jet-sys-powerfw-generic-local/op-build/pr-$CHANGE_ID/$BUILD_NUMBER"


# create unique tag for artifactory
podman commit $container_id $remote_tag
podman tag $remote_tag $latest_tag

# push to artifactory to save this version of the environment
podman push $remote_tag
podman push $latest_tag
echo "Browse tags https://na-public.artifactory.swg-devops.com/ui/native/pse-jet-docker-local/op-build/pr-$CHANGE_ID"

echo "To recreate podman run -itd --userns=keep-id --user hostboot -v /home/$USER/.ssh:/home/$USER/.ssh:z -v /home/$USER/.jfrog:/home/$USER/.jfrog:z -w $working_dir $remote_tag"


start_time=$(date +%s)
# Stop and remove the container upon successful run
podman stop $container_id
end_time=$(date +%s)
echo "podman stop took $(($end_time-$start_time)) seconds" >> timings.txt
24 changes: 24 additions & 0 deletions ci/ibm/podman_local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -xeo pipefail

# allows user to volume mount a op-build repo
opbuild_dir=${1:-${HOME}/op-build}
# uses git branch name by default
tag_name=${2:-op-build:$(git rev-parse --abbrev-ref HEAD)}

working_dir=/home/$USER/op-build
#exit
#
podman build --build-arg UID=$UID --build-arg GID=$(id -g) --build-arg USER=$USER -t $tag_name -f ci/ibm/Dockerfile ci/ibm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about renaming ibm/Dockerfile to ibm/Containerfile? IMHO the Containerfile is a better choice just because we are not using docker at all here


# mount the local repo into the container
# mount ssh keys for additional cloning if required
container_id=$(podman run -itd --userns=keep-id \
-v $opbuild_dir:$working_dir:z \
-v /home/$USER/.ssh:/home/$USER/.ssh:z \
-w $working_dir $tag_name)

# do the compile
#podman exec -w $working_dir $container_id /bin/bash -c "./op-build p10ebmc_defconfig && ./op-build"


49 changes: 49 additions & 0 deletions ci/ibm/upload_artifactory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash -x

OS="fedora"
agent_os="FEDORA"
CONFIG="p10ebmc"
export FROG_CLI_LOG_LEVEL='ERROR'

####### OUTPUT RE-DIRECTION #######

# Define some variables
op_build_path=$HOME/op-build
origin=$op_build_path/output
destination=$HOME/op-build/build/output_img/$agent_os/$CONFIG/output
powerpc_dir="$destination/host/powerpc64le-buildroot-linux-gnu/sysroot"

# Make needed directories
mkdir -p $destination/images
mkdir -p $powerpc_dir/openpower_pnor_scratch
mkdir -p $powerpc_dir/sbe_sim_data

# Copy required files
cp $origin/images/*.pnor $destination/images/
cp $origin/images/*.pnor.ubi.mtd $destination/images/
cp $origin/images/*.pnor.squashfs.tar $destination/images/
cp $origin/images/*ebmc_lids.tar.gz $destination/images/

# hostboot simics files + tools
cp $origin/images/host_fw_debug.tar $destination/images
cp $origin/images/sim/hostboot_sim.tar $destination/images

# only need the tar.gz and uncompress when needed?
cp $origin/images/mmc.tar.gz $destination/images
cp -r $origin/images/mmc $destination/images

# for opal
cp $origin/host/powerpc64le-buildroot-linux-gnu/sysroot/openpower_pnor_scratch/BOOTKERNEL.bin $powerpc_dir/openpower_pnor_scratch

# sbe simics files + tools
# this is a directory, get all of it. not expecting any child directories
cp $origin/host/powerpc64le-buildroot-linux-gnu/sysroot/sbe_sim_data/* $powerpc_dir/sbe_sim_data

# .config
cp $origin/.config $op_build_path/build/output_img/$agent_os/$CONFIG/p10ebmc.config

# upload to artifactory
echo "{\"files\": [{\"pattern\": \"build/output_img/**/*\", \"target\": \"pse-jet-sys-powerfw-generic-local/op-build/pr-$CHANGE_ID/$BUILD_NUMBER/\", \"flat\": \"false\"}]}" > ci/ibm/p10ebmc_upload_spec.txt

jf rt u --spec=ci/ibm/p10ebmc_upload_spec.txt >> upload.log