diff --git a/.devcontainer.json b/.devcontainer.json deleted file mode 120000 index 62b9558..0000000 --- a/.devcontainer.json +++ /dev/null @@ -1 +0,0 @@ -devcontainer.json \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 107675c..827df8e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,7 +9,7 @@ # ~$ gh extension install nektos/gh-act # ~$ gh act --env-file .env -s GITHUB_TOKEN=$GITHUB_TOKEN -s PULUMI_ACCESS_TOKEN=$PULUMI_ACCESS_TOKEN -name: Pulumi Devcontainer Build Status +name: Pulumi Devcontainer Build on: workflow_dispatch: push: diff --git a/.gitignore b/.gitignore index a28a389..437e287 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .pulumi/* .kube/* +frontmatter.json diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cfaadbe --- /dev/null +++ b/Makefile @@ -0,0 +1,94 @@ +# --- Global Variables --- +PULUMI_STACK := echo ${GITHUB_REPOSITORY} | awk -F '[/]' '{print $2}' +GITHUB_REPOSITORY_STRING := $(shell echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]') +KONDUCTOR_NAME ?= $(if ${GITHUB_REPOSITORY_STRING},${GITHUB_REPOSITORY_STRING},pulumi/devcontainer) +DOCKER_IMAGE_NAME := "ghcr.io/${KONDUCTOR_NAME}:latest" + +# --- Help --- +# This section provides a default help message displaying all available commands +help: + @echo "Available commands:" + @echo " devcontainer-update Update the .github/devcontainer submodule" + @echo " pulumi-login Log in to Pulumi" + @echo " esc-run Run a Pulumi ESC environment" + @echo " pulumi-up Deploy Pulumi infrastructure" + @echo " act Install the GitHub 'gh-act' extension" + @echo " test Run all tests" + +# --- Docker Build --- +# Build the Docker image +docker-build: + @echo "Building Docker image..." + clear + docker build --progress plain --pull --build-arg GITHUB_TOKEN="${GITHUB_TOKEN}" --tag ${DOCKER_IMAGE_NAME} -f ./docker/Dockerfile ./docker + @echo "Docker image built." + +# --- Docker Build & Push --- +# Build the Docker image +docker-build-push: + @echo "Building Docker image & pushing to ${DOCKER_IMAGE_NAME}..." + clear + docker build --progress plain --push --pull --tag ${DOCKER_IMAGE_NAME} -f ./docker/Dockerfile ./docker + @echo "Docker published to ${DOCKER_IMAGE_NAME}..." + +# --- GitHub Actions --- +# Install & Run the GitHub 'gh-act' extension for local testing of GitHub Actions +act: + @echo "Test Github Workflows." + 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." + +# --- Kind --- +# Kind Create Cluster +kind: + @echo "Creating Kind Cluster..." + mkdir .kube + docker volume create cilium-worker-n01 + docker volume create cilium-worker-n02 + docker volume create cilium-control-plane-n01 + kind create cluster --config hack/kind.yaml + @echo "Kind Cluster Created." + +# --- Default Command --- +devcontainer:: + git submodule update --init --recursive .github/devcontainer + git submodule update --remote --merge .github/devcontainer + cp .devcontainer/devcontainer.json .devcontainer.json + +# --- Default Command --- +# Default command when running 'make' without arguments +all: help diff --git a/Makefile.example b/Makefile.example deleted file mode 100644 index 6526ac1..0000000 --- a/Makefile.example +++ /dev/null @@ -1,5 +0,0 @@ -devcontainer:: - git submodule update --init --recursive .devcontainer - git submodule update --remote --merge .devcontainer - rm -rf .devcontainer.json - cp .devcontainer/devcontainer.json .devcontainer.json diff --git a/README.md b/README.md index d553c0f..17305f6 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ [![License](https://img.shields.io/github/license/usrbinkat/iac-mesh-pac)]() [![Pulumi](https://img.shields.io/badge/pulumi-v3.102.0-blueviolet)](https://www.pulumi.com/docs/get-started/install/) [![Kubectl](https://img.shields.io/badge/kubectl-v1.26.13-blueviolet)](https://kubernetes.io/docs/tasks/tools/install-kubectl/) [![Docker](https://img.shields.io/badge/docker-v25.0.0-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.14.0-blueviolet)](https://helm.sh/docs/intro/install/) -[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/pulumi/devcontainer?quickstart=1) - [![Pulumi Devcontainer Build Status](https://github.com/pulumi/devcontainer/actions/workflows/build.yaml/badge.svg)](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) + 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. 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). diff --git a/containers/kind/devcontainer.json b/containers/kind/devcontainer.json deleted file mode 100644 index d148bbb..0000000 --- a/containers/kind/devcontainer.json +++ /dev/null @@ -1,87 +0,0 @@ -// Reference: -// - https://containers.dev/features -// - https://containers.dev/implementors/features -// - https://code.visualstudio.com/docs/getstarted/settings -{ - "name": "pulumi-devcontainer", - "image": "ghcr.io/pulumi/devcontainer:latest", - "customizations": { - "vscode": { - "settings": { - // https://github.com/VSCodeVim/Vim - "vim.disableExtension": true, - "vim.easymotion": true, - "vim.incsearch": true, - "vim.useSystemClipboard": true, - "vim.useCtrlKeys": true, - "vim.hlsearch": true, - "vim.insertModeKeyBindings": [ - { - "before": ["j", "j"], - "after": [""] - } - ], - "vim.handleKeys": { - "": false, - "": false - }, - "extensions.experimental.affinity": { - "vscodevim.vim": 1 - }, - "go.testTags": "all", - "go.buildTags": "all", - "editor.minimap.enabled": false, - "editor.quickSuggestionsDelay": 0, - "editor.suggestSelection": "first", - "editor.snippetSuggestions": "top", - "editor.gotoLocation.multipleReferences": "goto", - "editor.gotoLocation.multipleDefinitions": "goto", - "editor.gotoLocation.multipleDeclarations": "goto", - "editor.gotoLocation.multipleImplementations": "goto", - "editor.gotoLocation.multipleTypeDefinitions": "goto", - "editor.terminal.integrated.shell.linux": "/usr/bin/fish", - "terminal.integrated.sendKeybindingsToShell": true, - "terminal.integrated.fontFamily": "FiraMono Nerd Font Mono", - "workbench.colorTheme": "Dracula Soft", - "explorer.openEditors.visible": 1, - "files.trimTrailingWhitespace": true, - "files.trimFinalNewlines": true - }, - "extensions": [ - "golang.go", - "github.copilot", - "vscodevim.vim", - "ms-python.python", - "redhat.vscode-yaml", - "esbenp.prettier-vscode", - "ms-vscode.makefile-tools", - "ms-azuretools.vscode-docker", - "github.vscode-pull-request-github", - "ms-vscode-remote.remote-containers", - "visualstudioexptteam.vscodeintellicode", - "bierner.markdown-preview-github-styles" - ] - } - }, - "features": { - "ghcr.io/devcontainers/features/common-utils:2": { - "username": "vscode", - "userGid": "automatic", - "userUid": "automatic", - "upgradePackages": false, - "nonFreePackages": true - }, - "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { - "installDockerBuildx": true, - "dockerDashComposeVersion": "v2", - "version": "latest", - "moby": false - }, - "ghcr.io/devcontainers-contrib/features/kind:1": {} - }, - "postCreateCommand": "git submodule update --init --recursive; direnv allow", - "remoteUser": "vscode", - "forwardPorts": [1313, 2222, 6000, 7681, 8080], - "runArgs": ["--network=host"] -} - diff --git a/Dockerfile b/devcontainer/Dockerfile similarity index 100% rename from Dockerfile rename to devcontainer/Dockerfile diff --git a/devcontainer.json b/devcontainer/devcontainer.json similarity index 100% rename from devcontainer.json rename to devcontainer/devcontainer.json diff --git a/extra/Dockerfile b/devcontainer/extra/Dockerfile similarity index 100% rename from extra/Dockerfile rename to devcontainer/extra/Dockerfile diff --git a/extra/devcontainer.json b/devcontainer/extra/devcontainer.json similarity index 100% rename from extra/devcontainer.json rename to devcontainer/extra/devcontainer.json diff --git a/kind/devcontainer.json b/devcontainer/kind/devcontainer.json similarity index 100% rename from kind/devcontainer.json rename to devcontainer/kind/devcontainer.json diff --git a/frontmatter.json b/frontmatter.json deleted file mode 100644 index 561c5b4..0000000 --- a/frontmatter.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "$schema": "https://frontmatter.codes/frontmatter.schema.json" -} \ No newline at end of file