Skip to content

Commit

Permalink
ci: added ci in the process (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
saikatharryc authored Apr 19, 2020
1 parent bf8079e commit 294cc06
Show file tree
Hide file tree
Showing 11 changed files with 379 additions and 42 deletions.
32 changes: 32 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 2.1
jobs:
lint-scripts:
docker:
- image: koalaman/shellcheck-alpine
steps:
- checkout
- run:
command: shellcheck -x test/e2e-kind.sh

lint-charts:
docker:
- image: quay.io/helmpack/chart-testing:v3.0.0-rc.1
steps:
- checkout
- run:
command: ct lint --config test/ct.yaml

install-charts:
machine: true
steps:
- checkout
- run:
command: test/e2e-kind.sh

workflows:
version: 2
lint-install:
jobs:
- lint-scripts
- lint-charts
- install-charts
31 changes: 31 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release Charts

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Fetch history
run: git fetch --prune --unshallow

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
# See https://github.com/helm/chart-releaser-action/issues/6
- name: Install Helm
run: |
curl -fsSLo get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.CR_TOKEN }}"
4 changes: 2 additions & 2 deletions charts/judge0/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ dependencies:
- name: redis
repository: https://kubernetes-charts.storage.googleapis.com/
version: 10.2.0
digest: sha256:45eeef86c5f9928972242afbe1bc1defa6ad0c112e22d4616eb59d4384d1c755
generated: "2020-01-22T21:39:59.852049+05:30"
digest: sha256:0a0e827ea174700951c8b0136b293e46a0e23b8cc0777aa1348f6a7960a46c39
generated: "2020-04-18T20:21:42.742362+05:30"
10 changes: 5 additions & 5 deletions charts/judge0/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: judge0
version: 1.0.0
version: 1.0.11
appVersion: 1.5.0
description: Helm implementation of Judge0 | Free ,robust and scalable open-source online code execution system.
description: Helm implementation of Judge0 | Free,robust and scalable open-source online code execution system.
keywords:
- online-judge
- online-compiler
Expand All @@ -22,14 +22,14 @@ dependencies:
repository: https://kubernetes-charts.storage.googleapis.com/
condition: postgresql.enabled
tags:
- judge0-databse
- judge0-database
- name: redis
version: 10.2.0
repository: https://kubernetes-charts.storage.googleapis.com/
condition: redis.enabled
tags:
- judge0-redis
maintainers:
- name: Saikat Chakrabortty
- name: saikatharryc
email: [email protected]
url: https://github.com/saikatharryc/
url: https://github.com/saikatharryc/
Empty file added charts/judge0/charts/.gitkeep
Empty file.
68 changes: 64 additions & 4 deletions charts/judge0/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,55 @@ spec:
spec:
restartPolicy: Always
{{- include "judge0.imagePullSecrets" . | indent 6 }}
initContainers:
- name: init-wait-for-dependencies
image: docker.io/saikatharryc/wait_for_dep:latest
command: ["/docker-entrypoint.sh"]
args: ["wait_for", "redis:REDIS_HOST", "postgressql:POSTGRES_HOST"]
env:
{{- if .Values.redis.enabled }}
- name: REDIS_HOST
value: {{ template "judge0.redis.fullname" . }}-master
{{- else }}
- name: REDIS_HOST
value: {{ .Values.external.redis.host | quote }}
{{- end }}
{{- if .Values.postgresql.enabled }}
- name: POSTGRES_HOST
value: {{ template "judge0.postgresql.fullname" . }}
{{- else }}
- name: POSTGRES_HOST
value: {{ .Values.external.postgresql.host | quote }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-api
image: {{ template "judge0.image" . }}
securityContext:
privileged: true
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
ports:
- name: http-port
containerPort: 3000
{{- if .Values.readinessProbe.enable }}
readinessProbe:
httpGet:
path: /system_info
port: http-port
scheme: HTTP
initialDelaySeconds: {{ .Values.readinessProbe.initialDelay }}
periodSeconds: {{ .Values.readinessProbe.interval }}
timeoutSeconds: {{ .Values.readinessProbe.timeout }}
{{- end }}
{{- if .Values.livenessProbe.enable }}
livenessProbe:
httpGet:
path: /config_info
port: http-port
scheme: HTTP
initialDelaySeconds: {{ add .Values.livenessProbe.initialDelay .Values.readinessProbe.initialDelay }}
periodSeconds: 60
timeoutSeconds: {{ .Values.livenessProbe.timeout }}
{{- end }}
env:
- name: RAILS_ENV
value: {{ .Values.RAILS_ENV | quote }}
Expand All @@ -55,7 +95,7 @@ spec:
value: {{ .Values.COUNT | quote }}
{{- if .Values.redis.enabled }}
- name: REDIS_HOST
value: {{ template "judge0.redis.fullname" . }}
value: {{ template "judge0.redis.fullname" . }}-master
- name: REDIS_PASSWORD
value: {{ .Values.redis.password | quote }}
- name: REDIS_PORT
Expand Down Expand Up @@ -169,12 +209,32 @@ spec:
spec:
restartPolicy: Always
# {{- include "judge0.imagePullSecrets" . | indent 6 }}
initContainers:
- name: init-wait-for-dependencies
image: docker.io/saikatharryc/wait_for_dep:latest
command: ["/docker-entrypoint.sh"]
args: ["wait_for", "redis:REDIS_HOST", "postgressql:POSTGRES_HOST"]
env:
{{- if .Values.redis.enabled }}
- name: REDIS_HOST
value: {{ template "judge0.redis.fullname" . }}-master
{{- else }}
- name: REDIS_HOST
value: {{ .Values.external.redis.host | quote }}
{{- end }}
{{- if .Values.postgresql.enabled }}
- name: POSTGRES_HOST
value: {{ template "judge0.postgresql.fullname" . }}
{{- else }}
- name: POSTGRES_HOST
value: {{ .Values.external.postgresql.host | quote }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-worker
image: {{ template "judge0.image" . }}
securityContext:
privileged: true
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
args:
- bash
- -c
Expand Down Expand Up @@ -202,7 +262,7 @@ spec:
value: {{ .Values.COUNT | quote }}
{{- if .Values.redis.enabled }}
- name: REDIS_HOST
value: {{ template "judge0.redis.fullname" . }}
value: {{ template "judge0.redis.fullname" . }}-master
- name: REDIS_PASSWORD
value: {{ .Values.redis.password | quote }}
- name: REDIS_PORT
Expand Down
83 changes: 52 additions & 31 deletions charts/judge0/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
image:
registry: docker.io
repository: judge0/api
tag: 1.5.0
tag: 1.5.0
## Kubernetes configuration
## For minikube, set this to NodePort, elsewhere use LoadBalancer
##
service:
type: LoadBalancer
# HTTP Port
port: 80
## loadBalancerIP:
##
## nodePorts:
## http: <to set explicitly, choose port between 30000-32767>
nodePorts:
http: ""
## Enable client source IP preservation
## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip
##
externalTrafficPolicy: Cluster
## Service annotations done as key:value pairs
annotations:
type: ClusterIP
# HTTP Port
port: 80
## loadBalancerIP:
##
## nodePorts:
## http: <to set explicitly, choose port between 30000-32767>
nodePorts:
http: ""
## Enable client source IP preservation
## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip
##
externalTrafficPolicy: Cluster
## Service annotations done as key:value pairs
annotations:
###############################################################################
# Rails Environment
###############################################################################
Expand All @@ -33,7 +33,7 @@ service:

# Specify maximum number of concurrent Rails threads.
# Default: 5
RAILS_MAX_THREADS: 10
RAILS_MAX_THREADS: 10

# Maintenance mode is a mode in which clients cannot
# create or delete submissions while maintenance is enabled.
Expand All @@ -43,11 +43,11 @@ MAINTENANCE_MODE: false
# Set custom maintenance message that will be returned to clients
# who try to create or delete submisions.
# Default: Judge0 API is currently in maintenance.
# MAINTENANCE_MESSAGE:
# MAINTENANCE_MESSAGE:

# Secret key base for production, if not set it will be randomly generated
# Default: randomly generated
# SECRET_KEY_BASE:
# SECRET_KEY_BASE:

# Allow only specified origins.
# If left blank, then all origins will be allowed (denoted with '*').
Expand Down Expand Up @@ -124,14 +124,31 @@ MAINTENANCE_MODE: false

# Specify how many parallel workers to run.
# Default: 1
COUNT: 3
COUNT: 1

# Specify maximum queue size. Represents maximum number of submissions that
# can wait in the queue at once. If request for new submission comes and the
# queue if full then submission will be rejected.
# Default: 100
# MAX_QUEUE_SIZE:

readinessProbe:
# readinessProbe.enable -- Enabling Readiness Probe
enable: true
# readinessProbe.interval -- Readiness check interval
interval: 60
# readinessProbe.timeout -- Define custom timeout
timeout: 3
# readinessProbe.initialDelay -- Intial Delay to take in account
initialDelay: 30

livenessProbe:
# livenessProbe.enable -- Enabling Readiness Probe
enable: false
# livenessProbe.initialDelay -- Intial Delay to take in account
initialDelay: 30
# livenessProbe.timeout -- Define custom timeout
timeout: 1

###############################################################################
# Database
Expand All @@ -143,23 +160,28 @@ postgresql:
## if you are using enabled true, for further configuration you can look at https://github.com/helm/charts/tree/master/stable/postgresql#parameters
enabled: true
image:
tag: 9.6 #default version for the postgres.
tag: 9.6 # default version for the postgres.
postgresqlUsername: judgemaster
postgresqlPassword: uaeyjbzuyq
postgresqlDatabase: judge
# service:
service:
# port is defaulting to 5432
# port: 5432
port: 5432
persistence:
enabled: false

# if you are using enabled true, for further configuration you can look at https://github.com/helm/charts/tree/master/stable/redis#parameters
redis:
## Whether to deploy a redis server to satisfy the applications requirements. To use an external redis instance set this to false and configure the external.redis parameters
enabled: true
cluster:
enabled: false
password: a8iuw23iuizy
enabled: false
password: a8iuw23iuizy
# redisPort is bydefault set to 6379, change if needed in below line.
# redisPort: 6379
redisPort: 6379
master:
persistence:
enabled: false

# Set this incase the above services are disabled.
external:
Expand All @@ -170,9 +192,9 @@ external:
postgresqlDatabase: judge
port: 5432 # default value is 5432
redis:
host: localhost
password: ""
port: 6379 # default value is 6379
host: localhost
password: ""
port: 6379 # default value is 6379
###############################################################################
# Configuration
###############################################################################
Expand All @@ -192,7 +214,7 @@ external:
# For example, ALLOWED_LANGUAGES_FOR_COMPILER_OPTIONS:"C C++ Java" would only
# allow setting compiler options for languages C, C++ and Java.
# Default: empty - for every compiled language setting compiler options is allowed.
# ALLOWED_LANGUAGES_FOR_COMPILER_OPTIONS:
# ALLOWED_LANGUAGES_FOR_COMPILER_OPTIONS:

# If enabled user is allowed to set custom command line arguments.
# Default: true
Expand Down Expand Up @@ -301,4 +323,3 @@ external:
# Maximum number of submissions that can be created or get in a batch.
# Default: 20
# MAX_SUBMISSION_BATCH_SIZE:

6 changes: 6 additions & 0 deletions test/ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
chart-dirs:
- charts
chart-repos:
- incubator=https://kubernetes-charts-incubator.storage.googleapis.com/
- stable=https://kubernetes-charts.storage.googleapis.com/
helm-extra-args: --timeout 800s
Loading

0 comments on commit 294cc06

Please sign in to comment.