This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor for template use case (#38)
* refactor for template repo gitops workflow * refactor for template repo gitops workflow * refactor for template repo gitops workflow * refactor for template repo gitops workflow * refactor for template repo gitops workflow
- Loading branch information
Showing
13 changed files
with
132 additions
and
71 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export FOO="bar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FROM ghcr.io/pulumi/devcontainer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
image: ghcr.io/pulumi/devcontainer | ||
image: ghcr.io/pulumi/devcontainer |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# --- Global Variables --- | ||
PULUMI_STACK := echo $GITHUB_REPOSITORY | awk -F '[/]' '{print $2}' | ||
GITHUB_REPOSITORY_STRING := $(shell echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]') | ||
DOCKER_IMAGE_NAME := ghcr.io/${GITHUB_REPOSITORY_STRING}:latest | ||
# --- Help --- | ||
# This section provides a default help message displaying all available commands | ||
help: | ||
@echo "Available commands:" | ||
@echo " update Update the .github/devcontainer submodule" | ||
@echo " login Log in to Pulumi" | ||
@echo " esc Run a Pulumi ESC environment" | ||
@echo " up Deploy Pulumi infrastructure" | ||
@echo " act Install the GitHub 'gh-act' extension" | ||
@echo " test Run all tests" | ||
|
||
# --- Docker Build --- | ||
# Build the Docker image | ||
build: | ||
@echo "Building Docker image..." | ||
clear | ||
docker build --progress plain --load --pull --build-arg GITHUB_TOKEN="${GITHUB_TOKEN}" --tag ${DOCKER_IMAGE_NAME} -f ./docker/Dockerfile ./docker | ||
@echo "Docker image built." | ||
|
||
# --- GitHub Actions --- | ||
# Install & Run the GitHub 'gh-act' extension for local testing of GitHub Actions | ||
act: | ||
@echo "Installing & Running 'act' Github Actions Workflow Testing..." | ||
gh extension install nektos/gh-act || true | ||
gh act -s GITHUB_TOKEN=${GITHUB_TOKEN} -s ACTIONS_RUNTIME_TOKEN=${GITHUB_TOKEN} -s GHA_GITHUB_TOKEN=${GITHUB_TOKEN} | ||
@echo "Github Workflow Complete." | ||
|
||
# --- Pulumi Commands --- | ||
# Log in to Pulumi | ||
pulumi-login: | ||
@echo "Logging in to Pulumi..." | ||
pulumi login | ||
@echo "Login successful." | ||
|
||
# Deploy Pulumi infrastructure | ||
pulumi-up: | ||
@echo "Deploying Pulumi infrastructure..." | ||
pulumi up --stack $(PULUMI_STACK) | ||
@echo "Deployment complete." | ||
|
||
# Run a Pulumi ESC environment | ||
pulumi-esc-env: | ||
@echo "Running Pulumi ESC environment..." | ||
# Replace the below command with the actual command to run the Pulumi ESC environment | ||
pulumi esc env open --stack $(PULUMI_STACK) | ||
@echo "Pulumi ESC environment running." | ||
|
||
# --- Devcontainer Management --- | ||
# Update the .github/devcontainer submodule | ||
update-devcontainer: | ||
@echo "Updating .github/devcontainer submodule..." | ||
git submodule update --init --recursive .github/devcontainer | ||
@echo "Update complete." | ||
|
||
# --- Testing --- | ||
# Add your testing scripts here | ||
test: | ||
@echo "Running tests..." | ||
# Add commands to run your tests | ||
@echo "Testing complete." | ||
|
||
# --- Default Command --- | ||
# Default command when running 'make' without arguments | ||
all: help | ||
|
||
# Note: Each command is fully implemented with the necessary steps for each task. | ||
# This Makefile is designed to be both functional and educational. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,73 @@ | ||
# Pulumi Dev Container | ||
[![Pulumi](https://img.shields.io/badge/pulumi-v3.101.1-blueviolet)](https://www.pulumi.com/docs/get-started/install/) [![Kubectl](https://img.shields.io/badge/kubectl-v1.29.0-blueviolet)](https://kubernetes.io/docs/tasks/tools/install-kubectl/) [![Docker](https://img.shields.io/badge/docker-v24.0.7-blueviolet)](https://docs.docker.com/get-docker/) [![Kind](https://img.shields.io/badge/kind-v0.20.0-blueviolet)](https://kind.sigs.k8s.io/docs/user/quick-start/) [![Helm](https://img.shields.io/badge/helm-v3.13.3-blueviolet)](https://helm.sh/docs/intro/install/) | ||
[![License](https://img.shields.io/github/license/usrbinkat/iac-mesh-pac)]() [![ghcr.io/pulumi/devcontainer](https://github.com/pulumi/devcontainer/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/pulumi/devcontainer/actions/workflows/build.yaml) | ||
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/pulumi/devcontainer?quickstart=1) | ||
|
||
### [![ghcr.io/pulumi/devcontainer](https://github.com/pulumi/devcontainer/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/pulumi/devcontainer/actions/workflows/build.yaml) | ||
This is a [Github Template Repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) which provides a Pulumi [Devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) together with GitOps ready boilerplate for quickly starting new Pulumi IaC projects. | ||
|
||
This repository is designed with deep [VS Code](https://code.visualstudio.com) integration to automate Pulumi IaC and Provider development dependencies and prerequisites as much as possible using [Dev Containers](https://containers.dev/) to prepare your development environment, or even just run your development directly in the browser with [Github CodeSpaces](https://github.com/features/codespaces). | ||
The Pulumi [Devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) is designed with deep [VS Code](https://code.visualstudio.com) and [Github Codespaces](https://github.com/features/codespaces) integration to streamline a common Pulumi IaC and Provider development environment. dependencies and prerequisites as much as possible using [Dev Containers](https://containers.dev/) to prepare your development environment, or even just run your development directly in the browser with [Github CodeSpaces](https://github.com/features/codespaces). | ||
|
||
![CodeSpaces Screenshot](./.github/assets/codespaces.png) | ||
|
||
# Getting Started | ||
|
||
There are 3 ways to get started: | ||
With multiple ways to get started, it is a good idea to briefly review: | ||
|
||
1. [Git Submodule](#git-submodule) | ||
1. [Github CodeSpaces](#github-codespaces) | ||
1. [VS Code Dev Container](#vs-code-dev-container) | ||
- [Getting Started](#getting-started) | ||
- [Git Submodule](#git-submodule) | ||
- [Github CodeSpaces](#github-codespaces) | ||
- [VS Code Dev Container](#vs-code-dev-container) | ||
- [First time setup](#first-time-setup) | ||
- [Pulumi Dev Container](#pulumi-dev-container) | ||
|
||
# Git Submodule | ||
# Github CodeSpaces | ||
|
||
The pulumi Dev Container repository can be added as a submodule to your project to provide an easy and consistent development environment. | ||
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/pulumi/devcontainer?quickstart=1) | ||
|
||
To add this repository as a submodule to your project, run the following commands: | ||
Codespaces is the easiest way to get started quickly. Simply click the button above to open this repository in a new Codespace and then follow the [First time setup](#first-time-setup) instructions below. | ||
|
||
```bash | ||
git submodule add https://github.com/pulumi/devcontainer .devcontainer | ||
git submodule update --init --recursive .devcontainer | ||
``` | ||
> Fig 1. How to open project in CodeSpaces | ||
![How to open repository in CodeSpaces](./.github/assets/gh-open-codespaces.png) | ||
|
||
To update the devcontainer submodule in consuming repos: | ||
## First time setup | ||
|
||
1. Pulumi Login | ||
|
||
```bash | ||
git submodule update --remote --merge .devcontainer | ||
pulumi login | ||
``` | ||
|
||
After the submodule is added, you can open your project in VS Code and it will automatically detect the Dev Container configuration and prompt you to open the project in a container, or you can open the project in Github CodeSpaces. | ||
> Fig 2.b pulumi login | ||
![Pulumi login](./.github/assets/pulumi-login.png) | ||
![Pulumi login complete](./.github/assets/pulumi-login-complete.png) | ||
|
||
# Github CodeSpaces | ||
2. Create a new stack | ||
|
||
> Fig 1. How to open project in CodeSpaces | ||
![How to open repository in CodeSpaces](./.github/assets/gh-open-codespaces.png) | ||
```bash | ||
pulumi new | ||
pulumi stack init | ||
``` | ||
|
||
# VS Code Dev Container | ||
|
||
To use the Dev Container in VS Code, you will need to install the [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension, and follow the [official tutorial here](https://code.visualstudio.com/docs/devcontainers/tutorial) to begin. | ||
|
||
## First time setup | ||
# Git Submodule | ||
|
||
1. Pulumi Login | ||
The pulumi Dev Container repository can be added as a submodule to an existing project to provide an easy and consistent development environment that is maintained upstream. | ||
|
||
To add this repository as a submodule to your project, run the following commands: | ||
|
||
```bash | ||
pulumi login | ||
git submodule add https://github.com/pulumi/devcontainer .github/devcontainer | ||
git submodule update --init --recursive .github/devcontainer | ||
mkdir .devcontainer && cp .github/devcontainer/.devcontainer/* .devcontainer/ | ||
``` | ||
|
||
> Fig 2.b pulumi login | ||
![Pulumi login](./.github/assets/pulumi-login.png) | ||
![Pulumi login complete](./.github/assets/pulumi-login-complete.png) | ||
To update the devcontainer submodule in consuming repos: | ||
|
||
```bash | ||
git submodule update --remote --merge .github/devcontainer | ||
``` | ||
|
||
After the submodule is added, you can open your project in VS Code and it will automatically detect the Dev Container configuration and prompt you to open the project in a container, or you can open the project in Github CodeSpaces. |
File renamed without changes.
File renamed without changes.
File renamed without changes.