-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add update Jaeger version workflow (#1200)
* Add update Jaeger version workflow * Incorporate Jaeger UI distributive
- Loading branch information
1 parent
b6549eb
commit d67e74a
Showing
14 changed files
with
779 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Update Jaeger version | ||
|
||
on: | ||
repository_dispatch: | ||
types: [update-jaeger] | ||
|
||
jobs: | ||
update-jaeger: | ||
runs-on: ubuntu-latest | ||
env: | ||
BRANCH_NAME: update-jaeger | ||
JAEGER_FILENAME: jaeger.json | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.CONTENTS_WRITE_PAT }} | ||
|
||
- name: Create or update version file | ||
run: echo ${{ toJson(github.event.client_payload) }} > ${{ env.JAEGER_FILENAME }} | ||
|
||
- name: Commit, push changes and create PR | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
git checkout -b ${{ env.BRANCH_NAME }} | ||
git add ${{ env.JAEGER_FILENAME }} | ||
git commit -m "Update Jaeger version" | ||
git push origin ${{ env.BRANCH_NAME }} | ||
gh pr create -t "Update Jaeger version" -B main -H ${{ env.BRANCH_NAME }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
coverage/ | ||
dist/ | ||
jaeger-ui/ | ||
node_modules/ | ||
storybook-static/ | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"jetBrainsPluginVersion": "2.0.403", | ||
"jaegerUIVersion": "1.29.1-digma.1.0.0", | ||
"jaegerVersion": "1.45.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* eslint-disable no-console */ | ||
import { Octokit } from "@octokit/rest"; | ||
import AdmZip from "adm-zip"; | ||
import fs from "fs"; | ||
import path from "path"; | ||
import dependenciesJson from "./dependencies.json" assert { type: "json" }; | ||
|
||
interface DependenciesJson { | ||
jetBrainsPluginVersion: string; | ||
jaegerUIVersion: string; | ||
jaegerVersion: string; | ||
} | ||
|
||
interface DownloadReleaseAssetOptions { | ||
owner: string; | ||
repo: string; | ||
tag: string; | ||
assetName: string; | ||
outputPath: string; | ||
extractPath?: string; | ||
} | ||
|
||
// Get output path from command line arguments | ||
let outputPath = ""; | ||
const outputArgIndex = process.argv.indexOf("--output"); | ||
if (outputArgIndex !== -1 && process.argv[outputArgIndex + 1]) { | ||
outputPath = path.resolve(process.argv[outputArgIndex + 1]); | ||
} else { | ||
console.log("No output path provided."); | ||
process.exit(1); | ||
} | ||
|
||
// Ensure the output directory exists | ||
fs.mkdirSync(outputPath, { recursive: true }); | ||
|
||
const extractZip = (zipPath: string, extractPath: string) => { | ||
const zip = new AdmZip(zipPath); | ||
zip.extractAllTo(extractPath, true); | ||
}; | ||
|
||
const downloadReleaseAsset = async ({ | ||
owner, | ||
repo, | ||
tag, | ||
assetName, | ||
outputPath, | ||
extractPath | ||
}: DownloadReleaseAssetOptions) => { | ||
const octokit = new Octokit(); | ||
|
||
try { | ||
const release = await octokit.rest.repos.getReleaseByTag({ | ||
owner, | ||
repo, | ||
tag | ||
}); | ||
|
||
const asset = release.data.assets.find((a) => a.name === assetName); | ||
if (!asset) { | ||
console.error("GitHub release asset not found in release."); | ||
return; | ||
} | ||
|
||
const response = await octokit.request(`GET ${asset.url}`, { | ||
headers: { | ||
Accept: "application/octet-stream" | ||
} | ||
}); | ||
|
||
const filePath = path.join(outputPath, assetName); | ||
fs.writeFileSync(filePath, Buffer.from(response.data as string, "binary")); | ||
|
||
if (extractPath) { | ||
extractZip(filePath, extractPath); | ||
} | ||
} catch (error) { | ||
console.error("Error downloading GitHub release asset:", error.message); | ||
} | ||
}; | ||
|
||
const jaegerUIVersion = (dependenciesJson as DependenciesJson).jaegerUIVersion; | ||
const tag = `v${jaegerUIVersion}`; | ||
const assetName = `dist-${tag}.zip`; | ||
const extractPath = path.resolve(outputPath, "./dist"); | ||
const zipPath = path.join(outputPath, assetName); | ||
|
||
if (fs.existsSync(zipPath)) { | ||
console.log("Jaeger UI release asset already exists, skipping download..."); | ||
extractZip(zipPath, extractPath); | ||
process.exit(0); | ||
} else { | ||
void downloadReleaseAsset({ | ||
owner: "digma-ai", | ||
repo: "jaeger-ui", | ||
tag, | ||
assetName, | ||
outputPath, | ||
extractPath | ||
}); | ||
} |
Oops, something went wrong.