From 74a6be3a895f97a2a2af3dd196f58b629a3adce1 Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Thu, 8 Feb 2024 14:22:16 +0000 Subject: [PATCH 1/2] feat: use sh for wrapper scripts --- .github/workflows/build.yml | 2 +- Dockerfile.alpine.arm64 | 12 ++++++------ Dockerfile.alpine.x64 | 12 ++++++------ Dockerfile.debian.slim | 10 +++++----- Dockerfile.ubuntu | 10 +++++----- packaging/pact-broker.sh | 6 +++--- packaging/pact-message.sh | 4 ++-- packaging/pact-mock-service.sh | 4 ++-- packaging/pact-provider-verifier.sh | 6 +++--- packaging/pact-publish.sh | 6 +++--- packaging/pact-stub-service.sh | 4 ++-- packaging/pact.sh | 4 ++-- packaging/pactflow.sh | 4 ++-- 13 files changed, 42 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0019c67..ca22c18 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,7 @@ jobs: test: defaults: run: - shell: bash + shell: sh needs: [build] strategy: fail-fast: false diff --git a/Dockerfile.alpine.arm64 b/Dockerfile.alpine.arm64 index c775ee1..eac31e5 100644 --- a/Dockerfile.alpine.arm64 +++ b/Dockerfile.alpine.arm64 @@ -3,15 +3,15 @@ FROM arm64v8/alpine WORKDIR ../ ARG TARGET_ARCH -ARG PACT_VERSION +ARG PACT_CLI_VERSION ARG TARGET_ARCH=${TARGET_ARCH:-arm64} -ARG PACT_VERSION=${PACT_VERSION:-2.0.1} +ARG PACT_CLI_VERSION=${PACT_CLI_VERSION:-2.0.1} -RUN apk --no-cache add gcompat libc6-compat bash +RUN apk --no-cache add gcompat libc6-compat -RUN wget -q https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v${PACT_VERSION}/pact-${PACT_VERSION}-linux-${TARGET_ARCH}.tar.gz \ - && tar xzf pact-${PACT_VERSION}-linux-${TARGET_ARCH}.tar.gz \ - && rm -rf pact-${PACT_VERSION}-linux-${TARGET_ARCH}.tar.gz \ +RUN wget -q https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v${PACT_CLI_VERSION}/pact-${PACT_CLI_VERSION}-linux-${TARGET_ARCH}.tar.gz \ + && tar xzf pact-${PACT_CLI_VERSION}-linux-${TARGET_ARCH}.tar.gz \ + && rm -rf pact-${PACT_CLI_VERSION}-linux-${TARGET_ARCH}.tar.gz \ && ln -s /pact/bin/* /usr/local/bin ENTRYPOINT ["pact-mock-service"] \ No newline at end of file diff --git a/Dockerfile.alpine.x64 b/Dockerfile.alpine.x64 index 08a7e9b..a99ea4d 100644 --- a/Dockerfile.alpine.x64 +++ b/Dockerfile.alpine.x64 @@ -3,14 +3,14 @@ FROM alpine:latest WORKDIR ../ ARG TARGET_ARCH -ARG PACT_VERSION +ARG PACT_CLI_VERSION ARG TARGET_ARCH=${TARGET_ARCH:-arm64} -ARG PACT_VERSION=${PACT_VERSION:-2.0.1} +ARG PACT_CLI_VERSION=${PACT_CLI_VERSION:-2.0.1} -RUN apk --no-cache add gcompat libc6-compat bash -RUN wget -q https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v${PACT_VERSION}/pact-${PACT_VERSION}-linux-${TARGET_ARCH}.tar.gz \ - && tar xzf pact-${PACT_VERSION}-linux-${TARGET_ARCH}.tar.gz \ - && rm -rf pact-${PACT_VERSION}-linux-${TARGET_ARCH}.tar.gz \ +RUN apk --no-cache add gcompat libc6-compat +RUN wget -q https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v${PACT_CLI_VERSION}/pact-${PACT_CLI_VERSION}-linux-${TARGET_ARCH}.tar.gz \ + && tar xzf pact-${PACT_CLI_VERSION}-linux-${TARGET_ARCH}.tar.gz \ + && rm -rf pact-${PACT_CLI_VERSION}-linux-${TARGET_ARCH}.tar.gz \ && ln -s /pact/bin/* /usr/local/bin ENTRYPOINT ["pact-mock-service"] \ No newline at end of file diff --git a/Dockerfile.debian.slim b/Dockerfile.debian.slim index 249a89c..b8c4421 100644 --- a/Dockerfile.debian.slim +++ b/Dockerfile.debian.slim @@ -3,14 +3,14 @@ FROM debian:11-slim WORKDIR ../ ARG TARGET_ARCH -ARG PACT_VERSION +ARG PACT_CLI_VERSION ARG TARGET_ARCH=${TARGET_ARCH:-arm64} -ARG PACT_VERSION=${PACT_VERSION:-2.0.1} +ARG PACT_CLI_VERSION=${PACT_CLI_VERSION:-2.0.1} RUN apt update --yes && apt install wget --yes -RUN wget -q https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v${PACT_VERSION}/pact-${PACT_VERSION}-linux-${TARGET_ARCH}.tar.gz \ - && tar xzf pact-${PACT_VERSION}-linux-${TARGET_ARCH}.tar.gz \ - && rm -rf pact-${PACT_VERSION}-linux-${TARGET_ARCH}.tar.gz \ +RUN wget -q https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v${PACT_CLI_VERSION}/pact-${PACT_CLI_VERSION}-linux-${TARGET_ARCH}.tar.gz \ + && tar xzf pact-${PACT_CLI_VERSION}-linux-${TARGET_ARCH}.tar.gz \ + && rm -rf pact-${PACT_CLI_VERSION}-linux-${TARGET_ARCH}.tar.gz \ && ln -s /pact/bin/* /usr/local/bin ENTRYPOINT ["pact-mock-service"] \ No newline at end of file diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 0ca6407..17854f2 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -3,14 +3,14 @@ FROM ubuntu:latest WORKDIR ../ ARG TARGET_ARCH -ARG PACT_VERSION +ARG PACT_CLI_VERSION ARG TARGET_ARCH=${TARGET_ARCH:-arm64} -ARG PACT_VERSION=${PACT_VERSION:-2.0.1} +ARG PACT_CLI_VERSION=${PACT_CLI_VERSION:-2.0.1} RUN apt update --yes && apt install wget --yes -RUN wget -q https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v${PACT_VERSION}/pact-${PACT_VERSION}-linux-${TARGET_ARCH}.tar.gz \ - && tar xzf pact-${PACT_VERSION}-linux-${TARGET_ARCH}.tar.gz \ - && rm -rf pact-${PACT_VERSION}-linux-${TARGET_ARCH}.tar.gz \ +RUN wget -q https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v${PACT_CLI_VERSION}/pact-${PACT_CLI_VERSION}-linux-${TARGET_ARCH}.tar.gz \ + && tar xzf pact-${PACT_CLI_VERSION}-linux-${TARGET_ARCH}.tar.gz \ + && rm -rf pact-${PACT_CLI_VERSION}-linux-${TARGET_ARCH}.tar.gz \ && ln -s /pact/bin/* /usr/local/bin ENTRYPOINT ["pact-mock-service"] \ No newline at end of file diff --git a/packaging/pact-broker.sh b/packaging/pact-broker.sh index 1a10985..8be616f 100755 --- a/packaging/pact-broker.sh +++ b/packaging/pact-broker.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e SOURCE="$0" @@ -16,7 +16,7 @@ RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" # Figure out where this script is located. -LIBDIR="`cd \"$DIR\" && cd ../lib && pwd`" +LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" # Tell Bundler where the Gemfile and gems are. export BUNDLE_GEMFILE="$LIBDIR/vendor/Gemfile" @@ -26,4 +26,4 @@ unset BUNDLE_APP_CONFIG export BUNDLE_FROZEN=1 # Run the actual app using the bundled Ruby interpreter, with Bundler activated. -exec "$LIBDIR/ruby/bin/ruby" -E UTF-8 -rreadline -rbundler/setup -I "$LIBDIR/app/lib" "$LIBDIR/app/pact-broker.rb" "$@" +exec "$LIBDIR/ruby/bin/ruby" -E UTF-8 -rreadline -rbundler/setup -I "$LIBDIR/app/lib" "$LIBDIR/app/pact-broker.rb" "$@" \ No newline at end of file diff --git a/packaging/pact-message.sh b/packaging/pact-message.sh index 0a16b4e..13cb9bf 100755 --- a/packaging/pact-message.sh +++ b/packaging/pact-message.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e SOURCE="$0" @@ -16,7 +16,7 @@ RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" # Figure out where this script is located. -LIBDIR="`cd \"$DIR\" && cd ../lib && pwd`" +LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" # Tell Bundler where the Gemfile and gems are. export BUNDLE_GEMFILE="$LIBDIR/vendor/Gemfile" diff --git a/packaging/pact-mock-service.sh b/packaging/pact-mock-service.sh index 4aa109e..db5e278 100755 --- a/packaging/pact-mock-service.sh +++ b/packaging/pact-mock-service.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e SOURCE="$0" @@ -16,7 +16,7 @@ RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" # Figure out where this script is located. -LIBDIR="`cd \"$DIR\" && cd ../lib && pwd`" +LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" # Tell Bundler where the Gemfile and gems are. export BUNDLE_GEMFILE="$LIBDIR/vendor/Gemfile" diff --git a/packaging/pact-provider-verifier.sh b/packaging/pact-provider-verifier.sh index 1e41f10..8e2e772 100755 --- a/packaging/pact-provider-verifier.sh +++ b/packaging/pact-provider-verifier.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/bin/sh set -e -SOURCE="${BASH_SOURCE[0]}" +SOURCE="$0" while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink TARGET="$(readlink "$SOURCE")" START="$( echo "$TARGET" | cut -c 1 )" @@ -16,7 +16,7 @@ RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" # Figure out where this script is located. -LIBDIR="`cd \"$DIR\" && cd ../lib && pwd`" +LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" # Tell Bundler where the Gemfile and gems are. export BUNDLE_GEMFILE="$LIBDIR/vendor/Gemfile" diff --git a/packaging/pact-publish.sh b/packaging/pact-publish.sh index 9de229f..5114aa8 100755 --- a/packaging/pact-publish.sh +++ b/packaging/pact-publish.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/bin/sh set -e -SOURCE="${BASH_SOURCE[0]}" +SOURCE="$0" while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink TARGET="$(readlink "$SOURCE")" START="$( echo "$TARGET" | cut -c 1 )" @@ -16,7 +16,7 @@ RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" # Figure out where this script is located. -LIBDIR="`cd \"$DIR\" && cd ../lib && pwd`" +LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" # Tell Bundler where the Gemfile and gems are. export BUNDLE_GEMFILE="$LIBDIR/vendor/Gemfile" diff --git a/packaging/pact-stub-service.sh b/packaging/pact-stub-service.sh index 1c77fd3..1ff1928 100755 --- a/packaging/pact-stub-service.sh +++ b/packaging/pact-stub-service.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e SOURCE="$0" @@ -16,7 +16,7 @@ RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" # Figure out where this script is located. -LIBDIR="`cd \"$DIR\" && cd ../lib && pwd`" +LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" # Tell Bundler where the Gemfile and gems are. export BUNDLE_GEMFILE="$LIBDIR/vendor/Gemfile" diff --git a/packaging/pact.sh b/packaging/pact.sh index 03c5698..0a0cf90 100755 --- a/packaging/pact.sh +++ b/packaging/pact.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e SOURCE="$0" @@ -16,7 +16,7 @@ RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" # Figure out where this script is located. -LIBDIR="`cd \"$DIR\" && cd ../lib && pwd`" +LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" # Tell Bundler where the Gemfile and gems are. export BUNDLE_GEMFILE="$LIBDIR/vendor/Gemfile" diff --git a/packaging/pactflow.sh b/packaging/pactflow.sh index e2b852a..cc6742a 100755 --- a/packaging/pactflow.sh +++ b/packaging/pactflow.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e SOURCE="$0" @@ -16,7 +16,7 @@ RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" # Figure out where this script is located. -LIBDIR="`cd \"$DIR\" && cd ../lib && pwd`" +LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" # Tell Bundler where the Gemfile and gems are. export BUNDLE_GEMFILE="$LIBDIR/vendor/Gemfile" From 1f03a9e8b158b8ce4b6ca062e089fa213324d08d Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Thu, 8 Feb 2024 14:30:21 +0000 Subject: [PATCH 2/2] ci: test against bash and sh --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ca22c18..b121514 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,12 +28,13 @@ jobs: test: defaults: run: - shell: sh + shell: ${{ matrix.shell }} needs: [build] strategy: fail-fast: false matrix: os: ["windows-latest","ubuntu-latest","macos-latest"] + shell: ["sh","bash"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -46,4 +47,4 @@ jobs: run: ./script/unpack-and-test.sh env: BINARY_OS: 'windows' - BINARY_ARCH: 'x86' \ No newline at end of file + BINARY_ARCH: 'x86'