-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding CI/CD security features and version CLI command #39
base: master
Are you sure you want to change the base?
Conversation
…-fork Signed-off-by: Nicolas-Peiffer <[email protected]> Add LDFlags in ko in goreleaser and change base image and repo env var Signed-off-by: Nicolas-Peiffer <[email protected]> Update Makefile Signed-off-by: Nicolas-Peiffer <[email protected]> Update Makefile LDFLAG Signed-off-by: Nicolas-Peiffer <[email protected]> Update ldflags field in goreleaser Makefile Signed-off-by: Nicolas-Peiffer <[email protected]> Update to ko action v0.7 Signed-off-by: Nicolas-Peiffer <[email protected]> Fix gitignore and add version CLI command Update README for container as an experimental feature Signed-off-by: Nicolas-Peiffer <[email protected]>
Great contribution ! Thank you. ./k8s-kms-plugin version
panic: 67dde6b is not in dotted-tri format
goroutine 1 [running]:
github.com/coreos/go-semver/semver.Must(...)
/go/pkg/mod/github.com/coreos/[email protected]/semver/semver.go:65
github.com/coreos/go-semver/semver.New({0xbce8b8?, 0x0?})
/go/pkg/mod/github.com/coreos/[email protected]/semver/semver.go:49 +0x34
github.com/ThalesGroup/k8s-kms-plugin/cmd/k8s-kms-plugin/cmd.CreateJsonVersion()
/go/k8s-kms-plugin/cmd/k8s-kms-plugin/cmd/version.go:52 +0x25
github.com/ThalesGroup/k8s-kms-plugin/cmd/k8s-kms-plugin/cmd.generateOutput()
/go/k8s-kms-plugin/cmd/k8s-kms-plugin/cmd/version.go:94 +0xaf
github.com/ThalesGroup/k8s-kms-plugin/cmd/k8s-kms-plugin/cmd.init.func8(0xc0000df300?, {0xad76d4?, 0x4?, 0xad7670?})
/go/k8s-kms-plugin/cmd/k8s-kms-plugin/cmd/version.go:111 +0x78
github.com/spf13/cobra.(*Command).execute(0xfd7480, {0x1046e80, 0x0, 0x0})
/go/pkg/mod/github.com/spf13/[email protected]/command.go:987 +0xa91
github.com/spf13/cobra.(*Command).ExecuteC(0xfd6060)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
github.com/ThalesGroup/k8s-kms-plugin/cmd/k8s-kms-plugin/cmd.Execute()
/go/k8s-kms-plugin/cmd/k8s-kms-plugin/cmd/root.go:82 +0x10c
main.main()
/go/k8s-kms-plugin/cmd/k8s-kms-plugin/main.go:29 +0xf We should always have an output for the command |
Also check goreleaser DEPRECATED recipe :
|
…s issue ThalesGroup#40 Signed-off-by: Nicolas-Peiffer <[email protected]>
https://goreleaser.com/deprecations/#snapshotname_template Signed-off-by: Nicolas-Peiffer <[email protected]>
Signed-off-by: Nicolas-Peiffer <[email protected]>
Signed-off-by: Nicolas-Peiffer <[email protected]>
Signed-off-by: Nicolas-Peiffer <[email protected]>
Signed-off-by: Nicolas-Peiffer <[email protected]>
This has been fixed by 2a9cff0 Now the git describe --tags --always
1096c2e Notice
echo $LDFLAGS
-X 'github.com/ThalesGroup/k8s-kms-plugin/pkg/version.RawGitDescribe=1096c2e' -X 'github.com/ThalesGroup/k8s-kms-plugin/pkg/version.GitCommitIdLong=1096c2ea3777b389583b658fe6919645334bcdf6' -X 'github.com/ThalesGroup/k8s-kms-plugin/pkg/version.GitCommitIdShort=1096c2ea' -X 'github.com/ThalesGroup/k8s-kms-plugin/pkg/version.GoVersion=go version go1.23.4 linux/amd64' -X 'github.com/ThalesGroup/k8s-kms-plugin/pkg/version.BuildPlatform=x86_64' -X 'github.com/ThalesGroup/k8s-kms-plugin/pkg/version.BuildDate=2024-12-16T16:46:15+01:00' -X 'github.com/ThalesGroup/k8s-kms-plugin/pkg/version.GitCommitTimestamp=2024-12-16T16:04:01+01:00' Note: This particular JSON pretty print./dist/k8s-kms-plugin-linux-amd64_SNAPSHOT-1096c2e version -o json {
"k8s-kms-plugin-cli": {
"major": 1096,
"minor": 0,
"patch": 0,
"version": "1096c2e",
"gitCommitIdLong": "1096c2ea3777b389583b658fe6919645334bcdf6",
"gitCommitIdShort": "1096c2ea",
"gitCommitTimestamp": "2024-12-16T16:04:01+01:00",
"goVersion": "go version go1.23.4 linux/amd64",
"buildDate": "2024-12-16T16:46:15+01:00",
"buildPlatform": "x86_64"
}
} JSON without pretty print./dist/k8s-kms-plugin-linux-amd64_SNAPSHOT-1096c2e version -o json --pretty=false {"k8s-kms-plugin-cli":{"major":1096,"minor":0,"patch":0,"version":"1096c2e","gitCommitIdLong":"1096c2ea3777b389583b658fe6919645334bcdf6","gitCommitIdShort":"1096c2ea","gitCommitTimestamp":"2024-12-16T16:04:01+01:00","goVersion":"go version go1.23.4 linux/amd64","buildDate":"2024-12-16T16:46:15+01:00","buildPlatform":"x86_64"}} YAML./dist/k8s-kms-plugin-linux-amd64_SNAPSHOT-1096c2e version -o yaml k8s-kms-plugin-cli:
buildDate: "2024-12-16T16:46:15+01:00"
buildPlatform: x86_64
gitCommitIdLong: 1096c2ea3777b389583b658fe6919645334bcdf6
gitCommitIdShort: 1096c2ea
gitCommitTimestamp: "2024-12-16T16:04:01+01:00"
goVersion: go version go1.23.4 linux/amd64
major: 1096
minor: 0
patch: 0
version: 1096c2e Simple version STD OUT
pretty print flag only applies to JSON YAML
only support json and yaml as version output format
Here is another example:
./dist/k8s-kms-plugin-linux-amd64_SNAPSHOT-a289339 version
2024/12/16 16:03:59 ERROR Raw git describe --tags --always version is not parsable as semantic versioning. Set major, minor and patch to 0 raw_git_describe=a289339 error="Malformed version: a289339"
k8s-kms-plugin: v0.0.0 ./dist/k8s-kms-plugin-linux-amd64_SNAPSHOT-a289339 version -o json
2024/12/16 16:04:33 ERROR Raw git describe --tags --always version is not parsable as semantic versioning. Set major, minor and patch to 0 raw_git_describe=a289339 error="Malformed version: a289339" {
"k8s-kms-plugin-cli": {
"major": 0,
"minor": 0,
"patch": 0,
"version": "a289339",
"gitCommitIdLong": "a289339fd186df0b6f00a69681ce0ab9710b941c",
"gitCommitIdShort": "a289339f",
"gitCommitTimestamp": "2024-12-16T17:01:45+01:00",
"goVersion": "go version go1.23.4 linux/amd64",
"buildDate": "2024-12-16T17:02:02+01:00",
"buildPlatform": "x86_64"
}
} If the Example
|
And you need to provide a |
Signed-off-by: Nicolas-Peiffer <[email protected]>
I worked on the project on my own fork https://github.com/louison77/k8s-kms-plugin.
Indeed, I did the fork before renaming the original draft project from https://github.com/ThalesGroup/k8s-kms-plugin to https://github.com/ThalesGroup/k8s-kms-plugin-tmp, and before doing a clean move of the original
k8s-kms-plugin
project from its original repo on https://github.com/orgs/ThalesIgnite to its new repo https://github.com/ThalesGroup.Therefore, the states of commit hashes was messed up, and the pull request from https://github.com/louison77/k8s-kms-plugin was harder to merged. So we did a clean fork on @Nicolas-Peiffer profile, and incorporated the contributions from @louison77.
Proposed Changes
Types of Changes
These changes introduce a new feature with is a Github CI/CD workflow allowing the creation of release including artifacts signatures, provenance attestations.
Verification
These changes can be verified by tagging a commit and push the tag into Github. This tag will trigger the workflow which will creating release. For signing the artifacts, it is important to go on the Github project in the workflow previously triggered to sign manually the artifacts with OIDC authentication.
A verification of the provenance attestation is done in the pipeline but the detailed commands to verify the signatures are explained in the Readme file.
Testing
As it is CI/CD feature, there are no tests that covered it. But different examples are present on the fork project: https://github.com/louison77/k8s-kms-plugin.
Linked Issues
User-Facing Change
New command version:
Further Comments