Skip to content

Latest commit

 

History

History
101 lines (75 loc) · 5.1 KB

File metadata and controls

101 lines (75 loc) · 5.1 KB

Contributing Guide

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

Reporting Issues

  • 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.

Development

  • 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.

Building

  • 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

Testing

  1. Unit Testing locally

    • Go to root folder and run go test ./...
    • Go to lambda-extensions folder and run go test ./...
  2. 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.

Releasing the layers

Notes on AWS Lambda Layer Versions

  • Lambda layer versions are immutable.

    • Once a version (e.g., v10) is published, its code and content cannot be modified.
    • If changes are needed, you must publish a new version (e.g., v11).
  • Once you delete a Lambda layer version (like v10), it’s permanently gone.

    • You cannot reuse or re-publish that same version number.
    • Any new Lambda function or update trying to reference v10 will fail.
  • Existing Lambda functions that were already using v10 may still run for a while, because AWS caches the layer code internally.

    • However, once you update or redeploy them, v10 will no longer be available.

Releasing layer for Commercial AWS

  1. Change the AWS_PROFILE environment variable using below command. The profile should point to sumocontent aws account. export AWS_PROFILE=<sumo content profile>
  2. Update the layer version in config/version.go.
  3. Go to scripts folder cd scripts/
  4. Change the layer_name variable in zip.sh to avoid replacing the prod.
  5. Run the following command to publish the layer: sh zip.sh
  6. The zip file generated by previous step should have extensions folder in it, which should consist of the binary for the extension.
  7. Run the following command to verify that the layer version is published across regions: sh verify_layer_versions.sh

Releasing layer for EUSC (European Sovereign Cloud) AWS

We have a separate EUSC production AWS account where we need to publish the layer.

  1. Get the EUSC AWS access key ID and secret access key via the dev CLI: dev hcvault login dev hcvault cli_env -a esc-production
  2. Set the AWS_PROFILE_EUSC environment variable using the command below. The profile should point to the EUSC production AWS account. export AWS_PROFILE_EUSC=<eusc production profile>
  3. Update the layer version in config/version.go.
  4. Go to scripts folder cd scripts/
  5. Change the layer_name variable in zip.sh to avoid replacing the prod.
  6. Run the following command to publish the layer: sh zip_special_partitions.sh
  7. The zip file generated by previous step should have extensions folder in it, which should consist of the binary for the extension.

Github Release

  • 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 and sumologic-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.

Upgrading to new golang versions

  1. Make sure to install new go version. Preferably use gvm.
  2. Update golang version in go.mod or run command go mod edit -go <version ex 1.22>.
  3. Run go mod tidy. This will update go.sum file and clean up unwanted dependencies.
  4. Install golangci-lint by running command brew install golangci-lint. Go to lambda-extensions directory and run golangci-lint run, this will check for deprecated methods. Check enabled linters using golangci-lint linters command.
  5. Install govulncheck by running command go 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.
  6. Run go test ./... to run the unit tests