make: Add a Dockerfile to build mgmt for Fedora
This commit is contained in:
20
docker/Dockerfile-fedora.build
Normal file
20
docker/Dockerfile-fedora.build
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
FROM fedora:38
|
||||||
|
LABEL org.opencontainers.image.authors="laurent.indermuehle@pm.me"
|
||||||
|
|
||||||
|
ENV GOPATH=/root/gopath
|
||||||
|
ENV PATH=/root/gopath/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/go/bin:/usr/local/bin
|
||||||
|
ENV LD_LIBRARY_PATH=/usr/lib64
|
||||||
|
ENV PKG_CONFIG_PATH=/usr/lib64/pkgconfig
|
||||||
|
|
||||||
|
# This forces make-deps.sh to install Ragel 6.1 instead of 7.0
|
||||||
|
ENV DOCKER=true
|
||||||
|
|
||||||
|
RUN dnf -y install wget unzip git make which gcc gcc-c++ ruby golang
|
||||||
|
|
||||||
|
RUN mkdir -p $GOPATH/src/github.com/purpleidea
|
||||||
|
WORKDIR $GOPATH/src/github.com/purpleidea
|
||||||
|
RUN git clone --recursive https://github.com/purpleidea/mgmt mgmt
|
||||||
|
WORKDIR $GOPATH/src/github.com/purpleidea/mgmt
|
||||||
|
RUN make deps
|
||||||
|
RUN make build
|
||||||
|
CMD ["/bin/bash"]
|
||||||
@@ -21,6 +21,8 @@ to build your own.
|
|||||||
|
|
||||||
### Downloading a pre-built release:
|
### Downloading a pre-built release:
|
||||||
|
|
||||||
|
This method is not recommended because those packages are now very old.
|
||||||
|
|
||||||
The latest releases can be found [here](https://github.com/purpleidea/mgmt/releases/).
|
The latest releases can be found [here](https://github.com/purpleidea/mgmt/releases/).
|
||||||
An alternate mirror is available [here](https://dl.fedoraproject.org/pub/alt/purpleidea/mgmt/releases/).
|
An alternate mirror is available [here](https://dl.fedoraproject.org/pub/alt/purpleidea/mgmt/releases/).
|
||||||
|
|
||||||
@@ -95,6 +97,21 @@ At the moment we have:
|
|||||||
Please contribute more and help improve these! We'd especially like to see a
|
Please contribute more and help improve these! We'd especially like to see a
|
||||||
Debian package!
|
Debian package!
|
||||||
|
|
||||||
|
### Building from a container:
|
||||||
|
|
||||||
|
This method avoids polluting your workstation with the dependencies for the
|
||||||
|
build. Here is an example using Fedora, Podman and Buildah:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git clone --recursive https://github.com/purpleidea/mgmt/ ~/mgmt/
|
||||||
|
cd ~/mgmt/docker
|
||||||
|
buildah build -f Dockerfile-fedora.build -t mgmt_build
|
||||||
|
podman run -d -it --name mgmt_build localhost/mgmt_build
|
||||||
|
podman cp mgmt_build:/src/github.com/purpleidea/mgmt/mgmt /tmp/mgmt
|
||||||
|
sudo mv /tmp/mgmt /usr/local/bin # be sure this is in your $PATH
|
||||||
|
sudo chown root:root /usr/local/bin/mgmt
|
||||||
|
```
|
||||||
|
|
||||||
## Running mgmt
|
## Running mgmt
|
||||||
|
|
||||||
* Run `mgmt run --tmp-prefix lang examples/lang/hello0.mcl` to try out a very
|
* Run `mgmt run --tmp-prefix lang examples/lang/hello0.mcl` to try out a very
|
||||||
|
|||||||
@@ -50,7 +50,10 @@ if [ -n "$YUM" ]; then
|
|||||||
$sudo_command $YUM install -y augeas-devel
|
$sudo_command $YUM install -y augeas-devel
|
||||||
$sudo_command $YUM install -y ruby-devel rubygems
|
$sudo_command $YUM install -y ruby-devel rubygems
|
||||||
$sudo_command $YUM install -y time
|
$sudo_command $YUM install -y time
|
||||||
$sudo_command $YUM install -y ragel
|
if ! in_env; then
|
||||||
|
$sudo_command $YUM install -y ragel
|
||||||
|
fi
|
||||||
|
|
||||||
# dependencies for building packages with fpm
|
# dependencies for building packages with fpm
|
||||||
$sudo_command $YUM install -y gcc make rpm-build libffi-devel bsdtar mkosi || true
|
$sudo_command $YUM install -y gcc make rpm-build libffi-devel bsdtar mkosi || true
|
||||||
$sudo_command $YUM install -y graphviz || true # for debugging
|
$sudo_command $YUM install -y graphviz || true # for debugging
|
||||||
@@ -61,7 +64,10 @@ if [ -n "$APT" ]; then
|
|||||||
$sudo_command $APT install -y libaugeas-dev || true
|
$sudo_command $APT install -y libaugeas-dev || true
|
||||||
$sudo_command $APT install -y ruby ruby-dev || true
|
$sudo_command $APT install -y ruby ruby-dev || true
|
||||||
$sudo_command $APT install -y libpcap0.8-dev || true
|
$sudo_command $APT install -y libpcap0.8-dev || true
|
||||||
$sudo_command $APT install -y ragel || true
|
if ! in_env; then
|
||||||
|
$sudo_command $APT install -y ragel || true
|
||||||
|
fi
|
||||||
|
|
||||||
# dependencies for building packages with fpm
|
# dependencies for building packages with fpm
|
||||||
$sudo_command $APT install -y build-essential rpm bsdtar || true
|
$sudo_command $APT install -y build-essential rpm bsdtar || true
|
||||||
# `realpath` is a more universal alternative to `readlink -f` for absolute path resolution
|
# `realpath` is a more universal alternative to `readlink -f` for absolute path resolution
|
||||||
@@ -84,7 +90,7 @@ if [ -n "$PACMAN" ]; then
|
|||||||
fi
|
fi
|
||||||
fold_end "Install dependencies"
|
fold_end "Install dependencies"
|
||||||
|
|
||||||
if ! in_ci; then
|
if ! in_env; then
|
||||||
if [ -n "$YUM" ]; then
|
if [ -n "$YUM" ]; then
|
||||||
if [ -z "$GO" ]; then
|
if [ -z "$GO" ]; then
|
||||||
$sudo_command $YUM install -y golang golang-googlecode-tools-stringer || $sudo_command $YUM install -y golang-bin # centos-7 epel
|
$sudo_command $YUM install -y golang golang-googlecode-tools-stringer || $sudo_command $YUM install -y golang-bin # centos-7 epel
|
||||||
@@ -107,7 +113,7 @@ if ! in_ci; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if in_ci; then
|
if in_env; then
|
||||||
# TODO: consider bumping to new package manager version
|
# TODO: consider bumping to new package manager version
|
||||||
RAGEL_VERSION='6.10' # current stable version
|
RAGEL_VERSION='6.10' # current stable version
|
||||||
RAGEL_TMP='/tmp/ragel/'
|
RAGEL_TMP='/tmp/ragel/'
|
||||||
@@ -150,7 +156,7 @@ cd / && go install golang.org/x/tools/cmd/stringer@latest # for automatic string
|
|||||||
cd / && go install golang.org/x/lint/golint@latest # for `golint`-ing
|
cd / && go install golang.org/x/lint/golint@latest # for `golint`-ing
|
||||||
cd / && go install golang.org/x/tools/cmd/goimports@latest # for fmt
|
cd / && go install golang.org/x/tools/cmd/goimports@latest # for fmt
|
||||||
cd / && go install github.com/dvyukov/go-fuzz/go-fuzz@latest # for fuzzing the mcl lang bits
|
cd / && go install github.com/dvyukov/go-fuzz/go-fuzz@latest # for fuzzing the mcl lang bits
|
||||||
if in_ci; then
|
if in_env; then
|
||||||
go get -u gopkg.in/alecthomas/gometalinter.v1 && \
|
go get -u gopkg.in/alecthomas/gometalinter.v1 && \
|
||||||
mv "$(dirname $(command -v gometalinter.v1))/gometalinter.v1" "$(dirname $(command -v gometalinter.v1))/gometalinter" && \
|
mv "$(dirname $(command -v gometalinter.v1))/gometalinter.v1" "$(dirname $(command -v gometalinter.v1))/gometalinter" && \
|
||||||
gometalinter --install # bonus
|
gometalinter --install # bonus
|
||||||
|
|||||||
2
test.sh
2
test.sh
@@ -78,7 +78,7 @@ fi
|
|||||||
# run-test ./test/test-crossbuild.sh
|
# run-test ./test/test-crossbuild.sh
|
||||||
|
|
||||||
# do these longer tests only when running on ci
|
# do these longer tests only when running on ci
|
||||||
if in_ci; then
|
if in_env; then
|
||||||
if label-block "shell"; then
|
if label-block "shell"; then
|
||||||
run-testsuite ./test/test-shell.sh
|
run-testsuite ./test/test-shell.sh
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
. "$(dirname "$0")/../util.sh"
|
. "$(dirname "$0")/../util.sh"
|
||||||
|
|
||||||
if in_ci github; then
|
if in_env github; then
|
||||||
# TODO: consider debugging this
|
# TODO: consider debugging this
|
||||||
echo "This is failing in github, skipping test!"
|
echo "This is failing in github, skipping test!"
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
. "$(dirname "$0")/../util.sh"
|
. "$(dirname "$0")/../util.sh"
|
||||||
|
|
||||||
if in_ci github; then
|
if in_env github; then
|
||||||
# TODO: consider debugging this
|
# TODO: consider debugging this
|
||||||
echo "This is failing in github, skipping test!"
|
echo "This is failing in github, skipping test!"
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
. "$(dirname "$0")/../util.sh"
|
. "$(dirname "$0")/../util.sh"
|
||||||
|
|
||||||
if in_ci github; then
|
if in_env github; then
|
||||||
# TODO: consider debugging this (flaky)
|
# TODO: consider debugging this (flaky)
|
||||||
echo "This is failing in github, skipping test!"
|
echo "This is failing in github, skipping test!"
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
. "$(dirname "$0")/../util.sh"
|
. "$(dirname "$0")/../util.sh"
|
||||||
|
|
||||||
if in_ci github; then
|
if in_env github; then
|
||||||
# TODO: consider debugging this (flaky)
|
# TODO: consider debugging this (flaky)
|
||||||
echo "This is failing in github, skipping test!"
|
echo "This is failing in github, skipping test!"
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
. "$(dirname "$0")/../util.sh"
|
. "$(dirname "$0")/../util.sh"
|
||||||
|
|
||||||
if in_ci github; then
|
if in_env github; then
|
||||||
# TODO: consider debugging this
|
# TODO: consider debugging this
|
||||||
echo "This is failing in github, skipping test!"
|
echo "This is failing in github, skipping test!"
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
. "$(dirname "$0")/../util.sh"
|
. "$(dirname "$0")/../util.sh"
|
||||||
|
|
||||||
if in_ci github; then
|
if in_env github; then
|
||||||
# TODO: consider debugging this
|
# TODO: consider debugging this
|
||||||
echo "This is failing in github, skipping test!"
|
echo "This is failing in github, skipping test!"
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ if ! ifconfig lo | grep 'inet6 ::1' >/dev/null; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if in_ci github; then
|
if in_env github; then
|
||||||
# TODO: consider debugging this
|
# TODO: consider debugging this
|
||||||
echo "This is failing in github, skipping test!"
|
echo "This is failing in github, skipping test!"
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
. "$(dirname "$0")/../util.sh"
|
. "$(dirname "$0")/../util.sh"
|
||||||
|
|
||||||
if in_ci travis; then
|
if in_env travis; then
|
||||||
# this often fails in travis with: `address already in use`
|
# this often fails in travis with: `address already in use`
|
||||||
echo "Travis gives wonky results here, skipping test!"
|
echo "Travis gives wonky results here, skipping test!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if in_ci github; then
|
if in_env github; then
|
||||||
# TODO: consider debugging this
|
# TODO: consider debugging this
|
||||||
echo "This is failing in github, skipping test!"
|
echo "This is failing in github, skipping test!"
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
. "$(dirname "$0")/../util.sh"
|
. "$(dirname "$0")/../util.sh"
|
||||||
|
|
||||||
if in_ci github; then
|
if in_env github; then
|
||||||
# TODO: consider debugging this (flaky)
|
# TODO: consider debugging this (flaky)
|
||||||
echo "This is failing in github, skipping test!"
|
echo "This is failing in github, skipping test!"
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
. "$(dirname "$0")/../util.sh"
|
. "$(dirname "$0")/../util.sh"
|
||||||
|
|
||||||
if in_ci github; then
|
if in_env github; then
|
||||||
# TODO: consider debugging this
|
# TODO: consider debugging this
|
||||||
echo "This is failing in github, skipping test!"
|
echo "This is failing in github, skipping test!"
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
. "$(dirname "$0")/../util.sh"
|
. "$(dirname "$0")/../util.sh"
|
||||||
|
|
||||||
if in_ci travis jenkins; then
|
if in_env travis jenkins; then
|
||||||
# inotify doesn't seem to work properly on travis
|
# inotify doesn't seem to work properly on travis
|
||||||
echo "Travis and Jenkins give wonky results here, skipping test!"
|
echo "Travis and Jenkins give wonky results here, skipping test!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if in_ci github; then
|
if in_env github; then
|
||||||
# TODO: consider debugging this
|
# TODO: consider debugging this
|
||||||
echo "This is failing in github, skipping test!"
|
echo "This is failing in github, skipping test!"
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
exit 0 # TODO: this test needs to be updated to use deploys instead
|
exit 0 # TODO: this test needs to be updated to use deploys instead
|
||||||
|
|
||||||
#if in_ci; then
|
#if in_env; then
|
||||||
# # inotify doesn't seem to work properly on travis
|
# # inotify doesn't seem to work properly on travis
|
||||||
# echo "Travis and Jenkins give wonky results here, skipping test!"
|
# echo "Travis and Jenkins give wonky results here, skipping test!"
|
||||||
# exit
|
# exit
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ cd "${ROOT}"
|
|||||||
. test/util.sh
|
. test/util.sh
|
||||||
|
|
||||||
# travis is slow for some reason
|
# travis is slow for some reason
|
||||||
if in_ci travis; then
|
if in_env travis; then
|
||||||
export GO_TEST_TIMEOUT_SCALE=3
|
export GO_TEST_TIMEOUT_SCALE=3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ ROOT=$(dirname "${BASH_SOURCE}")/..
|
|||||||
cd "${ROOT}"
|
cd "${ROOT}"
|
||||||
. test/util.sh
|
. test/util.sh
|
||||||
|
|
||||||
#if in_ci travis jenkins; then
|
#if in_env travis jenkins; then
|
||||||
# echo "Travis and Jenkins give wonky results here, skipping test!"
|
# echo "Travis and Jenkins give wonky results here, skipping test!"
|
||||||
# exit 0
|
# exit 0
|
||||||
#fi
|
#fi
|
||||||
|
|||||||
16
test/util.sh
16
test/util.sh
@@ -20,9 +20,9 @@ fi
|
|||||||
|
|
||||||
TIMEOUT="$timeout --kill-after=360s --signal=QUIT 300s"
|
TIMEOUT="$timeout --kill-after=360s --signal=QUIT 300s"
|
||||||
|
|
||||||
in_ci() {
|
in_env() {
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
test -n "$CI" -o -n "$GITHUB_ACTION" -o -n "$TRAVIS" -o -n "$JENKINS_URL"
|
test -n "$CI" -o -n "$GITHUB_ACTION" -o -n "$TRAVIS" -o -n "$JENKINS_URL" -o -n "$DOCKER"
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -34,6 +34,8 @@ in_ci() {
|
|||||||
test "$TRAVIS" = "true" && return 0;;
|
test "$TRAVIS" = "true" && return 0;;
|
||||||
jenkins)
|
jenkins)
|
||||||
test -n "$JENKINS_URL" && return 0;;
|
test -n "$JENKINS_URL" && return 0;;
|
||||||
|
docker)
|
||||||
|
test -n "$DOCKER" && return 0;;
|
||||||
*)
|
*)
|
||||||
continue;;
|
continue;;
|
||||||
esac
|
esac
|
||||||
@@ -42,7 +44,7 @@ in_ci() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fail_test() {
|
fail_test() {
|
||||||
if in_ci github; then
|
if in_env github; then
|
||||||
echo "::error::$@"
|
echo "::error::$@"
|
||||||
else
|
else
|
||||||
echo -e "FAIL: $@"
|
echo -e "FAIL: $@"
|
||||||
@@ -57,16 +59,16 @@ function run-test() {
|
|||||||
# travis expander helpers from:
|
# travis expander helpers from:
|
||||||
# https://github.com/travis-ci/travis-rubies/blob/build/build.sh
|
# https://github.com/travis-ci/travis-rubies/blob/build/build.sh
|
||||||
fold_start() {
|
fold_start() {
|
||||||
if in_ci travis; then
|
if in_env travis; then
|
||||||
echo -e "travis_fold:start:$1\033[33;1m${@:2}\033[0m"
|
echo -e "travis_fold:start:$1\033[33;1m${@:2}\033[0m"
|
||||||
elif in_ci github; then
|
elif in_env github; then
|
||||||
echo "::group::$@"
|
echo "::group::$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
fold_end() {
|
fold_end() {
|
||||||
if in_ci travis; then
|
if in_env travis; then
|
||||||
echo -e "\ntravis_fold:end:$1\r"
|
echo -e "\ntravis_fold:end:$1\r"
|
||||||
elif in_ci github; then
|
elif in_env github; then
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user