Skip to content
Snippets Groups Projects
Commit 8ff3325d authored by Corné Lukken's avatar Corné Lukken
Browse files

Add linting jobs for levant files

parent f9a23724
No related branches found
No related tags found
1 merge request!14Add linting jobs for levant files
image: docker:latest image: docker:latest
stages: stages:
- build - build
- lint
- tag-latest - tag-latest
- deploy - deploy
...@@ -36,6 +37,52 @@ build_prometheus: ...@@ -36,6 +37,52 @@ build_prometheus:
- docker build --cache-from $IMAGE_NAME/prometheus:latest --tag $IMAGE_NAME/prometheus:$IMAGE_TAG prometheus-central - docker build --cache-from $IMAGE_NAME/prometheus:latest --tag $IMAGE_NAME/prometheus:$IMAGE_TAG prometheus-central
- docker push $IMAGE_NAME/prometheus:$IMAGE_TAG - docker push $IMAGE_NAME/prometheus:$IMAGE_TAG
render_levant:
stage: lint
image:
name: hashicorp/levant
entrypoint: [ "" ]
parallel:
matrix:
- COMPONENT:
- garibaldi
- logs
- grafana-lofar
- metrics
- tracing
script:
- |
levant render \
-var-file=infra/env.yaml \
-var image_tag="${IMAGE_TAG}" \
-out=${COMPONENT}.nomad \
infra/${COMPONENT}-central.levant.nomad
artifacts:
paths:
- ${COMPONENT}.nomad
evaluate_nomad:
stage: lint
image:
name: hashicorp/nomad
entrypoint: [ "" ]
needs:
- job: render_levant
artifacts: true
parallel:
matrix:
- COMPONENT:
- garibaldi
- logs
- grafana-lofar
- metrics
- tracing
- valkey
- valkey-sentinel
script:
- mv *.nomad infra/
- nomad job validate infra/${COMPONENT}.nomad
tag-latest_grafana: tag-latest_grafana:
stage: tag-latest stage: tag-latest
tags: tags:
...@@ -87,9 +134,9 @@ deploy_prepare: ...@@ -87,9 +134,9 @@ deploy_prepare:
- mkdir -p ./.bin - mkdir -p ./.bin
- wget -qO- "${nomad_download}" | zcat >> ./.bin/nomad - wget -qO- "${nomad_download}" | zcat >> ./.bin/nomad
- chmod +x ./.bin/nomad - chmod +x ./.bin/nomad
# - ./.bin/nomad volume create infra/postgres-volume.hcl # - ./.bin/nomad volume create infra/volume.hcl
deploy: deploy-levant:
stage: deploy stage: deploy
image: image:
name: hashicorp/levant name: hashicorp/levant
...@@ -104,8 +151,11 @@ deploy: ...@@ -104,8 +151,11 @@ deploy:
- SERVER: - SERVER:
- monitor - monitor
COMPONENT: COMPONENT:
- garibaldi
- logs
- grafana-lofar - grafana-lofar
- metrics - metrics
- tracing
environment: environment:
name: ${SERVER}.control.lofar name: ${SERVER}.control.lofar
url: http://${SERVER}.control.lofar:4646 url: http://${SERVER}.control.lofar:4646
...@@ -117,6 +167,33 @@ deploy: ...@@ -117,6 +167,33 @@ deploy:
-var image_tag="${IMAGE_TAG}" \ -var image_tag="${IMAGE_TAG}" \
infra/${COMPONENT}-central.levant.nomad infra/${COMPONENT}-central.levant.nomad
deploy-nomad:
stage: deploy
image:
name: hashicorp/nomad
entrypoint: [ "" ]
needs: [ build_grafana, build_prometheus ]
when: manual
# rules:
# - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
dependencies: [ ]
parallel:
matrix:
- SERVER:
- monitor
COMPONENT:
- valkey
- valkey-sentinel
environment:
name: ${SERVER}.control.lofar
url: http://${SERVER}.control.lofar:4646
script:
- |
levant deploy \
-address="http://${SERVER}.control.lofar:4646" \
-var-file=infra/env.yaml \
-var image_tag="${IMAGE_TAG}" \
infra/${COMPONENT}.nomad
# has no CI/CD yet # has no CI/CD yet
# trigger-operations-central-management: # trigger-operations-central-management:
......
job "daily-backup-grafana-to-s3" {
datacenters = ["nl-north"]
type = "batch"
namespace = "operations"
periodic {
crons = ["@daily"]
}
group "garibaldi" {
vault {
policies = ["default"]
}
task "garibaldi" {
driver = "docker"
config {
image = "[[.registry.astron.url]]/grafana/garibaldi:latest"
}
env {
MINIO_HOSTNAME = "https://s3.lofar.net:443"
MINIO_ACCESS_KEY = "minioadmin"
MINIO_SECRET_KEY = "minioadmin"
MINIO_BUCKET = "grafana-backup"
GRAFANA_URL = "https://monitoring.lofar.net:443"
}
template {
env = true
destination = "secrets/file.env"
data = <<EOH
GRAFANA_TOKEN = "{{with secret "kv-v2/data/grafana/garabaldi"}}{{.Data.data.token}}{{end}}"
EOH
}
resources {
cpu = 2500
memory = 512
}
}
}
}
\ No newline at end of file
...@@ -426,46 +426,4 @@ EOH ...@@ -426,46 +426,4 @@ EOH
} }
} }
job "daily-backup-grafana-to-s3" {
datacenters = ["nl-north"]
type = "batch"
namespace = "operations"
periodic {
cron = "@daily"
}
group "garibaldi" {
vault {
policies = ["default"]
}
task "garibaldi" {
driver = "docker"
config {
image = "[[.registry.astron.url]]/grafana/garibaldi:latest"
}
env {
MINIO_HOSTNAME = "https://s3.lofar.net:443"
MINIO_ACCESS_KEY = "minioadmin"
MINIO_SECRET_KEY = "minioadmin"
MINIO_BUCKET = "grafana-backup"
GRAFANA_URL = "https://monitoring.lofar.net:443"
}
template {
env = true
destination = "secrets/file.env"
data = <<EOH
GRAFANA_TOKEN = "{{with secret "kv-v2/data/grafana/garabaldi"}}{{.Data.data.token}}{{end}}"
EOH
}
resources {
cpu = 2500
memory = 512
}
}
}
}
...@@ -76,6 +76,7 @@ FOE ...@@ -76,6 +76,7 @@ FOE
else else
echo "add master ${MASTER[0]}:${MASTER[1]} to redis.conf" echo "add master ${MASTER[0]}:${MASTER[1]} to redis.conf"
echo "slaveof ${MASTER[0]} ${MASTER[1]}" >> {{ env "NOMAD_ALLOC_DIR" }}/valkey.conf echo "slaveof ${MASTER[0]} ${MASTER[1]}" >> {{ env "NOMAD_ALLOC_DIR" }}/valkey.conf
echo "replica-read-only no" >> {{ env "NOMAD_ALLOC_DIR" }}/valkey.conf
fi fi
EOF EOF
} }
...@@ -108,9 +109,6 @@ EOF ...@@ -108,9 +109,6 @@ EOF
timeout = "2s" timeout = "2s"
} }
connect {
sidecar_service {}
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment