Skip to content

Commit 4bd3ea8

Browse files
committed
feat: first implementation
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
1 parent 737d331 commit 4bd3ea8

10 files changed

Lines changed: 1973 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build and Upload Artifacts
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-go@v5
12+
- name: Run GoReleaser
13+
uses: goreleaser/goreleaser-action@v6
14+
with:
15+
# 'latest', 'nightly', or a semver
16+
version: '~> v2'
17+
args: release --clean
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
- name: Install gooci cli
21+
run: go install github.com/compliance-framework/gooci@latest
22+
- name: Authenticate gooci cli
23+
run: gooci login ghcr.io --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}
24+
- name: gooci Upload Version
25+
run: gooci upload dist/ ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{github.ref_name}}
26+
- name: gooci Upload Latest
27+
if: "!github.event.release.prerelease"
28+
run: gooci upload dist/ ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest

.github/workflows/push.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Push
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- '*'
8+
9+
jobs:
10+
test:
11+
permissions:
12+
contents: read
13+
uses: ./.github/workflows/test.yml

.github/workflows/release.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: New Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
release:
10+
permissions:
11+
packages: write
12+
contents: write
13+
uses: ./.github/workflows/build-and-upload.yml

.github/workflows/test.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Go Test
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-go@v5
13+
14+
- name: Test
15+
run: go test ./...

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
policies

Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# The help target prints out all targets with their descriptions organized
2+
# beneath their categories. The categories are represented by '##@' and the
3+
# target descriptions by '##'. The awk commands is responsible for reading the
4+
# entire set of makefiles included in this invocation, looking for lines of the
5+
# file as xyz: ## something, and then pretty-format the target and help. Then,
6+
# if there's a line with ##@ something, that gets pretty-printed as a category.
7+
# More info on the usage of ANSI catalog characters for terminal formatting:
8+
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
9+
# More info on the awk command:
10+
# http://linuxcommand.org/lc3_adv_awk.php
11+
12+
# Check if OPA CLI is installed
13+
OPA := $(shell command -v opa 2> /dev/null)
14+
ifeq ($(OPA),)
15+
$(error "opa CLI not found. Please install it: https://www.openpolicyagent.org/docs/latest/cli/")
16+
endif
17+
18+
##@ Help
19+
help: ## Display this concise help, ie only the porcelain target
20+
@awk 'BEGIN {FS = ":.*##"; printf "\033[1mUsage\033[0m\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-30s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
21+
22+
help-all: ## Display all help items, ie including plumbing targets
23+
@awk 'BEGIN {FS = ":.*#"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?#/ { printf " \033[36m%-25s\033[0m %s\n", $$1, $$2 } /^#@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
24+
25+
26+
27+
28+
# Bundle the policies into a tarball for OCI registry
29+
clean: # Cleanup build artifacts
30+
@rm -rf dist/*
31+
32+
build: clean ## Build the policy bundle
33+
@mkdir -p dist/
34+
@go build -o dist/plugin main.go

go.mod

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
module github.com/compliance-framework/plugin-cloud-custodian
2+
3+
go 1.25.7
4+
5+
require (
6+
github.com/compliance-framework/agent v0.2.1
7+
github.com/hashicorp/go-hclog v1.6.3
8+
github.com/hashicorp/go-plugin v1.7.0
9+
github.com/mitchellh/mapstructure v1.5.0
10+
)
11+
12+
require (
13+
github.com/OneOfOne/xxhash v1.2.8 // indirect
14+
github.com/agnivade/levenshtein v1.2.0 // indirect
15+
github.com/beorn7/perks v1.0.1 // indirect
16+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
17+
github.com/compliance-framework/api v0.4.4 // indirect
18+
github.com/defenseunicorns/go-oscal v0.6.3 // indirect
19+
github.com/fatih/color v1.18.0 // indirect
20+
github.com/go-ini/ini v1.67.0 // indirect
21+
github.com/go-logr/logr v1.4.3 // indirect
22+
github.com/go-logr/stdr v1.2.2 // indirect
23+
github.com/go-viper/mapstructure/v2 v2.3.0 // indirect
24+
github.com/gobwas/glob v0.2.3 // indirect
25+
github.com/golang/protobuf v1.5.4 // indirect
26+
github.com/google/uuid v1.6.0 // indirect
27+
github.com/gorilla/mux v1.8.1 // indirect
28+
github.com/hashicorp/yamux v0.1.2 // indirect
29+
github.com/mattn/go-colorable v0.1.14 // indirect
30+
github.com/mattn/go-isatty v0.0.20 // indirect
31+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
32+
github.com/oklog/run v1.2.0 // indirect
33+
github.com/open-policy-agent/opa v1.0.0 // indirect
34+
github.com/prometheus/client_golang v1.20.5 // indirect
35+
github.com/prometheus/client_model v0.6.1 // indirect
36+
github.com/prometheus/common v0.57.0 // indirect
37+
github.com/prometheus/procfs v0.15.1 // indirect
38+
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
39+
github.com/sirupsen/logrus v1.9.3 // indirect
40+
github.com/tchap/go-patricia/v2 v2.3.1 // indirect
41+
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
42+
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
43+
github.com/yashtewari/glob-intersection v0.2.0 // indirect
44+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
45+
go.opentelemetry.io/otel v1.37.0 // indirect
46+
go.opentelemetry.io/otel/metric v1.37.0 // indirect
47+
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
48+
go.opentelemetry.io/otel/trace v1.37.0 // indirect
49+
golang.org/x/net v0.43.0 // indirect
50+
golang.org/x/sys v0.35.0 // indirect
51+
golang.org/x/text v0.28.0 // indirect
52+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250826171959-ef028d996bc1 // indirect
53+
google.golang.org/grpc v1.75.0 // indirect
54+
google.golang.org/protobuf v1.36.8 // indirect
55+
gopkg.in/yaml.v3 v3.0.1 // indirect
56+
sigs.k8s.io/yaml v1.4.0 // indirect
57+
)

0 commit comments

Comments
 (0)