From e30ebc885aeaf1c47f12d92b55e42f2778bd3581 Mon Sep 17 00:00:00 2001 From: Adarshkumar14 <56665829+Adarshkumar14@users.noreply.github.com> Date: Mon, 8 Nov 2021 12:43:43 +0530 Subject: [PATCH] Adding container to update the server version in mongodb (#198) * Adding container to update the server version in mongodb Signed-off-by: Adarshkumar14 <1829034@kiit.ac.in> * Updating ci/cd Signed-off-by: Adarshkumar14 <1829034@kiit.ac.in> * modifying push.yml Signed-off-by: Adarshkumar14 <1829034@kiit.ac.in> * modifying build and push files Signed-off-by: Adarshkumar14 <1829034@kiit.ac.in> * modifying build and push files Signed-off-by: Adarshkumar14 <1829034@kiit.ac.in> * modifying build and push files Signed-off-by: Adarshkumar14 <1829034@kiit.ac.in> * modifying build and push files Signed-off-by: Adarshkumar14 <1829034@kiit.ac.in> * modifying build and push files Signed-off-by: Adarshkumar14 <1829034@kiit.ac.in> Signed-off-by: udit * putting multiple tags for the docker image Signed-off-by: Adarshkumar14 <1829034@kiit.ac.in> --- .github/workflows/build.yml | 16 +++++++++++++++- .github/workflows/push.yml | 18 +++++++++++++++++- Makefile | 10 ++++++++++ custom/mongo-utils/Dockerfile | 6 ++++++ custom/mongo-utils/buildscripts/push | 12 ++++++++++++ 5 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 custom/mongo-utils/Dockerfile create mode 100755 custom/mongo-utils/buildscripts/push diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cbeea2cc..8cb43a57 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,7 @@ jobs: litmus-experiment-hardened-alpine: ${{ steps.filter.outputs.litmus-experiment-hardened-alpine }} litmus-infra-hardened-alpine: ${{ steps.filter.outputs.litmus-infra-hardened-alpine }} litmus-pg-jmeter: ${{ steps.filter.outputs.litmus-pg-jmeter }} - + mongo-utils: ${{ steps.filter.outputs.mongo-utils }} steps: - uses: actions/checkout@v2 with: @@ -141,6 +141,8 @@ jobs: - 'custom/workflow-helper/postgres-helper/load-test/**' litmus-pg-jmeter: - 'custom/workflow-helper/postgres-helper/jmeter/**' + mongo-utils: + - 'custom/mongo-utils/**' litmus-app-deployer: runs-on: ubuntu-latest @@ -540,3 +542,15 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: Building litmus-pg-jmeter image run: make litmus-pg-jmeter + + mongo-utils: + runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.mongo-utils == 'true' + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Building mongo-utils image + run: | + make litmus-mongo-utils \ No newline at end of file diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 162243c4..ebd79114 100755 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -62,6 +62,7 @@ jobs: litmus-pg-jmeter: ${{ steps.filter.outputs.litmus-pg-jmeter }} litmus-experiment-hardened-alpine: ${{ steps.filter.outputs.litmus-experiment-hardened-alpine }} litmus-infra-hardened-alpine: ${{ steps.filter.outputs.litmus-infra-hardened-alpine }} + mongo-utils: ${{ steps.filter.outputs.mongo-utils }} steps: - uses: actions/checkout@v2 @@ -139,6 +140,8 @@ jobs: - 'custom/workflow-helper/postgres-helper/load-test/**' litmus-pg-jmeter: - 'custom/workflow-helper/postgres-helper/jmeter/**' + mongo-utils: + - 'custom/mongo-utils/**' litmus-app-deployer: runs-on: ubuntu-latest @@ -572,4 +575,17 @@ jobs: - name: Building litmus-pg-jmeter image run: | make docker.buildx - make _push_litmus_pg_jmeter \ No newline at end of file + make _push_litmus_pg_jmeter + + mongo-utils: + runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.mongo-utils == 'true' + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Building mongo-utils image + run: | + make docker.buildx + make _push_litmus_mongo_utils \ No newline at end of file diff --git a/Makefile b/Makefile index bad8d953..a431fc7c 100755 --- a/Makefile +++ b/Makefile @@ -395,6 +395,16 @@ _push_litmus_infra_hardened_alpine: litmus-infra-hardened-alpine: deps _build_litmus_infra_hardened_alpine _push_litmus_infra_hardened_alpine +_build_litmus_mongo_utils: + @echo "INFO: Building container image for litmuschaos/mongo-utils" + cd custom/mongo-utils && docker build -t litmuschaos/mongo-utils . + +_push_litmus_mongo_utils: + @echo "INFO: Publish container litmuschaos/mongo-utils" + cd custom/mongo-utils && ./buildscripts/push + +litmus-mongo-utils: deps _build_litmus_mongo_utils _push_litmus_mongo_utils + PHONY: go-build go-build: experiment-go-binary diff --git a/custom/mongo-utils/Dockerfile b/custom/mongo-utils/Dockerfile new file mode 100644 index 00000000..218fdc40 --- /dev/null +++ b/custom/mongo-utils/Dockerfile @@ -0,0 +1,6 @@ +FROM alpine:3.11.2 +RUN apk update && \ + apk upgrade --update-cache --available +RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/main' >> /etc/apk/repositories +RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/community' >> /etc/apk/repositories +RUN apk --no-cache add mongodb yaml-cpp=0.6.2-r2 \ No newline at end of file diff --git a/custom/mongo-utils/buildscripts/push b/custom/mongo-utils/buildscripts/push new file mode 100755 index 00000000..0b55ddbd --- /dev/null +++ b/custom/mongo-utils/buildscripts/push @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +if [ ! -z "${DNAME}" ] && [ ! -z "${DPASS}" ]; +then + + docker login -u "${DNAME}" -p "${DPASS}"; + #Push to docker hub repository with latest tag + docker buildx build . -f Dockerfile --progress plane --push --no-cache --platform linux/amd64,linux/arm64 --tag litmuschaos/mongo-utils:0.1.0 --tag litmuschaos/mongo-utils:latest +else + echo "No docker credentials provided. Skip uploading litmuschaos/mongo-utils:4.0.5 to docker hub"; +fi;