-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This script is needed by both podman and buildah CI. However a bug in the line `export GOPATH="${GOPATH:/var/tmp/go}"` was causing it to silently exit before doing it's job. Fortunately the downstream build systems are somewhat tolerant, so the problem wasn't noticed at image build time. Simplify the script by requiring it to be called under $SUDO, this allows moving a bunch of golang variable definitions into the script and also making it `set -e` so failures are noticed sooner. Signed-off-by: Chris Evich <[email protected]>
- Loading branch information
Showing
3 changed files
with
32 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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 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,36 +1,50 @@ | ||
#!/bin/bash | ||
|
||
# This script is sourced from *_packaging.sh script to install common/shared | ||
# This script is executed from *_packaging.sh script to install common/shared | ||
# tooling from the containers/podman repository. It expects | ||
# a go 1.13+ environment has already been setup. The script should | ||
# not be used for any other purpose or from any other context. | ||
# a go 1.16+ environment has already been set up, and should be called | ||
# as root or through sudo. The script should not be used for any other | ||
# purpose or from any other context. | ||
|
||
set -e | ||
|
||
SCRIPT_FILEPATH=$(realpath "${BASH_SOURCE[0]}") | ||
SCRIPT_DIRPATH=$(dirname "$SCRIPT_FILEPATH") | ||
REPO_DIRPATH=$(realpath "$SCRIPT_DIRPATH/../") | ||
# shellcheck source=./lib.sh | ||
source "$REPO_DIRPATH/lib.sh" | ||
|
||
echo "Configuring Go environment" | ||
export GOPATH="${GOPATH:-/var/tmp/go}" | ||
mkdir -p "$GOPATH" | ||
export GOSRC=${GOPATH}/src/github.com/containers/podman | ||
export GOCACHE="${GOCACHE:-$GOPATH/cache}" | ||
eval $(go env | tee /dev/stderr) | ||
export PATH="$GOPATH/bin:$PATH" | ||
|
||
echo "Installing runtime tooling" | ||
export GOPATH="${GOPATH:/var/tmp/go}" | ||
export GOSRC=/var/tmp/go/src/github.com/containers/podman | ||
export GOCACHE="${GOCACHE:-/root/.cache/go-build}" | ||
lilto git clone --quiet https://github.com/containers/podman.git "$GOSRC" | ||
|
||
cd "$GOSRC" || die "Podman repo. not cloned to expected directory: '$GOSRC'" | ||
# Calling script already loaded lib.sh | ||
# shellcheck disable=SC2154 | ||
lilto $SUDO ./hack/install_catatonit.sh | ||
bigto $SUDO make install.tools | ||
lilto ./hack/install_catatonit.sh | ||
bigto make install.tools | ||
|
||
# shellcheck disable=SC2154 | ||
if [[ "$OS_RELEASE_ID" == "fedora" ]]; then | ||
msg "Installing swagger binary" | ||
download_url=$(\ | ||
curl -s https://api.github.com/repos/go-swagger/go-swagger/releases/latest | \ | ||
jq -r '.assets[] | select(.name | contains("linux_amd64")) | .browser_download_url') | ||
$SUDO curl --fail -s -o /usr/local/bin/swagger -L'#' "$download_url" | ||
$SUDO chmod +x /usr/local/bin/swagger | ||
curl --fail -s -o /usr/local/bin/swagger -L'#' "$download_url" | ||
chmod +x /usr/local/bin/swagger | ||
/usr/local/bin/swagger version | ||
|
||
# This is needed for rootless testing | ||
$SUDO make install.modules-load | ||
make install.modules-load | ||
fi | ||
|
||
# Make pristine for other runtime usage/expectations also save a bit | ||
# of space in the images. | ||
$SUDO rm -rf "$GOPATH/src" "$GOCACHE" | ||
$SUDO chown -R root.root /var/tmp/go | ||
rm -rf "$GOPATH/src" "$GOCACHE" | ||
chown -R root.root "$GOPATH" |
This file contains 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