diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 147f062f..f9f5a522 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ on: release_notes: description: 'release notes' required: false - default: '' + default: '' jobs: create_release: @@ -47,3 +47,43 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} name: "${{ github.event.inputs.release_title }}" tag: ${{ github.event.inputs.release_tag }} + + push: + runs-on: ubuntu-latest + needs: create_release + steps: + - uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + with: + platforms: all + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + with: + version: latest + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DNAME }} + password: ${{ secrets.DPASS }} + + - name: Build and push experiment-alpine + uses: docker/build-push-action@v2 + with: + push: true + file: custom/hardened-alpine/experiment/Dockerfile + platforms: linux/amd64,linux/arm64 + build-args: LITMUS_VERSION=${{ github.event.inputs.release_tag }} + tags: litmuschaos/experiment-alpine:${{ github.event.inputs.release_tag }},litmuschaos/experiment-alpine:latest + + - name: Build and push infra-alpine + uses: docker/build-push-action@v2 + with: + push: true + file: custom/hardened-alpine/infra/Dockerfile + platforms: linux/amd64,linux/arm64 + tags: litmuschaos/infra-alpine:${{ github.event.inputs.release_tag }},litmuschaos/infra-alpine:latest diff --git a/Makefile b/Makefile index 9d6030c0..bad8d953 100755 --- a/Makefile +++ b/Makefile @@ -377,7 +377,7 @@ litmus-pg-load: deps _build_litmus_pg_load _push_litmus_pg_load _build_litmus_experiment_hardened_alpine: @echo "INFO: Building container image for litmuschaos/experiment-alpine:latest" - cd custom/hardened-alpine/experiment/ && docker build -t litmuschaos/experiment-alpine:latest . --build-arg TARGETARCH=amd64 + cd custom/hardened-alpine/experiment/ && docker build -t litmuschaos/experiment-alpine:latest . --build-arg TARGETARCH=amd64 --build-arg LITMUS_VERSION=1.13.8 _push_litmus_experiment_hardened_alpine: @echo "INFO: Publish container litmuschaos/experiment-alpine" diff --git a/custom/hardened-alpine/experiment/Dockerfile b/custom/hardened-alpine/experiment/Dockerfile index ddf64b85..91245cc5 100644 --- a/custom/hardened-alpine/experiment/Dockerfile +++ b/custom/hardened-alpine/experiment/Dockerfile @@ -15,6 +15,7 @@ RUN echo "https://alpine.global.ssl.fastly.net/alpine/v$(cut -d . -f 1,2 < /etc/ ENV GLIBC_REPO=https://github.com/sgerrand/alpine-pkg-glibc ENV GLIBC_VERSION=2.30-r0 ARG TARGETARCH +ARG LITMUS_VERSION RUN rm -rf /var/lib/apt/lists/* @@ -57,16 +58,16 @@ ENV PUMBA_VERSION="0.7.7" RUN curl -L https://github.com/alexei-led/pumba/releases/download/${PUMBA_VERSION}/pumba_linux_${TARGETARCH} --output /usr/local/bin/pumba && chmod +x /usr/local/bin/pumba #Installing promql cli binaries -RUN curl -L https://github.com/litmuschaos/test-tools/releases/download/1.13.6/promql-linux-${TARGETARCH} --output /usr/local/bin/promql && chmod +x /usr/local/bin/promql +RUN curl -L https://github.com/litmuschaos/test-tools/releases/download/${LITMUS_VERSION}/promql-linux-${TARGETARCH} --output /usr/local/bin/promql && chmod +x /usr/local/bin/promql #Installing nsutil cli binaries -RUN curl -L https://github.com/litmuschaos/test-tools/releases/download/1.13.6/nsutil-linux-${TARGETARCH} --output /usr/local/bin/nsutil && chmod +x /usr/local/bin/nsutil +RUN curl -L https://github.com/litmuschaos/test-tools/releases/download/${LITMUS_VERSION}/nsutil-linux-${TARGETARCH} --output /usr/local/bin/nsutil && chmod +x /usr/local/bin/nsutil #Installing pause cli binaries -RUN curl -L https://github.com/litmuschaos/test-tools/releases/download/1.13.6/pause-linux-${TARGETARCH} --output /usr/local/bin/pause && chmod +x /usr/local/bin/pause +RUN curl -L https://github.com/litmuschaos/test-tools/releases/download/${LITMUS_VERSION}/pause-linux-${TARGETARCH} --output /usr/local/bin/pause && chmod +x /usr/local/bin/pause #Installing dns_interceptor cli binaries -RUN curl -L https://github.com/litmuschaos/test-tools/releases/download/1.13.6/dns_interceptor --output /usr/local/bin/dns_interceptor && chmod +x /usr/local/bin/dns_interceptor +RUN curl -L https://github.com/litmuschaos/test-tools/releases/download/${LITMUS_VERSION}/dns_interceptor --output /usr/local/bin/dns_interceptor && chmod +x /usr/local/bin/dns_interceptor COPY --from=docker:19.03 /usr/local/bin/docker /usr/local/bin/ @@ -88,8 +89,8 @@ RUN adduser -s /bin/true -u 1000 -D -h $APP_DIR $APP_USER \ && mkdir "$DATA_DIR" "$CONF_DIR" \ && chown -R "$APP_USER" "$APP_DIR" "$CONF_DIR" \ && chmod 700 "$APP_DIR" "$DATA_DIR" "$CONF_DIR" \ - && echo "$APP_USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/app \ - && chmod 0440 /etc/sudoers.d/app + && echo "$APP_USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/litmus \ + && chmod 0440 /etc/sudoers.d/litmus # Remove existing crontabs, if any. RUN rm -fr /var/spool/cron \ @@ -160,6 +161,6 @@ RUN rm -f /etc/fstab # Remove any symlinks that we broke during previous steps RUN find /bin /etc /lib /sbin /usr -xdev -type l -exec test ! -e {} \; -delete -# default directory is /app +# default directory is /litmus WORKDIR $APP_DIR USER ${APP_USER} diff --git a/custom/hardened-alpine/experiment/buildscripts/push b/custom/hardened-alpine/experiment/buildscripts/push index 48132cc7..fc5a23d9 100755 --- a/custom/hardened-alpine/experiment/buildscripts/push +++ b/custom/hardened-alpine/experiment/buildscripts/push @@ -4,7 +4,8 @@ set -e if [ ! -z "${DNAME}" ] && [ ! -z "${DPASS}" ]; then docker login -u "${DNAME}" -p "${DPASS}"; - docker buildx build . -f Dockerfile --progress plane --push --no-cache --platform linux/amd64,linux/arm64 --tag litmuschaos/experiment-alpine:latest + docker buildx build . -f Dockerfile --progress plane --push --no-cache --platform linux/amd64,linux/arm64 --build-arg LITMUS_VERSION=1.13.8 --tag litmuschaos/experiment-alpine:latest else echo "No docker credentials provided. Skip uploading litmuschaos/experiment-alpine:latest to docker hub"; fi; + diff --git a/custom/hardened-alpine/infra/Dockerfile b/custom/hardened-alpine/infra/Dockerfile index de558022..558a435d 100644 --- a/custom/hardened-alpine/infra/Dockerfile +++ b/custom/hardened-alpine/infra/Dockerfile @@ -20,6 +20,9 @@ ENV DATA_DIR "$APP_DIR/data" # Where configuration should be stored ENV CONF_DIR "$APP_DIR/conf" +# Change default shell from ash to bash +RUN sed -i -e "s/bin\/ash/bin\/bash/" /etc/passwd + # Update base system # hadolint ignore=DL3018 RUN apk add --no-cache ca-certificates @@ -99,6 +102,6 @@ RUN rm -f /etc/fstab # Remove any symlinks that we broke during previous steps RUN find /bin /etc /lib /sbin /usr -xdev -type l -exec test ! -e {} \; -delete -# default directory is /app +# default directory is /litmus WORKDIR $APP_DIR USER ${APP_USER}