Skip to content

Commit b9523fd

Browse files
petemsclaude
andcommitted
feat: implement comprehensive DevOps workflows and fix GitHub Actions
- Add enterprise-grade DevOps workflows with security, monitoring, and infrastructure testing - Fix Dependencies workflow to prevent PR creation failures on tag pushes - Enhance CI workflow with multi-OS testing (Ubuntu, macOS, Windows) and SBOM generation - Add comprehensive security scanning with TruffleHog, Gosec, and vulnerability checks - Implement infrastructure testing across Terraform versions 1.0-1.9 - Add monitoring workflow with daily health checks and failure notifications - Create semantic release workflow with automated changelog generation - Enhance Makefile with 15+ DevOps targets for local development - Add development container configuration with VS Code integration - Implement pre-commit hooks for quality gates and security checks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b15443f commit b9523fd

10 files changed

Lines changed: 1034 additions & 9 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "Terraform Provider ExtIP Development",
3+
"image": "mcr.microsoft.com/devcontainers/go:1.24",
4+
5+
"features": {
6+
"ghcr.io/devcontainers/features/terraform:1": {
7+
"version": "1.9"
8+
},
9+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
10+
"ghcr.io/devcontainers/features/github-cli:1": {}
11+
},
12+
13+
"customizations": {
14+
"vscode": {
15+
"extensions": [
16+
"golang.go",
17+
"hashicorp.terraform",
18+
"ms-vscode.vscode-json",
19+
"redhat.vscode-yaml",
20+
"github.vscode-pull-request-github",
21+
"streetsidesoftware.code-spell-checker",
22+
"ms-vscode.makefile-tools"
23+
],
24+
"settings": {
25+
"go.toolsManagement.checkForUpdates": "local",
26+
"go.useLanguageServer": true,
27+
"go.lintOnSave": "package",
28+
"go.formatTool": "goimports",
29+
"terraform.experimentalFeatures.validateOnSave": true,
30+
"terraform.experimentalFeatures.prefillRequiredFields": true
31+
}
32+
}
33+
},
34+
35+
"onCreateCommand": "bash .devcontainer/setup.sh",
36+
37+
"postCreateCommand": [
38+
"go mod download",
39+
"make ci-setup"
40+
],
41+
42+
"remoteUser": "vscode",
43+
44+
"mounts": [
45+
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
46+
],
47+
48+
"forwardPorts": [],
49+
50+
"containerEnv": {
51+
"TF_PLUGIN_CACHE_DIR": "/tmp/.terraform-plugin-cache",
52+
"CHECKPOINT_DISABLE": "1"
53+
}
54+
}

.devcontainer/setup.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "🚀 Setting up Terraform Provider ExtIP development environment..."
5+
6+
# Install development tools
7+
echo "📦 Installing development tools..."
8+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2
9+
go install github.com/securecode/gosec/v2/cmd/gosec@latest
10+
go install golang.org/x/vuln/cmd/govulncheck@latest
11+
go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest
12+
go install github.com/goreleaser/goreleaser@latest
13+
14+
# Install pre-commit if available
15+
if command -v pip >/dev/null 2>&1; then
16+
echo "🪝 Installing pre-commit..."
17+
pip install pre-commit
18+
pre-commit install || echo "Pre-commit hooks will be set up when you first commit"
19+
fi
20+
21+
# Create necessary directories
22+
echo "📁 Creating cache directories..."
23+
mkdir -p /tmp/.terraform-plugin-cache
24+
mkdir -p ~/.terraform.d/plugins
25+
26+
# Verify installations
27+
echo "✅ Verifying installations..."
28+
go version
29+
terraform version
30+
golangci-lint version
31+
gosec --version || echo "gosec installed"
32+
govulncheck -version || echo "govulncheck installed"
33+
tfplugindocs version || echo "tfplugindocs installed"
34+
35+
echo "🎉 Development environment setup complete!"
36+
echo ""
37+
echo "Available commands:"
38+
echo " make help - Show all available make targets"
39+
echo " make pre-commit - Run pre-commit checks"
40+
echo " make test - Run tests"
41+
echo " make ci-test - Run full CI test suite"
42+
echo " make security-scan - Run security scans"
43+
echo ""

.github/workflows/ci.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,18 @@ permissions:
2222
jobs:
2323
test:
2424
name: Test
25-
runs-on: ubuntu-latest
25+
runs-on: ${{ matrix.os }}
2626
strategy:
2727
fail-fast: false
2828
matrix:
2929
go-version: [1.22, 1.23, 1.24]
30+
os: [ubuntu-latest]
31+
include:
32+
# Test on additional OS only for latest Go version
33+
- go-version: 1.24
34+
os: macos-latest
35+
- go-version: 1.24
36+
os: windows-latest
3037

3138
steps:
3239
- name: Checkout code
@@ -92,7 +99,8 @@ jobs:
9299
path: |
93100
~/.terraform.d/plugins
94101
~/.terraform.d/plugin-cache
95-
key: terraform-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
102+
~/.cache/terraform
103+
key: terraform-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-v2
96104
restore-keys: |
97105
terraform-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-
98106
terraform-${{ runner.os }}-
@@ -262,6 +270,20 @@ jobs:
262270
run: |
263271
govulncheck ./...
264272
273+
- name: Generate SBOM
274+
uses: anchore/sbom-action@v0
275+
with:
276+
path: .
277+
format: spdx-json
278+
output-file: sbom.spdx.json
279+
280+
- name: Upload SBOM
281+
uses: actions/upload-artifact@v4
282+
with:
283+
name: sbom-${{ github.sha }}
284+
path: sbom.spdx.json
285+
retention-days: 30
286+
265287
validate:
266288
name: Validate
267289
runs-on: ubuntu-latest

.github/workflows/dependencies.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
run: |
4545
# Get current versions
4646
go list -mod=readonly -m all > current_modules.txt
47-
47+
4848
# Check for updates
4949
if go list -mod=readonly -u -m all | grep -E '\[.*\]'; then
5050
echo "Updates available"
@@ -67,29 +67,30 @@ jobs:
6767
make test-short
6868
6969
- name: Create Pull Request
70-
if: steps.check.outputs.has_updates == 'true'
70+
if: steps.check.outputs.has_updates == 'true' && github.ref_type == 'branch'
7171
uses: peter-evans/create-pull-request@v6
7272
with:
7373
token: ${{ secrets.GITHUB_TOKEN }}
7474
commit-message: 'chore: update dependencies'
7575
title: 'chore: update dependencies'
7676
body: |
7777
## Dependency Updates
78-
78+
7979
This PR updates Go dependencies to their latest versions.
80-
80+
8181
### Changes
8282
- Updated Go modules to latest compatible versions
8383
- Ran `go mod tidy` to clean up dependencies
8484
- Updated vendor directory
8585
- Verified tests still pass
86-
86+
8787
### Testing
8888
- [x] Basic tests pass
8989
- [ ] Full integration tests pass
9090
- [ ] Security scan passes
9191
branch: chore/update-dependencies
9292
delete-branch: true
93+
base: ${{ github.head_ref || github.ref_name }}
9394

9495
security-scan:
9596
name: Security Scan
@@ -169,12 +170,12 @@ jobs:
169170
# Ensure govulncheck is available
170171
export PATH="$HOME/go/bin:$PATH"
171172
govulncheck -json ./... > vuln-report.json || true
172-
173+
173174
# Check for vulnerabilities
174175
if [ -s vuln-report.json ] && jq -e '.Vulns[]?' vuln-report.json > /dev/null 2>&1; then
175176
echo "❌ Vulnerabilities found in dependencies!"
176177
jq '.Vulns[] | {Package: .PkgPath, Vulnerability: .OSV.id, Summary: .OSV.summary}' vuln-report.json
177178
exit 1
178179
else
179180
echo "✅ No known vulnerabilities found in dependencies"
180-
fi
181+
fi

0 commit comments

Comments
 (0)