Skip to content
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

Add workflow to manually build the mini agent for testing #261

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/build-serverless-agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build the Serverless Agent
on:
workflow_dispatch:
inputs:
branch:
description: The branch to build the serverless trace mini agent off of. Defaults to main.
default: main

jobs:
build-linux-musl:
name: Build Linux Musl
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: Install musl dependencies
run: rustup target add x86_64-unknown-linux-musl && sudo apt-get install musl-tools
- name: Build project
run: cargo build --release -p datadog-serverless-trace-mini-agent --target x86_64-unknown-linux-musl
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: datadog-serverless-agent-linux-amd64
path: target/x86_64-unknown-linux-musl/release/datadog-serverless-trace-mini-agent
build-windows:
name: Build Windows
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: Build project
run: cargo build --release -p datadog-serverless-trace-mini-agent
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: datadog-serverless-agent-windows-amd64
path: target/release/datadog-serverless-trace-mini-agent.exe
upload-upx-compressed-binaries:
name: Upload UPX compressed binaries
needs: [build-windows, build-linux-musl]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download artifacts from build step
uses: actions/download-artifact@v3
with:
path: target/release/binaries
- name: UPX compress binaries
run: |
for file in target/release/binaries/*/*
do
chmod +x "$file"
upx "$file" --lzma

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Using UPX for processes that are started repetitively can add a delay to the FaaS platform warmup. Also UPX packed executable can trigger AV and malware analysis pipelines.

Prefer to ship your binary stripped, and compressed by the archiver, like you do in the next step than artificially reduce the binary size which will run additional code to unpack from memory. To reduce your Rust binary size, I advise you to have a look to this repo - https://github.com/johnthagen/min-sized-rust

done
- name: Zip binaries
run: zip -r datadog-serverless-agent.zip *
working-directory: target/release/binaries
- name: Upload
uses: actions/upload-artifact@v3
with:
name: compressed-binaries
path: target/release/binaries/datadog-serverless-agent.zip

Loading