-
Notifications
You must be signed in to change notification settings - Fork 0
feat(installer): install the tracebloc CLI as part of the client install (Step 5, both OSes) #202
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9d11873
feat(installer): install the tracebloc CLI as Step 5 (macOS/Linux + W…
saadqbal 16aba0f
test(install-cli): don't reassign readonly CURL_SECURE in bats setup
saadqbal 53ce857
fix(installer): guard install-cli source/call + add Pester coverage
saadqbal ae9164d
fix(installer): cross-platform temp path in Install-TraceblocCli
saadqbal 7ab391b
fix(installer): address Bugbot — reliable Windows exit code + safe ve…
saadqbal 9979074
fix(installer): gate Windows CLI success on installer exit code alone
saadqbal defefea
ci: add Lint + Unit tests jobs (org-standard required checks)
saadqbal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,59 @@ | ||
| name: Standard checks | ||
|
|
||
| # Emits the org-standard required status checks **Lint** and **Unit tests** for | ||
| # this (shell / Helm) repo, so branch-protection rules that require those exact | ||
| # contexts are satisfied and PRs can merge. | ||
| # | ||
| # IMPORTANT — deliberately NOT path-filtered. A *required* status check must | ||
| # report on EVERY PR to the protected branch; if it were gated on `paths:`, a PR | ||
| # that didn't touch those paths would never produce the check and would sit | ||
| # forever at "Expected — waiting for status to be reported", blocking the merge. | ||
| # | ||
| # These jobs reuse the same proven steps as `installer-tests.yaml`'s deeper | ||
| # suite (which keeps the broader coverage: PSScriptAnalyzer, Pester on Windows, | ||
| # distro-prereqs, e2e). If the two ever feel redundant, fold the deep suite's | ||
| # names into these and drop the duplicates — but keep SOMETHING reporting | ||
| # `Lint` + `Unit tests` unconditionally. | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, develop, openshift] | ||
| pull_request: | ||
| branches: [main, develop, openshift] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: bash -n (syntax) on every shell script | ||
| run: | | ||
| find scripts -type f -name '*.sh' -print0 \ | ||
| | while IFS= read -r -d '' f; do bash -n "$f" || exit 1; done | ||
| echo "all shell scripts parse" | ||
|
|
||
| - name: ShellCheck (libs + entrypoints), error severity | ||
| run: | | ||
| sudo apt-get update -qq && sudo apt-get install -y -qq shellcheck | ||
| shellcheck --version | grep version | ||
| shellcheck --severity=error --shell=bash \ | ||
| scripts/install.sh scripts/install-k8s.sh scripts/lib/*.sh \ | ||
| scripts/tests/distro-prereqs.sh scripts/tests/e2e-cluster.sh scripts/tests/e2e-proxy.sh | ||
|
|
||
| unit-tests: | ||
| name: Unit tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install bats | ||
| run: sudo apt-get update -qq && sudo apt-get install -y -qq bats | ||
|
|
||
| - name: Run bats (bash unit suite, mocked) | ||
| run: bats scripts/tests/*.bats |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,67 @@ | ||
| #!/usr/bin/env bash | ||
| # ============================================================================= | ||
| # install-cli.sh — Install the tracebloc CLI (Step 5) | ||
| # | ||
| # Installs the `tracebloc` command-line tool so the user can push datasets to | ||
| # the client they just set up: | ||
| # | ||
| # tracebloc dataset push ./data | ||
| # | ||
| # It does NOT reimplement any install logic — it runs the CLI's own released | ||
| # installer (github.com/tracebloc/cli), which downloads the right build for | ||
| # this OS/arch and verifies it (SHA256 + cosign signature) before installing. | ||
| # Keeping that logic in the cli repo means this stays correct as the CLI's | ||
| # platform matrix / signing evolves. | ||
| # | ||
| # NON-FATAL by design: this runs AFTER the client is already connected, so a | ||
| # CLI-install hiccup must warn and move on — it must never turn a successful | ||
| # "Connected to tracebloc" into a failed install. Every path returns 0, and | ||
| # detection does NOT rely on the caller's `set -o pipefail` (we download to a | ||
| # temp file and check each step explicitly rather than `curl | sh`). | ||
| # ============================================================================= | ||
|
|
||
| TRACEBLOC_CLI_INSTALL_URL="https://github.com/tracebloc/cli/releases/latest/download/install.sh" | ||
|
|
||
| install_tracebloc_cli() { | ||
| step 5 5 "Install the tracebloc CLI" | ||
|
|
||
| if has tracebloc; then | ||
| # Version is cosmetic — never let a failing `tracebloc version` (or SIGPIPE | ||
| # from `head` closing the pipe, under `set -o pipefail`) abort this step. | ||
| # `local` masks the status and `|| true` keeps any captured value. | ||
| local ver="$(tracebloc version 2>/dev/null | head -1 || true)" | ||
| info "tracebloc CLI already present${ver:+ ($ver)} — re-running its installer to pick up the latest." | ||
| fi | ||
|
|
||
| info "Installing the tracebloc CLI (dataset push / cluster info / dataset rm)…" | ||
|
|
||
| local installer | ||
| installer="$(mktemp)" || { warn "Couldn't install the tracebloc CLI (no temp dir) — your client is set up fine."; return 0; } | ||
|
|
||
| # 1) Download the released installer. A failure here is a download problem, | ||
| # distinct from an install problem below. | ||
| if ! curl -fsSL "$CURL_SECURE" "$TRACEBLOC_CLI_INSTALL_URL" -o "$installer" 2>>"${LOG_FILE:-/dev/null}"; then | ||
| warn "Couldn't download the tracebloc CLI installer — your client is set up fine." | ||
| hint "Install it later: curl -fsSL ${TRACEBLOC_CLI_INSTALL_URL} | sh" | ||
| rm -f "$installer" | ||
| return 0 | ||
| fi | ||
|
|
||
| # 2) Run it. Output → install log to keep this screen clean. The CLI installer | ||
| # verifies SHA256 + cosign and falls back to ~/.local/bin (printing PATH | ||
| # guidance) when /usr/local/bin isn't writable. | ||
| if sh "$installer" >> "${LOG_FILE:-/dev/null}" 2>&1; then | ||
| if has tracebloc; then | ||
| local ver="$(tracebloc version 2>/dev/null | head -1 || true)" | ||
| success "tracebloc CLI installed${ver:+ ($ver)}." | ||
| else | ||
| success "tracebloc CLI installed — open a new terminal so it's on your PATH." | ||
| fi | ||
| else | ||
| warn "Couldn't install the tracebloc CLI automatically — your client is set up fine." | ||
| hint "Install it later: curl -fsSL ${TRACEBLOC_CLI_INSTALL_URL} | sh" | ||
| fi | ||
|
|
||
| rm -f "$installer" | ||
| return 0 | ||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.