Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
PACKNAME=example
PACKNAME=example-plugin
BUILD_FLAGS=-X 'main.GitCommitHash=`git rev-parse --short HEAD`' -X 'main.BuiltAt=`date +%FT%T%z`'
BUILD_WIN=@env GOOS=windows GOARCH=amd64 go build -o $(PACKNAME).exe
BUILD_LINUX=@env GOOS=linux GOARCH=amd64 go build -o $(PACKNAME)
BUILD_MAC=@env GOOS=darwin GOARCH=amd64 go build -o $(PACKNAME)-darwin

release: go-package go-release go-bin
release-candidate: go-package go-release-candidate
binary: go-package go-build
release: package release bin
release-candidate: package release-candidate
binary: package build

go-release: release-nix release-win release-mac
release: release-nix release-win release-mac

go-build:
build:
@echo " > Building binary ..."
@go build -o $(PACKNAME) -ldflags="$(BUILD_FLAGS)"

go-package: go-tidy go-test
package: tidy test
@echo " > Packaging static files..."

go-test:
test:
@echo " > Validating code ..."
@go vet ./...
@go clean -testcache
@go test ./...

go-tidy:
tidy:
@echo " > Tidying go.mod ..."
@go mod tidy

go-test-cov:
test-cov:
@echo "Running tests and generating coverage output ..."
@go test ./... -coverprofile coverage.out -covermode count
@sleep 2 # Sleeping to allow for coverage.out file to get generated
@echo "Current test coverage : $(shell go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+') %"

go-release-candidate: go-tidy go-test
release-candidate: tidy test
@echo " > Building release candidate for Linux..."
$(BUILD_LINUX) -ldflags="$(BUILD_FLAGS) -X 'main.VersionPostfix=nix-rc'"
@echo " > Building release candidate for Windows..."
Expand All @@ -53,5 +53,5 @@ release-mac:
@echo " > Building release for Darwin..."
$(BUILD_MAC) -ldflags="$(BUILD_FLAGS) -X 'main.VersionPostfix=darwin'"

go-bin:
bin:
@mv $(PACKNAME)* ~/privateer/bin
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Privateer Plugin example
# Privateer Plugin example-plugin

This wireframe is designed to quickly get your service pack repository up to speed!

Expand Down
65 changes: 0 additions & 65 deletions armory/armory.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,112 +11,47 @@ var (
"tlp_amber": {
CCC_C01_TR01,
CCC_C01_TR02,
CCC_C02_TR01,
CCC_C03_TR01,
CCC_C03_TR02,
CCC_C03_TR03,
CCC_C03_TR04,
CCC_C03_TR05,
CCC_C03_TR06,
CCC_C04_TR01,
CCC_C04_TR02,
CCC_C05_TR01,
CCC_C05_TR02,
CCC_C05_TR03,
CCC_C05_TR04,
CCC_C06_TR01,
CCC_C06_TR02,
CCC_C07_TR02,
CCC_C08_TR01,
CCC_C08_TR02,
CCC_C09_TR01,
CCC_C09_TR02,
CCC_C09_TR03,
CCC_C10_TR01,
CCC_C11_TR01,
CCC_C11_TR02,
CCC_C11_TR03,
CCC_C11_TR04,
CCC_VPC_C01_TR01,
CCC_VPC_C03_TR01,
CCC_VPC_C04_TR01,
},
"tlp_clear": {
CCC_C01_TR01,
CCC_C01_TR02,
CCC_C02_TR01,
CCC_C03_TR01,
CCC_C03_TR04,
CCC_C03_TR06,
CCC_C04_TR02,
CCC_C05_TR02,
CCC_C05_TR04,
CCC_C06_TR01,
CCC_C06_TR02,
CCC_C07_TR02,
CCC_C09_TR01,
CCC_C09_TR02,
CCC_C09_TR03,
CCC_C11_TR01,
CCC_C11_TR02,
},
"tlp_green": {
CCC_C01_TR01,
CCC_C01_TR02,
CCC_C02_TR01,
CCC_C03_TR01,
CCC_C03_TR04,
CCC_C03_TR06,
CCC_C04_TR02,
CCC_C05_TR02,
CCC_C05_TR04,
CCC_C06_TR01,
CCC_C06_TR02,
CCC_C07_TR02,
CCC_C08_TR01,
CCC_C08_TR02,
CCC_C09_TR01,
CCC_C09_TR02,
CCC_C09_TR03,
CCC_C10_TR01,
CCC_C11_TR01,
CCC_C11_TR02,
CCC_VPC_C03_TR01,
},
"tlp_red": {
CCC_C01_TR01,
CCC_C01_TR02,
CCC_C02_TR01,
CCC_C03_TR01,
CCC_C03_TR02,
CCC_C03_TR03,
CCC_C03_TR04,
CCC_C03_TR05,
CCC_C03_TR06,
CCC_C04_TR01,
CCC_C04_TR02,
CCC_C05_TR01,
CCC_C05_TR02,
CCC_C05_TR03,
CCC_C05_TR04,
CCC_C06_TR01,
CCC_C06_TR02,
CCC_C07_TR01,
CCC_C07_TR02,
CCC_C08_TR01,
CCC_C08_TR02,
CCC_C09_TR01,
CCC_C09_TR02,
CCC_C09_TR03,
CCC_C10_TR01,
CCC_C11_TR01,
CCC_C11_TR02,
CCC_C11_TR03,
CCC_C11_TR04,
CCC_VPC_C01_TR01,
CCC_VPC_C02_TR01,
CCC_VPC_C03_TR01,
CCC_VPC_C04_TR01,
},
},
}
Expand Down
8 changes: 4 additions & 4 deletions armory/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ func ExampleTestSet01() (testSetName string, result pluginkit.TestSetResult) {
}

// ExampleTest0101 does not apply a change to the system
func ExampleTest0101() (moveResult pluginkit.TestResult) {
func ExampleTest0101() (testResult pluginkit.TestResult) {
// Pretend we're making some API call or other logic to determine if the test is applicable
customLogicResults := true

moveResult = pluginkit.TestResult{
testResult = pluginkit.TestResult{
Description: "Making an API call to see if HTTPS is enforced.",
Function: utils.CallerPath(0), // This allows interested users to jump directly to the code that is executing this test
Passed: customLogicResults,
Expand All @@ -61,7 +61,7 @@ func ExampleTest0101() (moveResult pluginkit.TestResult) {

// ExampleTest0102 applies an invasive change to the system. Not all changes are invasive, but this one is.
// Use ExecuteInvasiveTest() to ensure it is run only when the user has opted in to potentially destructive changes.
func ExampleTest0102() (moveResult pluginkit.TestResult) {
func ExampleTest0102() (testResult pluginkit.TestResult) {
// The functions here can be defined whereever you like
// If you have a lot of changes or plan to reuse them, you may want to put them in a separate file
change1 := pluginkit.NewChange(
Expand All @@ -84,7 +84,7 @@ func ExampleTest0102() (moveResult pluginkit.TestResult) {
change1.Revert()

// Note that we are not setting Passed to true or false. That will be determined by ExecuteTest() or ExecuteInvasiveTest()
moveResult = pluginkit.TestResult{
testResult = pluginkit.TestResult{
Description: "Making an API call to see if HTTPS is enforced.",
Function: utils.CallerPath(0), // This allows interested users to jump directly to the code that is executing this test
Changes: map[string]*pluginkit.Change{
Expand Down
Loading