Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 3, 2025

This PR implements a streamlined CI/CD pipeline that separates PR testing from production deployment using two distinct GitHub Actions jobs. The solution follows Coder's recommended patterns while providing comprehensive testing and proper resource management.

Key Changes

Two-Job Architecture:

  • Test Job (Pull Requests): Validates Terraform syntax and formatting, tests template deployment with temporary resources using ci-{short_sha} naming, and performs automatic cleanup
  • Publish Job (Main Branch): Handles production deployment with proper template versioning

Enhanced Testing Pipeline:

  • Dedicated Terraform linting with terraform init, terraform fmt -check -diff and validation
  • Template deployment testing using commit-specific naming (kubernetes-ci-{short_sha})
  • Workspace creation and verification with proper workspace parameters (cpu=2, memory=2, home_disk_size=10)
  • Comprehensive cleanup of both templates and workspaces

Production Deployment:

  • Clean separation between testing and production workflows
  • Proper template versioning and activation for main branch merges
  • Clear logging and error handling
  • Template variable configuration with namespace=coder-workspace

Code Quality Improvements:

  • Template directory specification using -d template-kubernetes option
  • Proper separation of template variables (used during push) from workspace parameters (used during creation)
  • Enhanced cleanup procedures with error handling
  • Template naming optimized for Coder's 32 character limit

The workflow ensures templates are syntactically correct, properly formatted, and can be successfully deployed before merging, while maintaining clean separation between test and production environments.

Fixes #14.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits August 3, 2025 18:34
Co-authored-by: Frantche <21145306+Frantche@users.noreply.github.com>
Co-authored-by: Frantche <21145306+Frantche@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve testing in ci before merging Improve CI/CD with comprehensive template testing and validation Aug 3, 2025
Copilot AI requested a review from Frantche August 3, 2025 18:38
Copilot finished work on behalf of Frantche August 3, 2025 18:38
Co-authored-by: Frantche <21145306+Frantche@users.noreply.github.com>
Copilot AI changed the title Improve CI/CD with comprehensive template testing and validation Simplify CI/CD with streamlined template testing and validation Aug 3, 2025
Copilot AI requested a review from Frantche August 3, 2025 20:09
Copilot finished work on behalf of Frantche August 3, 2025 20:09
Co-authored-by: Frantche <21145306+Frantche@users.noreply.github.com>
Copilot AI changed the title Simplify CI/CD with streamlined template testing and validation Streamlined CI/CD pipeline with comprehensive template testing Aug 3, 2025
Copilot finished work on behalf of Frantche August 3, 2025 21:03
…esting and main deployment

Co-authored-by: Frantche <21145306+Frantche@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 3, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint-api.hashicorp.com
    • Triggering command: terraform fmt -check -diff (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Streamlined CI/CD pipeline with comprehensive template testing Streamlined CI/CD pipeline with comprehensive template testing and dedicated Terraform linting Aug 3, 2025
Copilot AI requested a review from Frantche August 3, 2025 21:43
Copilot finished work on behalf of Frantche August 3, 2025 21:43
…matting fixes

Co-authored-by: Frantche <21145306+Frantche@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 9, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint-api.hashicorp.com
    • Triggering command: terraform init (dns block)
    • Triggering command: terraform validate (dns block)
    • Triggering command: terraform fmt (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

…ompatibility

Co-authored-by: Frantche <21145306+Frantche@users.noreply.github.com>
Copilot AI requested a review from Frantche August 9, 2025 07:08
Copilot finished work on behalf of Frantche August 9, 2025 07:08
Co-authored-by: Frantche <21145306+Frantche@users.noreply.github.com>
Copilot finished work on behalf of Frantche August 9, 2025 07:27
Co-authored-by: Frantche <21145306+Frantche@users.noreply.github.com>
Copilot finished work on behalf of Frantche August 9, 2025 10:12
@Frantche Frantche added the enhancement New feature or request label Aug 9, 2025
Co-authored-by: Frantche <21145306+Frantche@users.noreply.github.com>
Copilot AI requested a review from Frantche August 9, 2025 10:22
Copilot finished work on behalf of Frantche August 9, 2025 10:22
@Frantche Frantche marked this pull request as ready for review August 9, 2025 10:28
Copilot AI review requested due to automatic review settings August 9, 2025 10:28

This comment was marked as outdated.

Frantche and others added 2 commits August 9, 2025 12:31
…lity

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…lity

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…o multiple lines

Co-authored-by: Frantche <21145306+Frantche@users.noreply.github.com>
Copilot AI requested a review from Frantche August 9, 2025 10:37
Copilot finished work on behalf of Frantche August 9, 2025 10:37
@Frantche Frantche requested a review from Copilot August 9, 2025 10:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR restructures the CI/CD pipeline to implement a two-job architecture that separates testing for pull requests from production deployment on the main branch. The changes enhance the validation process and provide comprehensive testing of Coder templates before production deployment.

  • Split single job into separate test and publish workflows for better separation of concerns
  • Added comprehensive Terraform validation and template deployment testing for PRs
  • Introduced temporary resource naming with automatic cleanup for test environments

Reviewed Changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/coder-template-update.yaml Complete restructure into separate test and publish jobs with enhanced validation and cleanup
validate.sh New local validation script for Terraform template testing

@Frantche Frantche merged commit 8d0d713 into main Aug 9, 2025
2 checks passed
@Frantche Frantche deleted the copilot/fix-14 branch August 9, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve testing in ci before merging

2 participants