Files
openobserve/.github/workflows/release.yml
T
Prabhat SharmaandmmosarafO2 3e92683350 fix: build manifest of both builds succeed plus more (#8729)
### **PR Type**
Enhancement


___

### **Description**
- Split PR image builds by architecture

- Unify Dockerfile for both builds

- Improve build cache isolation per arch

- Gate final job on both builds success


___

### Diagram Walkthrough


```mermaid
flowchart LR
  A["build_pr_image_amd64"] -- "produces amd64 image" --> C["build"]
  B["build_pr_image_arm64"] -- "produces arm64 image" --> C
  C -- "runs only if both succeed" --> D["post-build steps"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>build-pr-image.yml</strong><dd><code>Split and harden
PR image build workflow</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></summary>
<hr>

.github/workflows/build-pr-image.yml

<ul><li>Rename jobs per arch: amd64/arm64<br> <li> Use single Dockerfile
path for both<br> <li> Add arch-scoped cache keys and prefixes<br> <li>
Make final job depend on both success</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8729/files#diff-ebeabab3ec6b3ad90cc66cb9c0d9f2ad72c7ec6116e30e9801241b46992742d6">+15/-22</a>&nbsp;
</td>

</tr>

<tr>
  <td>
    <details>
<summary><strong>Dockerfile.pr</strong><dd><code>Add unified runtime
Dockerfile for PR builds</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

deploy/build/Dockerfile.pr

<ul><li>Add Debian slim runtime base<br> <li> Install required runtime
packages<br> <li> Copy binary and init data dir<br> <li> Set default
command to run service</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8729/files#diff-0db44a1fcb127375b96718556fd43c738708efbcaf0f83a9bffe39d4bfa95a02">[link]</a>&nbsp;
&nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___

---------

Co-authored-by: mmosarafO2 <mosraf@openobserve.ai>
2025-10-06 09:17:26 +05:30

260 lines
9.8 KiB
YAML

on:
push:
tags:
- "v*.*.*"
name: Release
env:
RUST_TOOLCHAIN: nightly-2025-07-20
jobs:
build:
name: Build binary
strategy:
matrix:
include:
- arch: x86_64-unknown-linux-gnu
os: ubicloud-standard-8
features: "--features mimalloc"
file_name: openobserve-${{ github.ref_name }}-linux-amd64
file_ext: .tar.gz
- arch: x86_64-unknown-linux-gnu
os: ubicloud-standard-8
features: "--features mimalloc"
file_name: openobserve-${{ github.ref_name }}-linux-amd64-simd
file_ext: .tar.gz
- arch: x86_64-unknown-linux-musl
os: ubicloud-standard-8
features: "--features mimalloc"
file_name: openobserve-${{ github.ref_name }}-linux-amd64-musl
file_ext: .tar.gz
# - arch: aarch64-unknown-linux-musl
# os: ubicloud-standard-8
# features: "--features mimalloc"
# file_name: openobserve-${{ github.ref_name }}-linux-arm64-musl
# file_ext: .tar.gz
- arch: aarch64-unknown-linux-gnu
os: ubicloud-standard-8-arm
features: "--features mimalloc"
file_name: openobserve-${{ github.ref_name }}-linux-arm64
file_ext: .tar.gz
- arch: x86_64-apple-darwin
os: macos-latest
features: "--features mimalloc"
file_name: openobserve-${{ github.ref_name }}-darwin-amd64
file_ext: .tar.gz
- arch: aarch64-apple-darwin
os: macos-latest
features: "--features mimalloc"
file_name: openobserve-${{ github.ref_name }}-darwin-arm64
file_ext: .tar.gz
- arch: x86_64-pc-windows-msvc
os: windows-2022-16-cores
features: ""
file_name: openobserve-${{ github.ref_name }}-windows-amd64
file_ext: .zip
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install Node
uses: actions/setup-node@v5
with:
node-version: 22
cache: "npm"
cache-dependency-path: web/package-lock.json
- name: Build UI
env:
NODE_OPTIONS: "--max-old-space-size=8192"
run: |
cd web/
npm install
npm run build
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "21.12"
- name: Install dependencies for linux-gnu
if: contains(matrix.arch, 'linux-gnu')
run: |
sudo apt-get -y update
sudo apt-get -y install libssl-dev pkg-config g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
- name: Install dependencies for linux-musl
if: contains(matrix.arch, 'linux-musl')
run: |
sudo apt-get -y update
sudo apt-get -y install libssl-dev pkg-config g++-aarch64-linux-gnu gcc-aarch64-linux-gnu musl-dev musl-tools
sudo ln -s "/usr/bin/g++" "/usr/bin/musl-g++"
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
targets: ${{ matrix.arch }}
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
prefix-key: release-${{ matrix.arch }}
- name: Output package versions
run: protoc --version ; cargo version ; rustc --version ; gcc --version ; g++ --version
- name: Print rustc cfg
run: rustc -C target-cpu=native --print cfg
- name: Run cargo build (standard)
if: contains(matrix.file_name, '-simd') == false
run: cargo build ${{ matrix.features }} --profile release-prod --target ${{ matrix.arch }}
- name: Run cargo build (SIMD)
if: contains(matrix.file_name, '-simd')
run: RUSTFLAGS='-C target-feature=+aes,+avx,+avx2,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+avx512f,+avx512cd,+avx512bw,+avx512dq,+avx512vl' cargo build ${{ matrix.features }} --profile release-prod --target ${{ matrix.arch }}
- name: Calculate checksum and rename binary
if: contains(matrix.arch, 'windows') == false
shell: bash
run: |
cd target/${{ matrix.arch }}/release-prod
chmod +x openobserve
tar -zcvf ${{ matrix.file_name }}.tar.gz openobserve
echo $(shasum -a 256 ${{ matrix.file_name }}.tar.gz | cut -f1 -d' ') > ${{ matrix.file_name }}.tar.gz.sha256sum
- name: Calculate checksum and rename binary for windows
if: contains(matrix.arch, 'windows')
shell: bash
run: |
cd target/${{ matrix.arch }}/release-prod
7z a -tzip ${{ matrix.file_name }}.zip openobserve.exe
certutil.exe -hashfile ${{ matrix.file_name }}.zip sha256|head -n 2|tail -n 1 > ${{ matrix.file_name }}.zip.sha256sum
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.file_name }}
path: target/${{ matrix.arch }}/release-prod/${{ matrix.file_name }}${{ matrix.file_ext }}
- name: Upload checksum of artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.file_name }}.sha256sum
path: target/${{ matrix.arch }}/release-prod/${{ matrix.file_name }}${{ matrix.file_ext }}.sha256sum
release:
name: Release artifacts
needs: [build]
runs-on: repo-openobserve-standard-4
permissions:
id-token: write
contents: write
steps:
- name: Checkout sources
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v5
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::325553860333:role/github-actions-s3-uploader
role-session-name: GithubActionsSession
aws-region: us-east-2
- name: Upload to S3
env:
BUCKET: ${{ vars.AWS_S3_BUCKET_NAME }}
run: |
if ! command -v aws &> /dev/null; then
echo "AWS CLI not found. Installing..."
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
else
echo "AWS CLI already installed."
fi
echo "Uploading artifacts to S3..."
for file in $(find . -type f \( -name "openobserve*.tar.gz" -o -name "*.zip" -o -name "openobserve*.sha256sum" \)); do
echo "Uploading $file to s3://${BUCKET}/releases/openobserve/${GITHUB_REF_NAME}/"
aws s3 cp "$file" "s3://${BUCKET}/releases/openobserve/${GITHUB_REF_NAME}/$(basename "$file")"
done
- name: Generate release body with Download Url
id: generate-body
run: |
echo "📦 Download Binaries from https://openobserve.ai/downloads" > release_body.md
echo "body<<EOF" >> $GITHUB_OUTPUT
cat release_body.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Publish release
uses: softprops/action-gh-release@v2
with:
name: "Release ${{ github.ref_name }}"
generate_release_notes: true
body: ${{ steps.generate-body.outputs.body }}
- name: Send release notification to Strapi
uses: actions/github-script@v7
with:
script: |
// Get release info from workflow dispatch inputs
const tag = context.ref.replace("refs/tags/", "");
const { data: release } = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag
});
function cleanChangelog(changelog) {
if (!changelog) return '';
const lines = changelog.split(/\r?\n/);
const result = [];
for (const line of lines) {
if (line.toLowerCase().includes('new contributors')) break;
if (line.toLowerCase().includes('full changelog')) continue;
if (line.toLowerCase().includes('download binaries from')) continue;
const cleanedLine = line.replace(/by\s+@[\w-]+.*$/i, '').replace(/@\w+/g, '').replace(/\bhttps?:\/\/\S+/gi, '').trim();
if (cleanedLine.length > 0) result.push(cleanedLine);
}
return result.join('\n');
}
const cleanedBody = cleanChangelog(release.body);
const payload = {
version: release.tag_name,
release_name: release.name,
release_url: release.html_url,
changelog: cleanedBody || 'No release notes provided',
type: 'PUBLIC',
date: release.published_at
};
try {
const response = await fetch(`${process.env.STRAPI_WEBHOOK_URL}/api/github-releases?status=published`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.STRAPI_API_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({data: payload})
});
if (!response.ok) {
throw new Error(`Webhook request failed: ${response.status} ${response.statusText}`);
}
console.log('Response status:', response.status);
} catch (error) {
console.error('Failed to send webhook notification:', error);
core.setFailed(error.message);
}
env:
STRAPI_WEBHOOK_URL: ${{ secrets.STRAPI_WEBHOOK_URL }}
STRAPI_API_TOKEN: ${{ secrets.STRAPI_API_TOKEN }}