Skip to content

Commit

Permalink
Adding container to update the server version in mongodb (#198)
Browse files Browse the repository at this point in the history
* Adding container to update the server version in mongodb

Signed-off-by: Adarshkumar14 <[email protected]>

* Updating ci/cd

Signed-off-by: Adarshkumar14 <[email protected]>

* modifying push.yml

Signed-off-by: Adarshkumar14 <[email protected]>

* modifying build and push files

Signed-off-by: Adarshkumar14 <[email protected]>

* modifying build and push files

Signed-off-by: Adarshkumar14 <[email protected]>

* modifying build and push files

Signed-off-by: Adarshkumar14 <[email protected]>

* modifying build and push files

Signed-off-by: Adarshkumar14 <[email protected]>

* modifying build and push files

Signed-off-by: Adarshkumar14 <[email protected]>
Signed-off-by: udit <[email protected]>

* putting multiple tags for the docker image

Signed-off-by: Adarshkumar14 <[email protected]>
  • Loading branch information
Adarshkumar14 committed Nov 8, 2021
1 parent 4bb6933 commit e30ebc8
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 2 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
18 changes: 17 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -572,4 +575,17 @@ jobs:
- name: Building litmus-pg-jmeter image
run: |
make docker.buildx
make _push_litmus_pg_jmeter
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
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions custom/mongo-utils/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions custom/mongo-utils/buildscripts/push
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit e30ebc8

Please sign in to comment.