mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-03 20:12:59 +00:00
chore(ci): improve devcontainer UX
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
parent
b1b8d1570f
commit
6a7801e62a
18
.devcontainer/Dockerfile
Normal file
18
.devcontainer/Dockerfile
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
ARG GO_VERSION=1.24.3
|
||||||
|
ARG GOLANGCI_LINT_VERSION=2.1.6 # renovate: depName=golangci/golangci-lint datasource=github-releases
|
||||||
|
|
||||||
|
FROM golang:${GO_VERSION}
|
||||||
|
|
||||||
|
# install docker
|
||||||
|
RUN apt update && apt upgrade -y && apt-get install -y ca-certificates curl gnupg lsb-release jq zsh neovim && \
|
||||||
|
chsh -s $(which zsh) && \
|
||||||
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
|
||||||
|
|
||||||
|
|
||||||
|
RUN curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh && \
|
||||||
|
chmod +x install-opentofu.sh && \
|
||||||
|
./install-opentofu.sh --install-method deb && \
|
||||||
|
rm -f install-opentofu.sh
|
@ -3,26 +3,77 @@
|
|||||||
{
|
{
|
||||||
"name": "Default Linux Universal",
|
"name": "Default Linux Universal",
|
||||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||||
"image": "mcr.microsoft.com/devcontainers/go:1.24-bullseye",
|
// "image": "mcr.microsoft.com/devcontainers/go:1.24-bullseye",
|
||||||
|
// "image": "qmcgaw/godevcontainer:latest",
|
||||||
|
"dockerFile": "Dockerfile",
|
||||||
|
|
||||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers/features/terraform:1": {
|
"ghcr.io/devcontainers/features/terraform:1": {}
|
||||||
"version": "1.10.3"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"postAttachCommand": ["bash", "./.devcontainer/post-attach.sh"],
|
"mounts": [
|
||||||
|
// Zsh commands history persistence
|
||||||
|
{
|
||||||
|
"source": "${localEnv:HOME}/.zsh_history",
|
||||||
|
"target": "/root/.zsh_history",
|
||||||
|
"type": "bind"
|
||||||
|
},
|
||||||
|
// Git configuration file
|
||||||
|
{
|
||||||
|
"source": "${localEnv:HOME}/.gitconfig",
|
||||||
|
"target": "/root/.gitconfig",
|
||||||
|
"type": "bind"
|
||||||
|
},
|
||||||
|
// SSH directory for Linux, OSX and WSL
|
||||||
|
// On Linux and OSX, a symlink /mnt/ssh <-> ~/.ssh is
|
||||||
|
// created in the container. On Windows, files are copied
|
||||||
|
// from /mnt/ssh to ~/.ssh to fix permissions.
|
||||||
|
{
|
||||||
|
"source": "${localEnv:HOME}/.ssh",
|
||||||
|
"target": "/mnt/ssh",
|
||||||
|
"type": "bind"
|
||||||
|
},
|
||||||
|
// Docker socket to access the host Docker server
|
||||||
|
{
|
||||||
|
"source": "/var/run/docker.sock",
|
||||||
|
"target": "/var/run/docker.sock",
|
||||||
|
"type": "bind"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
// "forwardPorts": [],
|
// "forwardPorts": [],
|
||||||
|
|
||||||
// Configure tool-specific properties.
|
// Configure tool-specific properties.
|
||||||
// "customizations": {},
|
"customizations": {
|
||||||
|
// Configure properties specific to VS Code.
|
||||||
|
"vscode": {
|
||||||
|
// Set *default* container specific settings.json values on container create.
|
||||||
|
"settings": {
|
||||||
|
"go.toolsManagement.checkForUpdates": "local",
|
||||||
|
"go.useLanguageServer": true,
|
||||||
|
"go.gopath": "/go"
|
||||||
|
},
|
||||||
|
// Add the IDs of extensions you want installed when the container is created.
|
||||||
|
"extensions": [
|
||||||
|
"britesnow.vscode-toggle-quotes",
|
||||||
|
"davidanson.vscode-markdownlint",
|
||||||
|
"EditorConfig.editorconfig",
|
||||||
|
"golang.go",
|
||||||
|
"hashicorp.terraform",
|
||||||
|
"joshbolduc.commitlint",
|
||||||
|
"ms-azuretools.vscode-docker",
|
||||||
|
"ms-vscode.makefile-tools",
|
||||||
|
"psioniq.psi-header"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||||
// "remoteUser": "root"
|
"remoteUser": "root",
|
||||||
|
|
||||||
|
"postAttachCommand": ["bash", "./.devcontainer/post-attach.sh"],
|
||||||
|
|
||||||
// Use 'postCreateCommand' to run commands after the container is created.
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
"postCreateCommand": "make build"
|
"postCreateCommand": "make build"
|
||||||
|
@ -1,5 +1,22 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
# Display welcome banner
|
||||||
|
echo -e "\033[1;36m"
|
||||||
|
echo "════════════════════════════════════════════════════════════════════════════════════════════"
|
||||||
|
echo
|
||||||
|
echo " 🚀 Terraform Provider For Proxmox Development Environment"
|
||||||
|
echo
|
||||||
|
echo " ⚠️ EXPERIMENTAL"
|
||||||
|
echo " Use at your own risk! Some tools may be missing or not work as expected."
|
||||||
|
echo
|
||||||
|
echo " • Go Version: $(go version | cut -d' ' -f3 | sed 's/^go//')"
|
||||||
|
echo " • Terraform Version: $(terraform version -json | jq -r '.terraform_version')"
|
||||||
|
echo " • OpenTofu Version: $(tofu version -json | jq -r '.terraform_version')"
|
||||||
|
echo " • Working Directory: $(pwd)"
|
||||||
|
echo
|
||||||
|
echo "════════════════════════════════════════════════════════════════════════════════════════════"
|
||||||
|
echo -e "\033[0m"
|
||||||
|
|
||||||
# Workaround for https://github.com/orgs/community/discussions/75161
|
# Workaround for https://github.com/orgs/community/discussions/75161
|
||||||
unset GIT_COMMITTER_NAME
|
unset GIT_COMMITTER_NAME
|
||||||
unset GIT_COMMITTER_EMAIL
|
unset GIT_COMMITTER_EMAIL
|
||||||
|
3
.vscode/extensions.json
vendored
3
.vscode/extensions.json
vendored
@ -7,6 +7,7 @@
|
|||||||
"hashicorp.terraform",
|
"hashicorp.terraform",
|
||||||
"joshbolduc.commitlint",
|
"joshbolduc.commitlint",
|
||||||
"PKief.material-icon-theme",
|
"PKief.material-icon-theme",
|
||||||
"psioniq.psi-header"
|
"psioniq.psi-header",
|
||||||
|
"ms-azuretools.vscode-docker"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
4
Makefile
4
Makefile
@ -112,8 +112,8 @@ testacc:
|
|||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint:
|
lint:
|
||||||
# NOTE: This target is for local runs only. For linting in CI see .github/workflows/golangci-lint.yml
|
# NOTE: This target is for local runs only. For linting in CI see .github/workflows/golangci-lint.yml
|
||||||
@docker run -t --rm -v $$(pwd):/app -v ~/.cache/golangci-lint/$(GOLANGCI_LINT_VERSION):/root/.cache -w /app golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) golangci-lint fmt
|
golangci-lint fmt
|
||||||
@docker run -t --rm -v $$(pwd):/app -v ~/.cache/golangci-lint/$(GOLANGCI_LINT_VERSION):/root/.cache -w /app golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) golangci-lint run --fix
|
golangci-lint run --fix
|
||||||
|
|
||||||
.PHONY: release-build
|
.PHONY: release-build
|
||||||
release-build:
|
release-build:
|
||||||
|
Loading…
Reference in New Issue
Block a user