From 10412743e91b6bcbc7b0d4634d93b504bb3bc542 Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Thu, 26 Nov 2020 20:33:48 -0500 Subject: [PATCH] Remove some now unnecessary path fallbacks --- Dockerfile | 2 +- build-ci.sh | 4 ---- c/build.sh | 4 +--- java/Dockerfile | 3 +-- java/build.sh | 1 - java/readme.md | 2 +- run.sh | 8 ++++---- rust/build.sh | 1 - 8 files changed, 8 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1c97ffd..4948057 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone & echo -e "Server = $PACMAN_MIRROR/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist && \ echo "TZ=$TZ" > /etc/environment && \ pacman -Syu --noconfirm --needed sed grep gawk sudo git which jq && \ - echo 'jenkins ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/jenkins + echo 'ci ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/ci COPY ./run.sh ./ci-release-helper.sh /usr/bin/ diff --git a/build-ci.sh b/build-ci.sh index ddf2b33..b2b402b 100755 --- a/build-ci.sh +++ b/build-ci.sh @@ -15,10 +15,6 @@ RELEASE_SCRIPT='.ci/release.sh' BUILD_SCRIPT='.ci/build.sh' DEFAULT_RELEASE_DIR='release' -# compat with alternative directory name -[ ! -f "$RELEASE_SCRIPT" ] && [ -f '.jenkins/release.sh' ] && RELEASE_SCRIPT='.jenkins/release.sh' -[ ! -f "$BUILD_SCRIPT" ] && [ -f '.jenkins/build.sh' ] && BUILD_SCRIPT='.jenkins/build.sh' - function usage { echo "$@" echo diff --git a/c/build.sh b/c/build.sh index 8ebeddc..4e4e011 100755 --- a/c/build.sh +++ b/c/build.sh @@ -4,8 +4,6 @@ set -euxo pipefail BUILD_SCRIPT="$1" shift [ "" == "$BUILD_SCRIPT" ] && [ -f '.ci/build.sh' ] && BUILD_SCRIPT='.ci/build.sh' -[ "" == "$BUILD_SCRIPT" ] && [ -f '.jenkins/build.sh' ] && BUILD_SCRIPT='.jenkins/build.sh' - # this assists in cleanup, ie if a job was terminated, to be run in a jenkins finally {} or similar if [ "$BUILD_SCRIPT" == "docker-chown" ] @@ -22,7 +20,7 @@ docker_build() { shift # run it, but after, chown anything left in /tmp to *this* uid/gid, otherwise we can't delete them later... - docker run --rm -e ARCH -e BRANCH_NAME -e BUILD_UID="$UID" -e BUILD_GID="$(id -g)" -v "$(pwd)":/tmp -w /tmp "$DOCKER_IMAGE" sh -c "\"\$@\"; exit=\$?; chown -R '$UID:$(id -g)' /tmp; exit \$exit" -- "$@" + docker run --rm -e ARCH -e BRANCH_NAME -e BUILD_UID="$UID" -e BUILD_GID="$(id -g)" -v "$(pwd)":/tmp -w /tmp "$DOCKER_IMAGE" sh -c "umask a=rwx; \"\$@\"; exit=\$?; chown -R '$UID:$(id -g)' /tmp; exit \$exit" -- "$@" } docker_build 'amd64' 'alpine' "$BUILD_SCRIPT" "$@" diff --git a/java/Dockerfile b/java/Dockerfile index 7788f91..0dcbabf 100644 --- a/java/Dockerfile +++ b/java/Dockerfile @@ -23,10 +23,9 @@ RUN mkdir /m2 /npm && ln -sf /m2/ /root/.m2 && ln -sf /npm/ /root/.npm && \ mv /usr/lib/jvm/java-se-9-ri/jdk-9 /usr/lib/jvm/ && rm -rf java-se-9-ri && chmod +x /usr/lib/jvm/jdk-9/bin/* COPY ./run-java-all ./run-java /usr/bin/ -RUN ln -sf /usr/bin/run-java-all /usr/bin/build.sh VOLUME [ "/build", "/m2", "/npm", "/root/.netrc" ] WORKDIR /build ENTRYPOINT ["/usr/bin/run.sh"] -CMD ["/usr/bin/run-java-all", "./.jenkins/build.sh"] +CMD ["/usr/bin/run-java-all", "./.ci/build.sh"] diff --git a/java/build.sh b/java/build.sh index 75f2c1e..d0812ce 100755 --- a/java/build.sh +++ b/java/build.sh @@ -4,6 +4,5 @@ set -euo pipefail BUILD_SCRIPT="$1" shift [ "" == "$BUILD_SCRIPT" ] && [ -f '.ci/build.sh' ] && BUILD_SCRIPT='.ci/build.sh' -[ "" == "$BUILD_SCRIPT" ] && [ -f '.jenkins/build.sh' ] && BUILD_SCRIPT='.jenkins/build.sh' docker run --rm -v "$HOME/.netrc:/root/.netrc:ro" -v "$HOME/.m2:/m2" -v "$HOME/.npm:/npm" -v "$PWD:/build" -e BRANCH_NAME -e BUILD_UID=$UID -e BUILD_GID=$(id -g) moparisthebest/self-ci-java:latest /usr/bin/run-java-all "$BUILD_SCRIPT" "$@" diff --git a/java/readme.md b/java/readme.md index 37f54d9..21ad9a2 100644 --- a/java/readme.md +++ b/java/readme.md @@ -16,7 +16,7 @@ curl --compressed -sL https://code.moparisthebest.com/moparisthebest/self-ci/raw curl --compressed -sL https://raw.githubusercontent.com/moparisthebest/self-ci/master/build-ci.sh | sed 's@https://code.moparisthebest.com/moparisthebest/self-ci/raw/branch/master@https://raw.githubusercontent.com/moparisthebest/self-ci/master@g' | bash -s -- java ``` -Without arguments it will execute `.jenkins/build.sh` once for each version of Java installed, setting the env variables JAVA_VERSION (a number), JAVA_HOME, M2_HOME, and PATH appropriately so invocations of `mvn` and `java` *just work*. If you want to call another script each time: +Without arguments it will execute `.ci/build.sh` once for each version of Java installed, setting the env variables JAVA_VERSION (a number), JAVA_HOME, M2_HOME, and PATH appropriately so invocations of `mvn` and `java` *just work*. If you want to call another script each time: ```sh docker run --rm -v "$HOME/.m2:/m2" -v "$PWD:/build" -e BRANCH_NAME -e BUILD_UID=$UID -e BUILD_GID=$(id -g) moparisthebest/self-ci-java:latest run-java-all ./path/to/your/script.sh diff --git a/run.sh b/run.sh index b786db9..fccd6ef 100755 --- a/run.sh +++ b/run.sh @@ -6,11 +6,11 @@ if [ ! -z "${BUILD_UID:-}" ] then BUILD_GID="${BUILD_GID:-$BUILD_UID}" - groupadd -r -g "$BUILD_GID" jenkins - useradd -r -u "$BUILD_UID" -g "$BUILD_GID" -s /bin/bash -m -d /root jenkins + groupadd -r -g "$BUILD_GID" ci + useradd -r -u "$BUILD_UID" -g "$BUILD_GID" -s /bin/bash -m -d /root ci chown "$BUILD_UID":"$BUILD_GID" /root - #exec runuser -m jenkins -- "$@" - exec sudo -E -u jenkins -- "$@" + #exec runuser -m ci -- "$@" + exec sudo -E -u ci -- "$@" fi # otherwise just run as root diff --git a/rust/build.sh b/rust/build.sh index 6e1deb9..e178dee 100755 --- a/rust/build.sh +++ b/rust/build.sh @@ -4,7 +4,6 @@ set -euo pipefail BUILD_SCRIPT="$1" shift [ "" == "$BUILD_SCRIPT" ] && [ -f '.ci/build.sh' ] && BUILD_SCRIPT='.ci/build.sh' -[ "" == "$BUILD_SCRIPT" ] && [ -f '.jenkins/build.sh' ] && BUILD_SCRIPT='.jenkins/build.sh' export CROSS_VERSION=0.2.1