How mchmarny/custom-cloud-workstation-image works
Main Components
• Git Repository & File Structure – Represent the repository which holds source files including configuration scripts (in assets/), the Dockerfile, version file, Makefile, and cloudbuild.yaml. These components define both the container image build and startup configuration (e.g., SSH daemon settings, VS Code user settings, and git configuration).
• CI/CD Pipeline – Highlight Cloud Build as the central pipeline that reads cloudbuild.yaml to trigger builds. Indicate that new builds are triggered either manually (via git tag pushes) or on a scheduled basis using Cloud Scheduler.
• Artifact Registry – Show the container image repository where the newly built Docker images are published.
• Cloud Workstations Cluster & Configuration – Represent the Cloud Workstations cluster that gets created/updated using the custom image. Include the separate steps of cluster creation, configuration update (which uses the new container image and service accounts), and workstation instance creation.
• External GCP Services – Incorporate Google Cloud IAM (service account management and permissions), Cloud Build triggers, and Cloud Scheduler for the scheduled image rebuilds.
Relationships and Data Flow
• The code repository (with Dockerfile, assets, and setup scripts) is committed and tagged by developers. A git tag triggers the Cloud Build pipeline.
• Cloud Build then invokes the build process, using the Dockerfile to package the image and then pushes it to the Artifact Registry.
• Once a new image is published, the Cloud Workstations configuration is automatically updated—this update includes pulling in the proper image digest.
• On a daily or manual schedule, Cloud Scheduler triggers a new build cycle to ensure the image is up to date.
• The updated image is then used by Cloud Workstations to launch workstations, which run the preconfigured environment (with settings for Go and VS Code).
Architectural Patterns & Design Principles
• Separation of Concerns – The build process is separated from deployment. Dockerfile and assets handle setup specifics while cloudbuild.yaml manages the build pipeline.
• Automation & Idempotency – The design emphasizes automatic image builds (via git tag and scheduled triggers) and user configuration scripts (in assets/setup) which are idempotent, ensuring consistency even if applied multiple times.
• Integration with GCP Services – The project heavily integrates with Google Cloud services (Cloud Build, Artifact Registry, Cloud Workstations, Cloud Scheduler, and IAM) to offer a seamless automated development environment.
Relevant Technologies & Frameworks
• Containerization using Docker (the Dockerfile and associated assets)
• Google Cloud Build for CI/CD
• Google Artifact Registry for container image storage
• Google Cloud Workstations for the final deployment of the customized environment
• Google Cloud Scheduler for periodically triggering the image rebuild process
• Additional Details: Optionally denote service accounts, IAM roles, and specific configuration scripts (e.g., SSH setup scripts in assets/etc and user config scripts in assets/setup) to highlight customization points.