Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into romain.marcadier/gls-…
Browse files Browse the repository at this point in the history
…enablement

# Conflicts:
#	.github/workflows/tests.yml
  • Loading branch information
RomainMuller committed Jul 15, 2024
2 parents 7a68a68 + 66b7af5 commit 45ac0c0
Show file tree
Hide file tree
Showing 63 changed files with 1,669 additions and 1,955 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/docsite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
branches: ['main']
push:
branches: [main]
paths: [docs/**]

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }}
Expand All @@ -29,7 +28,10 @@ jobs:
- name: Run go generate (builtin)
run: go generate ./internal/injector/builtin
- name: Build Site
run: go -C ./docs run github.com/gohugoio/hugo --minify --enableGitInfo
# Set environment to anything other than "production", as the theme we use adds SRI attributes to all CSS files,
# but datadoghq.dev is behind CloudFlare with auto-minify enabled; which breaks SRI if its minification is not
# identical to hugo's.
run: go -C ./docs run github.com/gohugoio/hugo --minify --enableGitInfo --environment=gh-pages
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ jobs:
needs: generate
runs-on: ubuntu-latest
if: always() && needs.generate.outputs.has-patch == 'true' && github.event_name == 'pull_request' && (github.event.pull_request.head.repo.full_name == github.repository || github.event.pull_request.maintainer_can_modify)
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
token: ${{ secrets.MUTATOR_GITHUB_TOKEN }}
persist-credentials: true
- name: Download patch
uses: actions/download-artifact@v4
with:
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release
on:
pull_request:
paths: ['internal/version/version.go']
push:
branches: ['main']
paths: ['internal/version/version.go']

jobs:
validate:
runs-on: ubuntu-latest
permissions:
contents: write # To be able to create draft releases
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
cache-dependency-path: '**/*.sum'

# Obtains the current configured version tag from source, and verifies it is a valid tag name.
# Also checks whether the tag already exists.
- name: Determine version
id: version
run: |-
set -euo pipefail
# From https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string, with added v prefix.
VERSION_TAG_REGEX='^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'
version=$(grep -E "${VERSION_TAG_REGEX}" <(go run . version))
echo "tag=${version}" >> "${GITHUB_OUTPUT}"
if gh release view "${version}" --json isDraft; then
echo "exists=true" >> "${GITHUB_OUTPUT}"
else
echo "exists=false" >> "${GITHUB_OUTPUT}"
fi
env:
GH_TOKEN: ${{ github.token }}

# If this is a pull request, and the release does not yet exist, the PR title must be "release: <tag>"
- name: 'Pull Request title must be "release: ${{ steps.version.outputs.tag }}"'
if: "github.event_name == 'pull_request' && !fromJSON(steps.version.outputs.exists) && format('release: {0}', steps.version.outputs.tag) != github.event.pull_request.title"
run: |-
echo 'Please update the PR title to "release: ${{ steps.version.outputs.tag }}" (instead of ${{ toJSON(github.event.pull_request.title) }})'
exit 1
# Release must not already exist (if the PR title suggests this is intended to be a release)
- name: Release ${{ steps.version.outputs.tag }} already exists
if: github.event_name == 'pull_request' && fromJSON(steps.version.outputs.exists) && startsWith(github.event.pull_request.title, 'release:')
run: |-
echo 'A release already exists for tag ${{ steps.version.outputs.tag }}. Please update to another version.'
exit 1
# If the release does not yet exist, create a draft release targeting this commit.
- name: Create draft release
if: github.event_name == 'push' && steps.version.outputs.exists == 'false'
run: |-
gh release create '${{ steps.version.outputs.tag }}' --draft --generate-notes --target='${{ github.sha }}' --title='${{ steps.version.outputs.tag }}' ${{ contains(steps.version.outputs.tag, '-') && '--prerelease' || '' }}
env:
GH_TOKEN: ${{ github.token }}
66 changes: 34 additions & 32 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ jobs:
cache-dependency-path: "**/*.sum"
- name: Run unit tests
run: |-
mkdir -p ./coverage
go test -cover -covermode=atomic -coverpkg=./... -coverprofile=coverage/unit.out -race ./...
mkdir -p coverage
go test -shuffle=on -cover -covermode=atomic -coverpkg=./... -coverprofile=${{ github.workspace }}/coverage/unit.out -race ./...
go -C _integration-tests test -shuffle=on -cover -covermode=atomic -coverpkg=./...,github.com/datadog/orchestrion/... -coverprofile=${{ github.workspace }}/coverage/integration.out -race ./...
- name: Determine simple go version
if: always() && github.event_name != 'merge_group'
id: simple-go-version
Expand All @@ -68,7 +69,7 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: go${{ steps.simple-go-version.outputs.version }},${{ runner.os }},${{ runner.arch }},unit
file: ./coverage/unit.out
files: ./coverage/unit.out,./coverage/integration.out
name: Unit Tests (go${{ matrix.go-version }})

integration-tests:
Expand Down Expand Up @@ -100,52 +101,53 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '>=3.9 <3.13'
cache: pip
cache-dependency-path: _integration-tests/utils/agent/requirements.txt
- name: Install python dependencies
run: pip install -r _integration-tests/utils/agent/requirements.txt
- name: Build orchestrion binary
run: go build -cover -covermode=atomic -coverpkg="./..." -o="bin/orchestrion.exe" .
- name: Run Integration Tests
shell: bash # PowerShell has different syntax for env. var access...
shell: bash
run: |-
# Without orchestrion enabled
go -C _integration-tests test -v ./...
# With orchestrion enabled
mkdir -p ${GOCOVERDIR}
go run -cover -covermode=atomic -coverpkg=./... . go -C _integration-tests test -v ./...
mkdir -p "${GOCOVERDIR}"
case "${{ matrix.build-mode }}" in
"DRIVER")
bin/orchestrion.exe go -C=_integration-tests test -shuffle=on ./...
;;
"TOOLEXEC")
go -C=_integration-tests test -shuffle=on -toolexec="${{ github.workspace }}/bin/orchestrion.exe toolexec" ./...
;;
"GOFLAGS")
export GOFLAGS="'-toolexec=${{ github.workspace }}/bin/orchestrion.exe toolexec' ${GOFLAGS}"
go -C=_integration-tests test -shuffle=on ./...
;;
*)
echo "Unknown build mode: ${{ matrix.build-mode }}"
exit 1
;;
esac
env:
GOCOVERDIR: ${{ github.workspace }}/coverage/raw
GOCACHE: ${{ runner.temp }}/gocache
- name: Run Integration Tests
run: ./integration-tests.ps1
env:
TESTCASE_BUILD_MODE: ${{ matrix.build-mode }}
GOFLAGS: -tags=integration,buildtag # Globally set build tags (buildtag is used by the dd-span test)
- name: Consolidate coverage report
if: always() && github.event_name != 'merge_group'
shell: bash # PowerShell mkdir -p fails if the directory already exists...
run: |-
mkdir -p ./coverage
go tool covdata textfmt -i ./coverage/raw,./_integration-tests/outputs/coverage -o ./coverage/integration.out
if: github.event_name != 'merge_group'
run: go tool covdata textfmt -i ./coverage/raw -o ./coverage/integration.out
- name: Determine simple go version
if: always() && github.event_name != 'merge_group'
if: github.event_name != 'merge_group'
id: simple-go-version
run: echo "::set-output name=version::${COMPLETE_VERSION:0:4}"
shell: bash
env:
COMPLETE_VERSION: ${{ matrix.go-version }}
- name: Upload coverage report
# We want this even if the tests failed
if: always() && github.event_name != 'merge_group'
if: github.event_name != 'merge_group'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: go${{ steps.simple-go-version.outputs.version }},${{ runner.os }},${{ runner.arch }},integration
file: ./coverage/integration.out
files: ./coverage/integration.out
name: Integration Tests (go${{ matrix.go-version }}, ${{ matrix.runs-on }}, ${{ matrix.build-mode }})
- name: Upload artifact
# We want this even if the tests failed
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.runs-on }}-tests-${{ matrix.go-version }}-${{ matrix.build-mode }}-output
path: _integration-tests/outputs
if-no-files-found: error # That would be very unexpected

# This is just a join point intended to simplify branch protection settings
complete:
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@

Automatic compile-time instrumentation of Go code

![Orchestrion](https://upload.wikimedia.org/wikipedia/commons/5/55/Welteorchestrion1862.jpg)

## Overview

Orchestrion processes Go source code at compilation time and automatically inserts instrumentation. This instrumentation
[Orchestrion](https://en.wikipedia.org/wiki/Orchestrion) processes Go source code at compilation time and automatically inserts instrumentation. This instrumentation
produces Datadog APM traces from the instrumented code and supports Datadog Application Security Management. Future work
will include support for OpenTelemetry tracing as well.

Expand Down
65 changes: 23 additions & 42 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,33 @@
# Release process

## Overview

The release process consists of creating a release branch, merging fixes to `main` **and** to the release branch, and releasing release candidates as things progress. Once a release candidate is stable, a final version can be released.

## Steps

### Create the release branch and the first release candidate

1. Checkout the repository on the correct branch and changeset (`main`).
2. Create a new release branch: `git checkout -b vX.Y`.
3. Add a tag for the first release candidate: `git tag vX.Y.Z-rc.1`.
4. Push the branch and tag.

1. Determine the new release's version number
- Follow [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html) semantics
+ Be mindful of the `v0.x.y` semantics!
- The placeholder `vX.Y.Z` is used to refer to the tag name including this version number in all
steps below
1. Check out the repository on the correct commit, which is most likely `origin/main`
```console
$ git push origin vX.Y
$ git push origin vX.Y.Z-rc.1
$ git fetch
$ git checkout origin/main -b ${USER}/release/vX.Y.Z
```
5. Bump the tag in the `internal/version/version.go` file in the main branch to the next minor pre-release version using the `-dev` pre-release suffix.

### Create a release candidate after a bug fix

**Note:** The fix must be merged to `main` and backported the release branch.

1. Update the release branch `vX.Y` locally by pulling the bug fix merged upstream (`git fetch`, `git pull`)
2. Modify the version string in `internal/version/version.go` to the release candidate version.
3. Add a tag for the new release candidate: `git tag vX.Y.Z-rc.W`.
4. Push the branch and tag.

1. Edit [`internal/version/version.go`](/internal/version/version.go) to set the `Tag` constant to
the new `vX.Y.Z` version
1. Commit the resulting changes
```console
$ git push origin vX.Y
$ git push origin vX.Y.Z-rc.W
$ git commit -m "release: vX.Y.Z" internal/version/version.go
```

### Release the final version

1. Update the release branch `vX.Y` locally by pulling any bug fixes merged upstream (`git fetch`, `git pull`)
2. Modify the version string in `internal/version/version.go` to the final version.
3. Add a final release tag: `git tag vX.Y.Z`.
4. Push the branch and tag.

1. Open a pull request
```console
$ git push origin vX.Y
$ git push origin vX.Y.Z-rc.W
$ gh pr create --web
```

5. Create a [GitHub release](https://github.com/DataDog/orchestrion/releases/new).
- Choose the version tag `vX.Y.Z`
- Set the release title to `vX.Y.Z`
- Click on `Generate release notes` for automatic release notes generation
- Click on `Publish release`
1. Get the PR reviewed by a colleague, ensure all CI passes including the _Release_ validations
1. Get the PR merged to `main` via the merge queue
1. Once merged, a draft release will automatically be created on GitHub
- Locate it on the [releases](https://github.com/DataDog/orchestrion/releases) page
- Review the release notes, and edit them if necessary:
+ Remove `chore:` entries
+ Fix any typos you notice
1. Once validated, publish the release on GitHub
- This automatically creates the release tag, so you're done!
24 changes: 13 additions & 11 deletions _integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@ replace github.com/datadog/orchestrion => ../

require (
github.com/datadog/orchestrion v0.0.0-00010101000000-000000000000
github.com/docker/docker v25.0.5+incompatible
github.com/dave/jennifer v1.7.0
github.com/gin-gonic/gin v1.10.0
github.com/go-chi/chi/v5 v5.1.0
github.com/go-redis/redis/v7 v7.4.1
github.com/go-redis/redis/v8 v8.11.5
github.com/gofiber/fiber/v2 v2.52.5
github.com/gomodule/redigo v1.9.2
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/jinzhu/gorm v1.9.16
github.com/labstack/echo/v4 v4.12.0
github.com/mattn/go-sqlite3 v1.14.22
github.com/stretchr/testify v1.9.0
github.com/testcontainers/testcontainers-go v0.31.0
github.com/testcontainers/testcontainers-go/modules/redis v0.31.0
github.com/testcontainers/testcontainers-go v0.32.0
github.com/testcontainers/testcontainers-go/modules/redis v0.32.0
github.com/xlab/treeprint v1.2.0
google.golang.org/grpc v1.65.0
google.golang.org/grpc/examples v0.0.0-20230913203803-9deee9ba5f5b
Expand Down Expand Up @@ -53,7 +54,7 @@ require (
github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect
github.com/DataDog/sketches-go v1.4.5 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.11.4 // indirect
github.com/Microsoft/hcsshim v0.11.5 // indirect
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/armon/go-radix v1.0.1-0.20221118154546-54df44f2176c // indirect
Expand Down Expand Up @@ -103,17 +104,18 @@ require (
github.com/cli/safeexec v1.0.1 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/containerd/containerd v1.7.15 // indirect
github.com/containerd/containerd v1.7.18 // indirect
github.com/containerd/errdefs v0.1.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/cpuguy83/dockercfg v0.3.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/dave/dst v0.27.3 // indirect
github.com/dave/jennifer v1.7.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/disintegration/gift v1.2.1 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/docker/docker v27.0.3+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand Down Expand Up @@ -144,7 +146,7 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gohugoio/go-i18n/v2 v2.1.3-0.20230805085216-e63c13218d0e // indirect
github.com/gohugoio/httpcache v0.7.0 // indirect
github.com/gohugoio/hugo v0.128.1 // indirect
github.com/gohugoio/hugo v0.128.2 // indirect
github.com/gohugoio/hugo-goldmark-extensions/extras v0.2.0 // indirect
github.com/gohugoio/hugo-goldmark-extensions/passthrough v0.2.0 // indirect
github.com/gohugoio/locales v0.14.0 // indirect
Expand All @@ -156,7 +158,6 @@ require (
github.com/google/go-licenses v1.6.0 // indirect
github.com/google/licenseclassifier v0.0.0-20221004142553-c1ed8fcf4bab // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/google/wire v0.5.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.2 // indirect
Expand Down Expand Up @@ -197,6 +198,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/hashstructure v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/user v0.1.0 // indirect
Expand Down Expand Up @@ -269,8 +271,8 @@ require (
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.22.0 // indirect
Expand Down
Loading

0 comments on commit 45ac0c0

Please sign in to comment.