First of all, thanks for contributing!. Before contributing please read the CODE_OF_CONDUCT and search the issue tracker; your issue may have already been discussed
-
If you think you've found an issue with the extension, you can open a Github issue.
-
Feel free to reach out to us at sumodojo.slack.com.
- Fork the repo 🎉
- Create a feature branch. ☕
- Run unit tests and confirm that it passes. ⚡
- Commit your changes. 📝
- Rebase your local changes against the master branch. 💡
- Create new Pull Request.
-
To install build related dependencies use below command
env GO111MODULE=off go install <package>
. -
Always use
go mod tidy
to clean up unwanted dependencies. -
To generate the binary use below command
go build -o target/extensions/sumologic-extension lambda-extensions/sumologic-extension.go
-
Unit Testing locally
- Go to root folder and run
go test ./...
- Go to lambda-extensions folder and run
go test ./...
- Go to root folder and run
-
Testing with Lambda function
Add the layer arn generated from build command output to your lambda function by following instructions in docs.Test by running the function manually. Confirm that logs are coming to Sumo Logic.
- Change the AWS_PROFILE environment variable using below command. The profile should point to sumocontent aws account.
export AWS_PROFILE=<sumo content profile>
- Update the layer version in config/version.go.
- Go to scripts folder
cd scripts/
- Change the layer_name variable in zip.sh to avoid replacing the prod.
- Run below command
sh zip.sh
-
The new extension binary and zip files gets released automatically after the tags are pushed using Github actions(Refer tagged-release in https://github.com/marvinpinto/action-automatic-releases).
Run below commands to create and push tags
git tag -a v<major.minor.patch> <commit_id>
git push origin v<major.minor.patch>
-
Add the
sumologic-extension-amd64.tar.gz
andsumologic-extension-arm64.tar.gz
files manually from the target folder generated after running zip.sh. -
Update the release description with new layer arns and more details on what's changed.
- Make sure to install new go version. Preferably use gvm.
- Update golang version in
go.mod
or run commandgo mod edit -go <version ex 1.22>
. - Run
go mod tidy
. This will updatego.sum
file and clean up unwanted dependencies. - Install
golangci-lint
by running commandbrew install golangci-lint
. Go tolambda-extensions
directory and rungolangci-lint run
, this will check for deprecated methods. Check enabled linters usinggolangci-lint linters
command. - Install
govulncheck
by running commandgo install golang.org/x/vuln/cmd/govulncheck@latest
and run~/go/bin/govulncheck -mode=binary target/amd64/extensions/sumologic-extension
. this will find common security issues. - Run
go test ./...
to run the unit tests