Skip to content

Commit 36b6ae9

Browse files
authored
fix: add initial implementation of the plugin (#1)
* fix: initial * fix: linter * fix: pr code coverage
1 parent 713d0b8 commit 36b6ae9

File tree

11 files changed

+763
-0
lines changed

11 files changed

+763
-0
lines changed

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'gomod'
4+
directory: '/'
5+
schedule:
6+
interval: weekly
7+
day: monday
8+
timezone: Europe/London
9+
open-pull-requests-limit: 50
10+
assignees:
11+
- dnitsch
12+
- elvenspellmaker
13+
rebase-strategy: disabled
14+
groups:
15+
low-risk:
16+
applies-to: version-updates
17+
update-types:
18+
- "minor"
19+
- "patch"

.github/workflows/build.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
permissions:
8+
contents: write
9+
statuses: write
10+
checks: write
11+
pull-requests: write
12+
13+
jobs:
14+
set-version:
15+
name: Set Version
16+
runs-on: ubuntu-latest
17+
container:
18+
image: mcr.microsoft.com/dotnet/sdk:10.0
19+
outputs:
20+
semVer: ${{ steps.gitversion.outputs.semVer }}
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
- name: install deps
26+
run: |
27+
apt-get update && apt-get install -y jq git
28+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
29+
git config user.email ${{ github.actor }}-ci@gha.org
30+
git config user.name ${{ github.actor }}
31+
- name: Install GitVersion
32+
uses: gittools/actions/gitversion/setup@v4.1.0
33+
with:
34+
versionSpec: "6.x"
35+
- name: Set SemVer Version
36+
uses: gittools/actions/gitversion/execute@v4.1.0
37+
id: gitversion
38+
39+
- name: echo VERSIONS
40+
run: |
41+
echo "REVISION -> $GITHUB_SHA"
42+
echo "VERSION -> $GITVERSION_SEMVER"
43+
44+
test:
45+
runs-on: ubuntu-latest
46+
name: Run Tests
47+
needs: set-version
48+
env:
49+
SEMVER: ${{ needs.set-version.outputs.semVer }}
50+
GIT_TAG: ${{ needs.set-version.outputs.semVer }}
51+
GOVCS: false
52+
steps:
53+
- uses: actions/checkout@v4
54+
with:
55+
fetch-depth: 1
56+
57+
- name: Install Eirctl
58+
uses: ensono/actions/eirctl-setup@v0.3.1
59+
60+
- name: Run Lint
61+
run: |
62+
eirctl run pipeline lints
63+
- name: Run Tests
64+
run: |
65+
eirctl run pipeline gha:unit:test
66+
67+
- name: Publish Junit style Test Report
68+
uses: mikepenz/action-junit-report@v4
69+
if: always() # always run even if the previous step fails
70+
with:
71+
report_paths: "**/.coverage/report-junit.xml"
72+
73+
- name: Code Coverage Report
74+
uses: irongut/CodeCoverageSummary@v1.3.0
75+
with:
76+
filename: "**/.coverage/report-cobertura.xml"
77+
badge: true
78+
fail_below_min: false
79+
format: markdown
80+
hide_branch_rate: false
81+
hide_complexity: true
82+
indicators: true
83+
output: both
84+
thresholds: "60 80"
85+
86+
- name: Add Coverage PR Comment
87+
uses: marocchino/sticky-pull-request-comment@v2
88+
if: github.event_name == 'pull_request'
89+
with:
90+
recreate: true
91+
path: code-coverage-results.md

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
types:
7+
- completed
8+
branches:
9+
- master
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
set-version:
16+
name: Set Version
17+
runs-on: ubuntu-latest
18+
if: ${{ github.event.workflow_run.head_branch == 'master' && github.event.workflow_run.conclusion == 'success' }}
19+
container:
20+
image: mcr.microsoft.com/dotnet/sdk:10.0
21+
outputs:
22+
semVer: ${{ steps.gitversion.outputs.semVer }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
- name: install deps
28+
run: |
29+
apt-get update && apt-get install -y jq git
30+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
31+
git config user.email ${{ github.actor }}-ci@gha.org
32+
git config user.name ${{ github.actor }}
33+
- name: Install GitVersion
34+
uses: gittools/actions/gitversion/setup@v4.1.0
35+
with:
36+
versionSpec: "6.x"
37+
- name: Set SemVer Version
38+
uses: gittools/actions/gitversion/execute@v4.1.0
39+
id: gitversion
40+
with:
41+
overrideConfig: |
42+
next-version=3.0.0
43+
44+
release:
45+
name: Release
46+
runs-on: ubuntu-latest
47+
needs: set-version
48+
env:
49+
SEMVER: ${{ needs.set-version.outputs.semVer }}
50+
steps:
51+
- uses: actions/checkout@v4
52+
with:
53+
fetch-depth: 1
54+
55+
- name: Install Eirctl
56+
uses: ensono/actions/eirctl-setup@v0.3.1
57+
58+
- name: build binary
59+
run: |
60+
VERSION=${SEMVER} REVISION=$GITHUB_SHA eirctl run pipeline build:bin
61+
62+
- name: Release binary
63+
uses: softprops/action-gh-release@v2
64+
with:
65+
tag_name: v${{ needs.set-version.outputs.semVer }}
66+
# TODO: add additional info to the release
67+
generate_release_notes: true
68+
token: ${{ secrets.GITHUB_TOKEN }}
69+
files: ./dist/*
70+
prerelease: true
71+
72+
- name: release library
73+
run: |
74+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
75+
git config user.email ${{ github.actor }}-ci@gha.org
76+
git config user.name ${{ github.actor }}
77+
VERSION=${SEMVER} REVISION=$GITHUB_SHA eirctl run tag

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,11 @@ go.work.sum
3030
# Editor/IDE
3131
# .idea/
3232
# .vscode/
33+
34+
# Added ignores
35+
.eirctl
36+
.deps
37+
.configmanager
38+
dist/
39+
local/
40+
.coverage/

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# AWS ParameterStore Plugin
2+
3+
This is the `awsparamstr` implementation plugin built using the go-plugin architecture from hashicorp, it is used by the [ConfigManager](https://github.com/DevLabFoundry/configmanager) service.
4+
5+
## Token Prefix
6+
7+
This plugin uses the `AWSPARAMSTR` token prefix.

eirctl.yaml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
output: prefixed
2+
debug: false
3+
4+
import:
5+
- https://raw.githubusercontent.com/Ensono/eirctl/refs/tags/0.9.17/shared/build/go/eirctl.yaml
6+
- https://raw.githubusercontent.com/Ensono/eirctl/refs/tags/0.9.17/shared/security/eirctl.yaml
7+
8+
contexts:
9+
bash:
10+
container:
11+
name: mirror.gcr.io/bash:5.0.18-alpine3.22
12+
13+
go1xalpine:
14+
container:
15+
name: mirror.gcr.io/golang:1.26-alpine
16+
envfile:
17+
exclude:
18+
- GO
19+
- CXX
20+
- CGO
21+
22+
pipelines:
23+
unit:test:
24+
- pipeline: test:unit
25+
env:
26+
ROOT_PKG_NAME: github.com/DevLabFoundry/configmanager-plugin-awsparamstr
27+
28+
gha:unit:test:
29+
- pipeline: unit:test
30+
- task: sonar:coverage:prep
31+
depends_on: unit:test
32+
33+
code:coverage:
34+
- pipeline: unit:test
35+
- task: show_coverage
36+
depends_on: unit:test
37+
38+
build:bin:
39+
- task: clean
40+
- task: go:build:plugin
41+
env:
42+
PLUGIN: awsparamstr
43+
depends_on: clean
44+
45+
scan:plugins:
46+
- task: trivy:file:system:sbom
47+
48+
tasks:
49+
go:build:plugin:
50+
context: go1xalpine
51+
command:
52+
- |
53+
mkdir -p .deps
54+
unset GOTOOLCHAIN
55+
ldflags="-s -w -X \"main.Version=${VERSION}\" -X \"main.Revision=${REVISION}\" -extldflags -static"
56+
export GOPATH=/eirctl/.deps GOOS=${BUILD_GOOS} GOARCH=${BUILD_GOARCH} CGO_ENABLED=0
57+
go build -mod=readonly -buildvcs=false -ldflags="$ldflags" \
58+
-o dist/$PLUGIN-${BUILD_GOOS}-${BUILD_GOARCH}${BUILD_SUFFIX} main.go
59+
echo "---"
60+
echo "Built: $PLUGIN-${BUILD_GOOS}-${BUILD_GOARCH}${BUILD_SUFFIX}"
61+
reset_context: true
62+
variations:
63+
- BUILD_GOOS: darwin
64+
BUILD_GOARCH: amd64
65+
BUILD_SUFFIX: ""
66+
- BUILD_GOOS: darwin
67+
BUILD_GOARCH: arm64
68+
BUILD_SUFFIX: ""
69+
- BUILD_GOOS: linux
70+
BUILD_GOARCH: amd64
71+
BUILD_SUFFIX: ""
72+
- BUILD_GOOS: linux
73+
BUILD_GOARCH: arm64
74+
BUILD_SUFFIX: ""
75+
- BUILD_GOOS: windows
76+
BUILD_GOARCH: amd64
77+
BUILD_SUFFIX: ".exe"
78+
- BUILD_GOOS: windows
79+
BUILD_GOARCH: arm64
80+
BUILD_SUFFIX: ".exe"
81+
- BUILD_GOOS: windows
82+
BUILD_GOARCH: "386"
83+
BUILD_SUFFIX: ".exe"
84+
required:
85+
env:
86+
- PLUGIN
87+
88+
sonar:coverage:prep:
89+
context: bash
90+
command:
91+
- |
92+
sed -i 's|github.com/DevLabFoundry/configmanager/v3/||g' .coverage/out
93+
echo "Coverage file first 20 lines after conversion:"
94+
head -20 .coverage/out
95+
echo "Coverage file line count:"
96+
wc -l .coverage/out
97+
98+
tag:
99+
description: |
100+
Usage `eirctl tag GIT_TAG=2111dsfsdfa REVISION=as2342432`
101+
102+
command: |
103+
git tag -a ${VERSION} -m "ci tag release" ${REVISION}
104+
git push origin ${VERSION}
105+
required:
106+
env:
107+
- VERSION
108+
- REVISION

go.mod

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
module github.com/DevLabFoundry/configmanager-plugin-awsparamstr
2+
3+
go 1.26
4+
5+
toolchain go1.26.2
6+
7+
require (
8+
github.com/DevLabFoundry/configmanager/v3 v3.0.1-0.20260410185733-4b8db7d72c69
9+
github.com/aws/aws-sdk-go-v2/service/ssm v1.68.4
10+
github.com/hashicorp/go-hclog v1.6.3
11+
)
12+
13+
require (
14+
github.com/aws/aws-sdk-go-v2/credentials v1.19.14 // indirect
15+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 // indirect
16+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 // indirect
17+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 // indirect
18+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 // indirect
19+
github.com/aws/aws-sdk-go-v2/service/signin v1.0.9 // indirect
20+
github.com/aws/aws-sdk-go-v2/service/sso v1.30.15 // indirect
21+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19 // indirect
22+
github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 // indirect
23+
github.com/fatih/color v1.19.0 // indirect
24+
github.com/golang/protobuf v1.5.4 // indirect
25+
github.com/hashicorp/yamux v0.1.2 // indirect
26+
github.com/mattn/go-colorable v0.1.14 // indirect
27+
github.com/mattn/go-isatty v0.0.20 // indirect
28+
github.com/oklog/run v1.2.0 // indirect
29+
golang.org/x/net v0.52.0 // indirect
30+
golang.org/x/sys v0.42.0 // indirect
31+
golang.org/x/text v0.35.0 // indirect
32+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260406210006-6f92a3bedf2d // indirect
33+
google.golang.org/grpc v1.80.0 // indirect
34+
google.golang.org/protobuf v1.36.11 // indirect
35+
)
36+
37+
require (
38+
github.com/aws/aws-sdk-go-v2 v1.41.5
39+
github.com/aws/aws-sdk-go-v2/config v1.32.14
40+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect
41+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect
42+
github.com/aws/smithy-go v1.24.3 // indirect
43+
github.com/hashicorp/go-plugin v1.7.0
44+
)

0 commit comments

Comments
 (0)