Skip to content

Commit

Permalink
chore(litmus-agent): adding litmus-helm-agent (#309)
Browse files Browse the repository at this point in the history
* chore(litmus-agent): adding litmus-helm-agent

Signed-off-by: Shubham Chaudhary <shubham.chaudhary@harness.io>
  • Loading branch information
ispeakc0de authored Dec 15, 2022
1 parent f617aac commit ca6f0f2
Show file tree
Hide file tree
Showing 11 changed files with 3,275 additions and 4 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ jobs:
mongo-utils: ${{ steps.filter.outputs.mongo-utils }}
litmusctl: ${{ steps.filter.outputs.litmusctl }}
litmus-redis-load: ${{ steps.filter.outputs.litmus-redis-load }}
litmus-snyk-image: ${{ steps.filter.outputs.litmus-snyk-image }}
litmus-snyk-image: ${{ steps.filter.outputs.litmus-snyk-image }}
litmus-helm-agent: ${{ steps.filter.outputs.litmus-helm-agent }}
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -143,6 +144,8 @@ jobs:
- 'custom/workflow-helper/redis-helper/load-gen/**'
litmus-snyk-image:
- 'custom/security/snyk/**'
litmus-helm-agent:
- 'custom/litmus-helm-agent/**'
litmus-app-deployer:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -556,3 +559,16 @@ jobs:
- name: Building litmus-redis-load image
run: |
make litmus-redis-load
litmus-helm-agent:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.litmus-helm-agent == 'true'
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Building litmus-helm-agent image
run: |
make docker.buildx
make litmus-helm-agent
22 changes: 19 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ jobs:
mongo-utils: ${{ steps.filter.outputs.mongo-utils }}
litmusctl: ${{ steps.filter.outputs.litmusctl }}
litmus-redis-load: ${{ steps.filter.outputs.litmus-redis-load }}
litmus-snyk-image: ${{ steps.filter.outputs.litmus-snyk-image }}
litmus-snyk-image: ${{ steps.filter.outputs.litmus-snyk-image }}
litmus-helm-agent: ${{ steps.filter.outputs.litmus-helm-agent }}

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -150,7 +151,9 @@ jobs:
litmus-redis-load:
- 'custom/workflow-helper/redis-helper/load-gen/**'
litmus-snyk-image:
- 'custom/security/snyk/**'
- 'custom/security/snyk/**'
litmus-helm-agent:
- 'custom/litmus-helm-agent/**'
litmus-app-deployer:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -634,4 +637,17 @@ jobs:
- name: Building litmus-redis-load image
run: |
make docker.buildx
make _push_litmus_redis_load
make _push_litmus_redis_load
litmus-helm-agent:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.litmus-helm-agent == 'true'
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Building litmus-helm-agent image
run: |
make docker.buildx
make _push_litmus_agent
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,12 @@ jobs:
context: custom/mongo-utils/
platforms: linux/amd64,linux/arm64
tags: litmuschaos/mongo-utils:${{ github.event.inputs.release_tag }},litmuschaos/mongo-utils:latest

- name: Build and push litmus-helm-agent
uses: docker/build-push-action@v2
with:
push: true
file: custom/litmus-helm-agent/Dockerfile
context: custom/litmus-helm-agent/
platforms: linux/amd64,linux/arm64
tags: litmuschaos/litmus-helm-agent:${{ github.event.inputs.release_tag }},litmuschaos/litmus-helm-agent:latest
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -455,3 +455,15 @@ docker.buildx:
docker buildx use multibuilder;\
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes;\
fi

litmus-helm-agent: deps _build_litmus_helm_agent _push_litmus_helm_agent

_build_litmus_helm_agent:
@echo "INFO: Building container image for litmuschaos/litmus-helm-agent"
cd custom/litmus-helm-agent/ && docker build -t litmuschaos/litmus-helm-agent .

_push_litmus_helm_agent:
@echo "INFO: Publish container litmuschaos/litmus-helm-agent"
cd custom/litmus-helm-agent/ && ./buildscripts/push

litmus-snyk-image: deps _build_litmus_snyk _push_litmus_snyk
20 changes: 20 additions & 0 deletions custom/litmus-helm-agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Build Image
FROM golang:1.18.3 AS build

ARG TARGETOS=linux
ARG TARGETARCH


RUN export GOOS=${TARGETOS} && \
export GOARCH=${TARGETARCH}

ADD . /litmus
WORKDIR /litmus

RUN CGO_ENABLED=0 go build -o /output/litmus-agent ./main.go

FROM litmuschaos/infra-alpine:latest

COPY --from=build /output/ /litmus

CMD ["./litmus-agent"]
11 changes: 11 additions & 0 deletions custom/litmus-helm-agent/buildscripts/push
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/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/litmus-helm-agent:latest
else
echo "No docker credentials provided. Skip uploading litmuschaos/litmus-helm-agent:latest to docker hub";
fi;
39 changes: 39 additions & 0 deletions custom/litmus-helm-agent/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module litmus-helm-agent

go 1.16

require (
github.com/buger/jsonparser v1.1.1
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/litmuschaos/litmusctl v0.12.1-0.20221121121306-e59872117d16
k8s.io/api v0.23.3
k8s.io/apimachinery v0.23.3
k8s.io/client-go v12.0.0+incompatible
)

replace (
k8s.io/api => k8s.io/api v0.21.2
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.21.2
k8s.io/apimachinery => k8s.io/apimachinery v0.21.2
k8s.io/apiserver => k8s.io/apiserver v0.21.2
k8s.io/cli-runtime => k8s.io/cli-runtime v0.21.2
k8s.io/client-go => k8s.io/client-go v0.21.2
k8s.io/cloud-provider => k8s.io/cloud-provider v0.21.2
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.21.2
k8s.io/code-generator => k8s.io/code-generator v0.21.2
k8s.io/component-base => k8s.io/component-base v0.21.2
k8s.io/cri-api => k8s.io/cri-api v0.21.2
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.21.2
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.21.2
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.21.2
k8s.io/kube-proxy => k8s.io/kube-proxy v0.21.2
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.21.2
k8s.io/kubectl => k8s.io/kubectl v0.21.2
k8s.io/kubelet => k8s.io/kubelet v0.21.2
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.21.2
k8s.io/metrics => k8s.io/metrics v0.21.2
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.21.2
)

replace github.com/docker/docker => github.com/moby/moby v0.7.3-0.20190826074503-38ab9da00309 // Required by Helm
Loading

0 comments on commit ca6f0f2

Please sign in to comment.