Skip to content

Commit

Permalink
Chore(exp-img): Update experiment and infra images and add relase bui…
Browse files Browse the repository at this point in the history
…ld for them (#194)

* Chore(update-exp-img): Update experiment and infra images and add release build for them

Signed-off-by: udit <udit@chaosnative.com>
  • Loading branch information
uditgaurav authored Oct 13, 2021
1 parent 5af25d0 commit f9778d7
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 11 deletions.
42 changes: 41 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
release_notes:
description: 'release notes'
required: false
default: ''
default: ''

jobs:
create_release:
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 8 additions & 7 deletions custom/hardened-alpine/experiment/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/*

Expand Down Expand Up @@ -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/

Expand All @@ -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 \
Expand Down Expand Up @@ -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}
3 changes: 2 additions & 1 deletion custom/hardened-alpine/experiment/buildscripts/push
Original file line number Diff line number Diff line change
Expand Up @@ -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;

5 changes: 4 additions & 1 deletion custom/hardened-alpine/infra/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}

0 comments on commit f9778d7

Please sign in to comment.