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: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ jobs:
FETCH_GH_TOKEN=${{ secrets.GITHUB_TOKEN }}

publish-template:
runs-on: ubuntu-latest
needs: [create-release, publish-image]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
Expand Down Expand Up @@ -178,6 +178,7 @@ jobs:
coder template push \
--directory ${TEMPLATE_DIR} \
--var workspace_image=${WORKSPACE_IMAGE} \
--var test_mode=false \
--name ${TEMPLATE_VERSION} \
--message "${RELEASE_MSG}" \
--yes \
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: "test image"
on:
pull_request:
paths:
- 'images/**'
- 'images/homelab-workspace/**'
- '.github/workflows/test-image.yaml'
workflow_dispatch:

Expand Down Expand Up @@ -81,8 +81,8 @@ jobs:
echo "Done"
echo

echo "Running entrypoint preparation script..."
docker exec $container_name sudo -u root /opt/coder/bin/entrypoint-prepare.sh --username $test_user
echo "Create test user within container..."
docker exec $container_name sudo -u root useradd --groups sudo --shell /bin/bash $test_user
echo "Done"
echo

Expand Down
26 changes: 9 additions & 17 deletions .github/workflows/test-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,6 @@ jobs:
# renovate: datasource=github-releases depName=nestybox/sysbox
SYSBOX_VERSION: "0.6.4"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3
with:
driver-opts: network=host

- name: Build image for testing template
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6
with:
context: ./images/simple-workspace
load: true
push: false
tags: simple-workspace:latest
allow: network.host
network: host

- name: Start local coder instance
# yamllint disable-line rule:indentation
run: |
Expand Down Expand Up @@ -123,7 +108,14 @@ jobs:
export TEMPLATE_NAME="test-$(date --utc +%Y%m%d-%H%M%SZ)"
echo "TEMPLATE_NAME=${TEMPLATE_NAME}" >> $GITHUB_ENV
echo "Publishing template ${TEMPLATE_DIR} as ${TEMPLATE_NAME}..."
coder template push --directory ${TEMPLATE_DIR} --var workspace_image=simple-workspace:latest --yes ${TEMPLATE_NAME}
set -x
coder template push \
--directory ${TEMPLATE_DIR} \
--var workspace_image=ubuntu:noble \
--var test_mode=true \
--yes \
${TEMPLATE_NAME}
set +x

echo
echo "Confirming template has been published..."
Expand Down Expand Up @@ -192,7 +184,7 @@ jobs:
docker logs -n 100 coder-coder-1
echo
echo Container logs:
docker logs -n 100 ${WORKSPACE_NAME}
docker logs 100 ${WORKSPACE_NAME}
echo
echo Workspace status
coder show ${WORKSPACE_NAME}
Expand Down
63 changes: 0 additions & 63 deletions images/homelab-workspace/coder/entrypoint-prepare.sh

This file was deleted.

26 changes: 0 additions & 26 deletions images/simple-workspace/Dockerfile

This file was deleted.

56 changes: 56 additions & 0 deletions templates/docker/homelab-workspace/coder-agent.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
resource "coder_agent" "main" {
arch = "amd64"
os = "linux"
startup_script = var.test_mode ? "/bin/bash --noprofile --norc" : "/bin/bash --noprofile --norc /opt/coder/bin/agent-startup.sh"
startup_script_behavior = "blocking"

metadata {
display_name = "CPU Usage"
key = "0_cpu_usage"
script = "coder stat cpu"
interval = 60
timeout = 1
}

metadata {
display_name = "Memory Usage"
key = "1_mem_usage"
script = "coder stat mem --prefix Gi"
interval = 60
timeout = 1
}

metadata {
display_name = "Home Disk"
key = "3_home_disk"
script = "coder stat disk --path $${HOME}"
interval = 60
timeout = 1
}

metadata {
display_name = "CPU Usage (Host)"
key = "4_cpu_usage_host"
script = "coder stat cpu --host"
interval = 60
timeout = 1
}

metadata {
display_name = "Memory Usage (Host)"
key = "5_mem_usage_host"
script = "coder stat mem --host"
interval = 60
timeout = 1
}

metadata {
display_name = "Load Average"
key = "load"
script = <<EOT
awk '{print $1,$2,$3}' /proc/loadavg
EOT
interval = 60
timeout = 1
}
}
Loading