add CI config
This commit is contained in:
1 parent
4ab9a392d6
commit
d9b1b0f6fd
3 files changed
+55
-1
No files matched your search
@@ -0,0 +1,17 @@
|
|||||||
|
stages:
|
||||||
|
- generate
|
||||||
|
|
||||||
|
generate-child-pipeline:
|
||||||
|
stage: generate
|
||||||
|
image: alpine:latest
|
||||||
|
script:
|
||||||
|
- apk add --no-cache bash
|
||||||
|
- ./ci-scripts/generate-pipeline.sh > child-pipeline.yml
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- child-pipeline.yml
|
||||||
|
trigger:
|
||||||
|
include:
|
||||||
|
- artifact: child-pipeline.yml
|
||||||
|
job: generate-child-pipeline
|
||||||
|
strategy: depend
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
echo "stages:"
|
||||||
|
echo " - validate"
|
||||||
|
echo " - deploy"
|
||||||
|
|
||||||
|
for dir in templates/*; do
|
||||||
|
[ -d "$dir" ] || continue
|
||||||
|
name=$(basename "$dir")
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
validate_${name}:
|
||||||
|
stage: validate
|
||||||
|
image: hashicorp/terraform:1.6
|
||||||
|
script:
|
||||||
|
- terraform -chdir=$dir init -backend=false
|
||||||
|
- terraform -chdir=$dir validate
|
||||||
|
only:
|
||||||
|
changes:
|
||||||
|
- $dir/**
|
||||||
|
|
||||||
|
deploy_${name}:
|
||||||
|
stage: deploy
|
||||||
|
image: registry.bobert.me/anthorob/coder-images:coder-cli
|
||||||
|
script:
|
||||||
|
- cd $dir
|
||||||
|
- coder templates push ${name} --tag "${CI_COMMIT_SHORT_SHA}" --description "Auto-deployed from ${CI_PROJECT_PATH} on commit ${CI_COMMIT_SHORT_SHA}" --latest --yes
|
||||||
|
only:
|
||||||
|
refs:
|
||||||
|
- main
|
||||||
|
changes:
|
||||||
|
- $dir/**
|
||||||
|
EOF
|
||||||
|
|
||||||
|
done
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
variable "language" {
|
variable "language" { ## construct docker image with this?
|
||||||
description = "Language label for metadata"
|
description = "Language label for metadata"
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user