Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 8 additions & 7 deletions hack/all-in-one/build-aio-dev.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash
# This script runs hack/all-in-one/Dockerfile
# to build a dev microshift-aio image with GPU support and kubectl installed
# FROM_SOURCE="true" ./build-aio-dev.sh # to build image with locally built binary
# ./build-aio-dev.sh # to build image with latest released binary
#!/bin/bash


cleanup () {
rm -f unit crio-bridge.conf kubelet-cgroups.conf microshift
Expand All @@ -17,15 +18,15 @@ cp ../../packaging/images/microshift-aio/unit ../../packaging/images/microshift-

ARCH=$(uname -m |sed -e "s/x86_64/amd64/" |sed -e "s/aarch64/arm64/")
if [ "$FROM_SOURCE" == "true" ]; then \
pushd ../../ && \
pushd ../../ && \
make && \
mv microshift hack/all-in-one/. && \
popd; \
fi

podman build \
--build-arg IMAGE_NAME=${IMAGE_NAME} \
--build-arg FROM_SOURCE=${FROM_SOURCE} \
--build-arg HOST=${HOST} \
--build-arg ARCH=${ARCH} \
-t ${TAG} .
--build-arg IMAGE_NAME="${IMAGE_NAME}" \
--build-arg FROM_SOURCE="${FROM_SOURCE}" \
--build-arg HOST="${HOST}" \
--build-arg ARCH="${ARCH}" \
-t "${TAG}" .
6 changes: 3 additions & 3 deletions hack/all-in-one/build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ cp ../../packaging/images/microshift-aio/unit ../../packaging/images/microshift-
ARCH=$(uname -m |sed -e "s/x86_64/amd64/" |sed -e "s/aarch64/arm64/")
TAG="${TAG:-quay.io/microshift/microshift-aio:$(date +%Y-%m-%d-%H-%M)}"
for img in "registry.access.redhat.com/ubi8/ubi-init:8.4" "docker.io/nvidia/cuda:11.4.2-base-ubi8"; do
echo "build microshift aio image using base image "${i}
echo "build microshift aio image using base image ""${img}"
tag=$(echo ${img} |awk -F"/" '{print $NF}'| sed -e 's/:/-/g')
echo ${tag}
echo "${tag}"

for host in "rhel7" "rhel8"; do
host_tag=""
[ "${host}" == "rhel7" ] && host_tag="-rhel7"
podman build --build-arg ARCH=${ARCH} --build-arg IMAGE_NAME=${img} --build-arg HOST=${host} -t ${TAG}-${tag}${host_tag} .
podman build --build-arg ARCH="${ARCH}" --build-arg IMAGE_NAME=${img} --build-arg HOST=${host} -t "${TAG}"-"${tag}"${host_tag} .
done
done
6 changes: 2 additions & 4 deletions hack/verify.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash


set -x
set -o errexit
set -o nounset
Expand All @@ -9,17 +8,16 @@ set -o pipefail
REPO_ROOT=$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)

(
cd $REPO_ROOT
cd "$REPO_ROOT"

GOPKG=go/pkg
GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/)


go get -u golang.org/x/lint/golint

test -z $(gofmt -s -l -e $GO_FILES)
test -z $(gofmt -s -l -e "$GO_FILES")
go vet -v $(go list ./... | grep -v /vendor/)

cd ${GOPKG}; go test
)

42 changes: 21 additions & 21 deletions packaging/images/components/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@ function source_image {

function build_component {
local component=$1
SRC_REPO=$(source_repo $component)
SRC_COMMIT=$(source_commit $component)
OKD_IMG=$(source_image $component)
SRC_REPO=$(source_repo "$component")
SRC_COMMIT=$(source_commit "$component")
OKD_IMG=$(source_image "$component")

[ -z "$SRC_REPO" ] && SRC_REPO=$(cat components/$component/repo || :)
[ -z "$SRC_COMMIT" ] && SRC_COMMIT=$(cat components/$component/commit || :)
[ -z "$SRC_REPO" ] && SRC_REPO=$(cat components/"$component"/repo || :)
[ -z "$SRC_COMMIT" ] && SRC_COMMIT=$(cat components/"$component"/commit || :)

echo ""
echo -e "${GREEN}building component: $component${CLEAR}"
echo " Source Repo: $SRC_REPO"
echo " Source Commit: $SRC_COMMIT"
echo " Source Image: $OKD_IMG"

pushd components/$component >/dev/null
pushd components/"$component" >/dev/null

if [ ! -z "${SRC_REPO}" ]; then
checkout_component $SRC_REPO $SRC_COMMIT
checkout_component "$SRC_REPO" "$SRC_COMMIT"
build_cross_binaries
fi

build_multiarch_image $component $OKD_IMG
build_multiarch_image "$component" "$OKD_IMG"
popd

if [ "${PUSH}" == "yes" ]; then
Expand All @@ -59,23 +59,23 @@ function build_component {
function checkout_component {
echo ""
echo -e "${GRAY}> making sure we have the source code for $1, at commit $2${CLEAR}"
[ ! -d src ] && git clone $1 src
[ ! -d src ] && git clone "$1" src
cd src
git fetch -a
git stash >/dev/null # just in case we had patches applied in last run
git clean -f # remove any out-of-tree files (from patches)
echo git checkout $2 -B building-side-images
git checkout $2 -B building-side-images
echo git checkout "$2" -B building-side-images
git checkout "$2" -B building-side-images
cd ..
}

function build_cross_binaries {
for ARCH in ${ARCHITECTURES}
do
if [ -f Dockerfile.$ARCH ] || [ -f Dockerfile ] && [ ! -f ImageSource.$ARCH ] && [ -x ./build_binaries ]; then
if [ -f Dockerfile."$ARCH" ] || [ -f Dockerfile ] && [ ! -f ImageSource."$ARCH" ] && [ -x ./build_binaries ]; then
echo ""
echo -e "${GRAY}> building binaries for architecture ${ARCH} ${CLEAR}"
./build_binaries $ARCH
./build_binaries "$ARCH"
fi
done
}
Expand Down Expand Up @@ -158,28 +158,28 @@ function build_using_dockerfile {
BUILD_ARGS="${BUILD_ARGS} --build-arg REGISTRY=${DEST_REGISTRY} --build-arg OKD_TAG=${OKD_BASE_TAG}"


buildah build-using-dockerfile --override-arch "${ARCH}" $BUILD_ARGS . || \
if [ ${ARCH} == arm ]; then # fedora registry uses armhfp instead for arm (arm32 with floating point)
buildah build-using-dockerfile --override-arch "armhfp" $BUILD_ARGS .
buildah build-using-dockerfile --override-arch "${ARCH}" "$BUILD_ARGS" . || \
if [ "${ARCH}" == arm ]; then # fedora registry uses armhfp instead for arm (arm32 with floating point)
buildah build-using-dockerfile --override-arch "armhfp" "$BUILD_ARGS" .
fi

}

function build_using_image {

IMG_REF=$(get_image_ref $1 "${OKD_IMG}")
IMG_REF=$(get_image_ref "$1" "${OKD_IMG}")
buildah pull --arch "${ARCH}" "${IMG_REF}"
buildah tag "${IMG_REF}" "${ARCH_IMAGE}"
}

function get_image_ref {

IMG=$(cat $1)
IMG=$(cat "$1")
# check if we must use the one captured from oc adm image-releases
if [ "${IMG}" == "\$OKD_IMAGE_AMD64" ]; then
echo $2
echo "$2"
else
echo ${IMG}
echo "${IMG}"
fi
}

Expand All @@ -199,5 +199,5 @@ fi

for component in $COMPONENTS
do
build_component $component
build_component "$component"
done
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ cd src
set -x
GOOS=linux GOARCH=$1 CGO_ENABLED=0 \
GO111MODULE=on GOFLAGS=-mod=vendor \
go build -o ../bin/coredns-$1 .



go build -o ../bin/coredns-"$1" .
5 changes: 2 additions & 3 deletions packaging/images/components/components/flannel/build_binaries
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

mkdir -p bin

cd src
GOOS=linux GOARCH=$1 make dist/flanneld && mv dist/flanneld ../bin/flanneld-$1

cd src || exit
GOOS=linux GOARCH=$1 make dist/flanneld && mv dist/flanneld ../bin/flanneld-"$1"
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GO111MODULE=on GOOS=linux GOARCH=$1 GOFLAGS="-mod=vendor" \
make build
set +x

cp openshift-router ../bin/openshift-router-$1
cp openshift-router ../bin/openshift-router-"$1"

if [ "x$1" == "xriscv64" ]; then
git stash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi
set -x

GOOS=linux GOARCH=$1 CGO_ENABLED=0 GOFLAGS="-mod=vendor" \
go build -a -ldflags '-extldflags "-static"' -o ../bin/hostpath-provisioner-$1 cmd/provisioner/hostpath-provisioner.go
go build -a -ldflags '-extldflags "-static"' -o ../bin/hostpath-provisioner-"$1" cmd/provisioner/hostpath-provisioner.go

set +x

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ GO111MODULE=on GOOS=linux GOARCH=$1 GOFLAGS="-mod=vendor" \
make build
set +x

cp _output/kube-rbac-proxy-linux-$1 ../bin/kube-rbac-proxy-$1
cp _output/kube-rbac-proxy-linux-"$1" ../bin/kube-rbac-proxy-"$1"

if [ "x$1" == "xriscv64" ]; then
git stash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# TODO use our own image for riscv64 builder

podman run -it --rm -v $(pwd)/src:/src -e TAG=${VERSION} -w /src carlosedp/crossbuild-riscv64 <<EOF
podman run -it --rm -v $(pwd)/src:/src -e TAG="${VERSION}" -w /src carlosedp/crossbuild-riscv64 <<EOF
cd build/pause
mkdir -p bin
riscv64-linux-gcc -Os -Wall -Werror -static -DVERSION=v3.2 -o bin/pause-riscv64 pause.c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GO111MODULE=on GOOS=linux GOARCH=$1 GOFLAGS="-mod=vendor" \
make build
set +x

cp service-ca-operator ../bin/service-ca-operator-$1
cp service-ca-operator ../bin/service-ca-operator-"$1"

if [ "x$1" == "xriscv64" ]; then
git stash
Expand Down
1 change: 0 additions & 1 deletion packaging/systemd/microshift-aio
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ fi
cat <<EOF > /etc/microshift-aio/microshift-aio.conf
export KUBECONFIG=$(/usr/bin/podman volume inspect microshift-data --format "{{.Mountpoint}}")/microshift/resources/kubeadmin/kubeconfig
EOF

2 changes: 1 addition & 1 deletion packaging/systemd/microshift-containerized
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -euxo pipefail
[[ -d /etc/microshift-containerized ]] || mkdir -p /etc/microshift-containerized
cat <<EOF > /etc/microshift-containerized/microshift-containerized.conf
export KUBECONFIG=/var/lib/microshift/resources/kubeadmin/kubeconfig
EOF
EOF
2 changes: 1 addition & 1 deletion scripts/bindata.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
go install github.com/go-bindata/go-bindata/...
for i in crd core rbac apps scc storage; do
OUTPUT="pkg/assets/${i}/bindata.go"
${GOPATH}/bin/go-bindata -nocompress -nometadata -prefix "pkg/assets/${i}" -pkg assets -o ${OUTPUT} "./assets/${i}/..."
"${GOPATH}"/bin/go-bindata -nocompress -nometadata -prefix "pkg/assets/${i}" -pkg assets -o ${OUTPUT} "./assets/${i}/..."
gofmt -s -w "${OUTPUT}"
done
2 changes: 1 addition & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ROOT="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")/../")"
# Check for a container manager cli (podman || docker), and alias it to "podman", since
# they implement the same cli interface.
__ctr_mgr_alias=$({ which podman &>/dev/null && echo "podman"; } || { which docker &>/dev/null && echo "docker"; } || echo "")
alias podman=${__ctr_mgr_alias:?"a container manager (podman || docker) is required as part of the release automation; none found"}
alias podman="${__ctr_mgr_alias:?"a container manager (podman || docker) is required as part of the release automation; none found"}"

#########
# FUNCS #
Expand Down
2 changes: 1 addition & 1 deletion scripts/tools.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This package imports things required by build scripts, to force `go mod` to see them as dependencies
// Package tools imports things required by build scripts, to force `go mod` to see them as dependencies
package tools

import (
Expand Down