Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.git
Dockerfile
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ARG ARGOCD_VERSION=v0.12.1
FROM argoproj/argocd:$ARGOCD_VERSION as argocd

FROM node:11.10.1-slim

RUN apt-get update && apt-get install -y \
git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

WORKDIR /home/argocd/argocd-bot
ADD ["package.json", "package-lock.json", "./"]

RUN npm install

ADD [".", "./"]

COPY --from=argocd /usr/local/bin/argocd /usr/local/bin/argocd
COPY --from=argocd /usr/local/bin/helm /usr/local/bin/helm
COPY --from=argocd /usr/local/bin/kustomize /usr/local/bin/kustomize
COPY --from=argocd /usr/local/bin/kustomize1 /usr/local/bin/kustomize1
COPY --from=argocd /usr/local/bin/ks /usr/local/bin/ks

RUN groupadd -g 999 argocd && \
useradd -r -u 999 -g argocd argocd && \
chown argocd:argocd /home/argocd && \
chown argocd:argocd /home/argocd/argocd-bot
#workaround https://github.com/golang/go/issues/14625
ENV USER=argocd
USER argocd
39 changes: 0 additions & 39 deletions deployment/Dockerfile

This file was deleted.

80 changes: 80 additions & 0 deletions deployment/base/argocd-bot-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: argocd-bot
name: argocd-bot
spec:
selector:
matchLabels:
app.kubernetes.io/name: argocd-bot
template:
metadata:
labels:
app.kubernetes.io/name: argocd-bot
spec:
containers:
- name: argocd-bot
command: [npm, start]
image: argocd-bot:latest
env:
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: "0"
- name: PRIVATE_KEY_PATH
value: "/data/key.pem"
- name: ARGO_CD_SERVER_IP
valueFrom:
secretKeyRef:
name: argocd-bot-secret
key: ARGOCD_SERVER
- name: ARGOCD_SERVER
valueFrom:
secretKeyRef:
name: argocd-bot-secret
key: ARGOCD_SERVER
- name: ARGO_CD_API_TOKEN
valueFrom:
secretKeyRef:
name: argocd-bot-secret
key: TOKEN
- name: ARGOCD_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: argocd-bot-secret
key: TOKEN
- name: APP_ID
valueFrom:
secretKeyRef:
name: argocd-bot-secret
key: APP_ID
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
name: argocd-bot-secret
key: GITHUB_TOKEN
- name: GITHUB_REPO
valueFrom:
secretKeyRef:
name: argocd-bot-secret
key: GITHUB_REPO
- name: WEBHOOK_SECRET
valueFrom:
secretKeyRef:
name: argocd-bot-secret
key: WEBHOOK_SECRET
volumeMounts:
- name: app-private-key
mountPath: "/data"
readOnly: true
imagePullPolicy: Always
ports:
- containerPort: 3000
readinessProbe:
tcpSocket:
port: 3000
initialDelaySeconds: 5
periodSeconds: 1
volumes:
- name: app-private-key
secret:
secretName: argocd-bot-secret
12 changes: 12 additions & 0 deletions deployment/base/argocd-bot-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/name: argocd-bot
name: argocd-bot
spec:
ports:
- port: 80
targetPort: 3000
selector:
app.kubernetes.io/name: argocd-bot
6 changes: 6 additions & 0 deletions deployment/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- argocd-bot-deployment.yaml
- argocd-bot-service.yaml
10 changes: 0 additions & 10 deletions deployment/docker-entrypoint.sh

This file was deleted.

95 changes: 95 additions & 0 deletions deployment/install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/name: argocd-bot
name: argocd-bot
spec:
ports:
- port: 80
targetPort: 3000
selector:
app.kubernetes.io/name: argocd-bot
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: argocd-bot
name: argocd-bot
spec:
selector:
matchLabels:
app.kubernetes.io/name: argocd-bot
template:
metadata:
labels:
app.kubernetes.io/name: argocd-bot
spec:
containers:
- command:
- npm
- start
env:
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: "0"
- name: PRIVATE_KEY_PATH
value: /data/key.pem
- name: ARGO_CD_SERVER_IP
valueFrom:
secretKeyRef:
key: ARGOCD_SERVER
name: argocd-bot-secret
- name: ARGOCD_SERVER
valueFrom:
secretKeyRef:
key: ARGOCD_SERVER
name: argocd-bot-secret
- name: ARGO_CD_API_TOKEN
valueFrom:
secretKeyRef:
key: TOKEN
name: argocd-bot-secret
- name: ARGOCD_AUTH_TOKEN
valueFrom:
secretKeyRef:
key: TOKEN
name: argocd-bot-secret
- name: APP_ID
valueFrom:
secretKeyRef:
key: APP_ID
name: argocd-bot-secret
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
key: GITHUB_TOKEN
name: argocd-bot-secret
- name: GITHUB_REPO
valueFrom:
secretKeyRef:
key: GITHUB_REPO
name: argocd-bot-secret
- name: WEBHOOK_SECRET
valueFrom:
secretKeyRef:
key: WEBHOOK_SECRET
name: argocd-bot-secret
image: argocd-bot:latest
imagePullPolicy: Always
name: argocd-bot
ports:
- containerPort: 3000
readinessProbe:
initialDelaySeconds: 5
periodSeconds: 1
tcpSocket:
port: 3000
volumeMounts:
- mountPath: /data
name: app-private-key
readOnly: true
volumes:
- name: app-private-key
secret:
secretName: argocd-bot-secret
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"start": "probot run ./lib/index.js",
"test": "jest ./test/",
"build": "tsc"
"manifests": "kustomize build ./deployment/base > deployment/install.yaml",
},
"dependencies": {
"@types/jest": "^24.0.11",
Expand Down
2 changes: 1 addition & 1 deletion src/argo-bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ ${syncRes.stdout}
return await this.respondWithError("No Kubernetes deployments found, try running \`argo diff --all\`")
}

const jsonItems = jsonArgoCDApps["items"]
const jsonItems = jsonArgoCDApps["items"].filter((item) => item["spec"]["source"]["repoURL"].indexOf(this.argoConfig.getGithubRepo()) > -1);
let foundDiffs = false
// for each app in the ArgoCD Server, attempt to diff with current directory in repo
for (var key in jsonItems) {
Expand Down