Skip to content

Introduce a CPT backend version#199

Merged
dbutenhof merged 2 commits intocloud-bulldozer:mainfrom
dbutenhof:version
Apr 23, 2025
Merged

Introduce a CPT backend version#199
dbutenhof merged 2 commits intocloud-bulldozer:mainfrom
dbutenhof:version

Conversation

@dbutenhof
Copy link
Copy Markdown
Collaborator

@dbutenhof dbutenhof commented Apr 16, 2025

Type of change

  • Refactor
  • New feature
  • Bug fix
  • Optimization
  • Documentation Update

Description

Version information is compiled at build time using a Python script, producing a transient JSON file that will be copied into the backend container for access at runtime via GET /api/version.

Related Tickets & Documents

PANDA-823 CPT aggregator version

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.

Testing

  1. scripts/start-reload.sh -- works
  2. ./local-compose.sh -- works
  3. ./backend/tests/e2e_backend.sh -- works
  4. GitHub Action -- unfortunately, it seems impractical to test until we merge to main. (That is, PR builds can't use GitHub environment variables or secrets, and I don't want to commit even robot credentials in clear text in my Action workflow, so I can't push a built container anywhere I could pull it to test.) If the build-push.yml action fails on merge, I'll need another PR to (hopefully) fix it.

@mfleader
Copy link
Copy Markdown
Collaborator

what's the purpose of using the git information? Is it to programmatically incorporate git information into the version?

Copy link
Copy Markdown
Collaborator

@mfleader mfleader left a comment

Choose a reason for hiding this comment

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

Why do we need to include all of this information in the version? Is it all supposed to be a part of uniquely identifying any build?

Copy link
Copy Markdown
Collaborator Author

@dbutenhof dbutenhof left a comment

Choose a reason for hiding this comment

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

Why do we need to include all of this information in the version? Is it all supposed to be a part of uniquely identifying any build?

I'm certainly open to arguments that I "went too far"; but I do want to include at least some git information because we're going to have multiple development builds between "versions". Using the git commit hash helps to keep them unique. Adding the active branch was something of an experiment--if I do two container builds from different local PR branches off main, I can tell the servers apart that way. Unfortunately this turns out to be a lot less useful for CI builds as the "branch" isn't distinct or particularly useful (they're headless branches). By the time I figured that out, I didn't feel like backing it out, and it might still be useful for local development.

Including the recent git log history? Well, it was an idea to add context, and I think it's kinda sad (though I haven't bothered to push back) that most of our git commit messages are pretty useless; and if the messages aren't useful, the history probably isn't useful either. My half-formed thought was that I could show the history in a popup from the header version element in the UI; I'm not convinced that's worthwhile ... but I'm also not convinced it's useless. 😆

FYI:
image

@dbutenhof
Copy link
Copy Markdown
Collaborator Author

I've been playing with the UI ... I may post a draft PR soon, but FY ...

image

Version information is compiled at build time using a Python script, producing
a transient JSON file that will be copied into the backend container for
access at runtime via `GET /api/version`.
It's still in the details, but this won't be useful for deployed builds and it
just takes space. Also, when we don't get a branch name, identify the "buid
"branch" as `CI`.
@dbutenhof
Copy link
Copy Markdown
Collaborator Author

Merging this will be an interesting test that we can properly build the container with my version hooks and push it to Quay ... and that ArgoCD actually picks it up and updates the dev deployment.

@dbutenhof dbutenhof merged commit 004a185 into cloud-bulldozer:main Apr 23, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants