test
This commit is contained in:
1 parent
319b647fa9
commit
ce5e355756
1 file changed
+52
-23
+52
-23
@@ -11,44 +11,73 @@ on:
|
|||||||
- 'base/**'
|
- 'base/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate:
|
checkout:
|
||||||
name: Validate templates
|
name: Checkout repository
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: gitea.bobert.me/anthorob/coder-base:terraform
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Terraform validate for each template
|
- name: Upload repo files as artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: source
|
||||||
|
path: |
|
||||||
|
base
|
||||||
|
templates
|
||||||
|
|
||||||
|
validate:
|
||||||
|
name: Validate templates
|
||||||
|
needs: checkout
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Download source artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: source
|
||||||
|
|
||||||
|
- name: Terraform validate for each template (docker)
|
||||||
run: |
|
run: |
|
||||||
for dir in templates/*; do
|
docker run --rm \
|
||||||
[ -d "$dir" ] || continue
|
-v "$PWD":/workspace \
|
||||||
echo "==> validating $dir"
|
-w /workspace \
|
||||||
terraform -chdir="$dir" init -backend=false
|
gitea.bobert.me/anthorob/coder-base:terraform sh -c '
|
||||||
terraform -chdir="$dir" validate
|
for dir in templates/*; do
|
||||||
done
|
[ -d "$dir" ] || continue
|
||||||
|
echo "==> validating $dir"
|
||||||
|
terraform -chdir="$dir" init -backend=false
|
||||||
|
terraform -chdir="$dir" validate
|
||||||
|
done
|
||||||
|
'
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy templates
|
name: Deploy templates
|
||||||
needs: validate
|
needs: validate
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: gitea.bobert.me/anthorob/coder-base:cli
|
|
||||||
env:
|
env:
|
||||||
COMMIT_SHORT_SHA: ${{ github.sha }}
|
COMMIT_SHORT_SHA: ${{ github.sha }}
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Download source artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: source
|
||||||
|
|
||||||
- name: Deploy each template
|
- name: Deploy each template (docker)
|
||||||
run: |
|
run: |
|
||||||
short_sha=${COMMIT_SHORT_SHA:0:7}
|
short_sha=${COMMIT_SHORT_SHA:0:7}
|
||||||
for dir in templates/*; do
|
docker run --rm \
|
||||||
[ -d "$dir" ] || continue
|
-v "$PWD":/workspace \
|
||||||
name=$(basename "$dir")
|
-w /workspace \
|
||||||
display_name=$(echo "$name" | sed 's/.*/\u&/' | sed 's/-/ /g')
|
-e COMMIT_SHORT_SHA \
|
||||||
|
-e REPO \
|
||||||
|
gitea.bobert.me/anthorob/coder-base:cli sh -c '
|
||||||
|
for dir in templates/*; do
|
||||||
|
[ -d "$dir" ] || continue
|
||||||
|
name=$(basename "$dir")
|
||||||
|
display_name=$(echo "$name" | sed "s/.*/\u&/" | sed "s/-/ /g")
|
||||||
|
|
||||||
echo "==> deploying $name"
|
echo "==> deploying $name"
|
||||||
coder templates push -d "$dir" --name "$short_sha" --message "Auto-deployed from $REPO on commit $short_sha" --yes "$name"
|
coder templates push -d "$dir" --name "$short_sha" --message "Auto-deployed from $REPO on commit $short_sha" --yes "$name"
|
||||||
coder templates edit "$name" --display-name "$display_name Dev Environment" --description "Development environment for $name" --icon "/icon/$name.svg" --yes
|
coder templates edit "$name" --display-name "$display_name Dev Environment" --description "Development environment for $name" --icon "/icon/$name.svg" --yes
|
||||||
done
|
done
|
||||||
|
'
|
||||||
Reference in new issue
Block a user