Repository navigation
Opaque User Data Feature (Issue #8426) - #9489
Merged
Merged
Conversation
alicul
force-pushed
the
opaque-user-data
branch
from
March 16, 2026 23:00
3e4c816 to
fe823b9
Compare
Adds support for an opaque user_data field to the Config struct that can be used to store arbitrary metadata about a pipeline. Changes: - Add UserData field to atc.Config struct - Update UnmarshalConfig to preserve user_data in skeleton - Add comprehensive tests for various user_data types The user_data field is optional (omitempty) and supports any valid YAML/JSON structure. This is the first step towards implementing issue concourse#8426 - opaque user metadata in pipelines. Related to: concourse#8426
- Adds database schema changes and storage logic to persist the user_data field in pipeline configurations. -Updates the pipeline Config() method to include the user_data field when reconstructing the configuration from the database. Changes: - Add migration to create user_data column in pipelines table - Update savePipeline to marshal and store user_data - Add user_data field to pipeline struct - Update pipelinesQuery to select user_data column - Update scanPipeline to unmarshal user_data from database - Add user_data field to Config struct returned by pipeline.Config() The user_data column is nullable, allowing backwards compatibility with existing pipelines. When user_data is present in the config, it is marshaled to JSON and stored in the database. When retrieved, it is unmarshaled back to its original structure. Related to: concourse#8426
This commit adds integration and unit tests to verify the complete round-trip functionality of the user_data feature. Changes: - Add integration tests in atc/integration/user_data_test.go: * Test saving and retrieving user_data as map/object * Test saving and retrieving user_data as string * Test saving and retrieving user_data as array * Test pipelines without user_data (nil/null) * Test updating user_data values - Add unit tests in atc/db/pipeline_test.go: * Test database layer user_data persistence * Test various user_data types (map, string, array) * Test nil user_data for backwards compatibility * Test user_data updates These tests verify that: 1. user_data is preserved through set-pipeline -> get-pipeline cycle 2. Various data types are supported (maps, strings, arrays, nested structures) 3. Backwards compatibility is maintained (nil for missing user_data) 4. Updates to user_data work correctly Related to: concourse#8426
The user_data field was being properly stored and retrieved but was not shown in the diff output when running 'fly set-pipeline'. This made it appear as if user_data wasn't being set, when in fact it was. Changes: - Add UserDataDiff struct to represent user_data differences - Add diffUserData() function to detect changes in user_data - Add Render() method to display user_data diffs with YAML formatting - Integrate user_data checking into Config.Diff() method - Add comprehensive tests for all user_data scenarios This ensures users can see when user_data is: - Added to a pipeline - Modified in an existing pipeline - Removed from a pipeline The diff output now properly shows the YAML representation of user_data changes with color-coded additions/removals/modifications. Fixes the issue where 'fly set-pipeline' would silently accept user_data without showing it in the diff, making it unclear if the field was actually being processed.
alicul
force-pushed
the
opaque-user-data
branch
from
March 21, 2026 09:53
fe823b9 to
e1f1ebe
Compare
Contributor
Author
|
Found a small issue with not being able to update the user_data.. Solved in: e1f1ebe I also rebased on master. |
Signed-off-by: Taylor Silva <[email protected]>
taylorsilva
approved these changes
Mar 24, 2026
taylorsilva
left a comment
Member
There was a problem hiding this comment.
LGTM
Made a tiny update to one of the tests. Played around with it and it behaves as I expect it to. Test coverage is great too, thanks for being so thorough!
Once the PR checks are done I'll merge this. TY for the PR!
Contributor
Author
|
@taylorsilva Thank you for fixing the test and taking care of this. |
blarghmatey
added a commit
to mitodl/concourse
that referenced
this pull request
Jul 30, 2026
…o button Reworks the pipeline-description feature per review feedback on concourse#9661, in two parts. First, drop the new top-level `description` config entirely and read the existing `user_data` field instead. `user_data` landed in concourse#9489 as a catch-all for arbitrary pipeline metadata, is already plumbed through db.Pipeline and the presenter, and is already exposed as `user_data` on the API's pipeline payload - nothing on the Elm side consumed it yet. Reading it there means the whole atc/ side of this change goes away: no `Config.Description`, no `description` column and migration, no db.Pipeline getter, no presenter field, no regenerated fake. Less code to carry, and no new pipeline config surface to support forever. Second, stop rendering it in the pipeline overview by default. The overview is already dense with jobs, resources and groups, and an always-on panel added to that. The content now lives at /teams/:team/pipelines/:pipeline/info, reached from an information-outline button in the existing top-right button group. The button is only rendered when the pipeline actually has `user_data`, so pipelines without it look exactly as they do today. A page rather than a modal: `user_data` is arbitrary and potentially long, and a page scrolls without a height ceiling and gives the content a shareable URL, which suits something read as documentation. `user_data` is an opaque JSON value, so the page picks a rendering from its shape: a bare string is markdown; an object with a string `description` renders that as markdown with the remaining keys as YAML underneath; anything else renders wholesale as YAML. The YAML renderer is a small local module rather than a new dependency. It preserves the author's key order instead of sorting (this is read as documentation), renders multi-line strings as literal block scalars, and quotes conservatively - anything that could otherwise be read back as a number, bool, null, or YAML syntax. Markdown still goes through dillonkearns/elm-markdown's defaultHtmlRenderer unmodified, so raw HTML embedded in the source does not render (`html = Markdown.Html.oneOf []`). `user_data` is visible to anyone with pipeline view access, including anonymous viewers on public pipelines, so opting into a raw-HTML-passthrough renderer would be a mistake. Parse or render failure falls back to the raw, still-escaped text. Decoding treats an explicit `"user_data": null` as unset the same way an absent key is; `Json.Decode.value` on its own would accept null and break the encode/decode round-trip. Adds coverage for the YAML renderer, the routing, the button's visibility and target, and each of the three rendering shapes. Signed-off-by: Tobias Macey <[email protected]>
blarghmatey
added a commit
to mitodl/ol-infrastructure
that referenced
this pull request
Sep 22, 2026
…5989) * feat(concourse): populate pipeline user_data for the upcoming info-page description Concourse already stores an opaque user_data field through the set-pipeline/get-pipeline cycle (concourse/concourse#9489, shipped in our pinned 8.3.0), but the web UI doesn't render it until concourse/concourse#9661 ("Add pipeline-level description field", merged 2026-09-01) lands in a release we've upgraded to. This sets user_data on every pipeline generator now so the description starts rendering automatically once we bump CONCOURSE_VERSION past that release, instead of waiting to author 60+ descriptions after the fact. - Adds pipeline_json_with_user_data() (pipelines/pipeline_output.py), which merges user_data into a Pipeline's serialized JSON. The installed ol-concourse package's Pipeline model has no typed user_data field yet and uses extra="forbid", so it can't go through Pipeline(...) directly. - Wires every pipeline.py, meta.py, and standalone image-build script under src/ol_concourse/pipelines/ to use it, with a description grounded in what that pipeline actually builds/deploys, plus team and category (matching docs/plans/concourse-dashboard-reorganization.md §3's dashboard clusters). - Covers meta-driven per-instance registries (simple_pulumi's 39 apps, k8s_apps' 9 apps, container_images' 8 image builds, the open_edx release/deployment families, mfe's per-deployment and per-site pipelines, grader images) as well as the meta pipelines themselves. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YBq4p2BbA7GzbZUSoUYtT8 * fix(concourse): cover the three definition.json-write patterns a filename grep missed A fresh code review of the prior commit found 4 pipeline generators under src/ol_concourse/pipelines/ that never got wired to pipeline_json_with_user_data(): the original discovery pass grepped for open("definition.json"), which missed jupyter_courses.py (writes github_definition.json/s3_definition.json for its two instance-group templates) and libraries/meta.py + libraries/api_clients_pipeline.py (write only to stdout, piped to a file by the Concourse task that calls them, not via a local open() call). Also fixes a real bug the same review caught in mfe/site_pipeline.py: __main__ re-derived deployment -> SiteProjectConfig via a raw dict subscript (_by_name[deployment]) ahead of the safe, validated lookup site_pipeline() already does internally, so an unknown deployment name now crashed with a bare KeyError instead of the existing friendly "Unknown deployment ... Supported deployments: ..." message. Extracted that lookup into _resolve_site_project() so both call sites share the one validated path. Also corrects a docstring in container_images/meta.py that still said `fly -t pr-inf` after the prior commit fixed the actual runtime command to `fly -t pr-main` (container-images-meta lives on the main team per docs/plans/concourse-dashboard-reorganization.md §3). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YBq4p2BbA7GzbZUSoUYtT8 * fix(concourse): correct meta-pipeline team labels and a stdout-redirect JSON break Addresses Copilot's review on PR #5989: - libraries/meta.py: the fly hint printed after the JSON write landed on stdout, which set_self_job() redirects straight into generated-pipeline/meta-pipeline-definition.json via `> {definition_path}`, making that file invalid JSON and breaking the self-update SetPipelineStep. Moved the hint to stderr. - codejail_v3/edx_notes_v3/xqueue/xqwatcher meta.py: each registers its own "meta" self-pipeline on team "main" (`pipeline_team = "main"` in build_meta_job), but the user_data describing that same self-pipeline said "infrastructure". Fixed all four to "main". - mfe/meta.py had the same team mismatch, not flagged by the review but caught by the same check: docs/plans/concourse-dashboard-reorganization.md §3 lists mfe-meta-pipeline under main's meta cluster, matching the other four. Fixed to "main". - AGENTS.md: scoped the "every __main__ block should use the helper" rule to production pipeline generators and named the pipelines/examples/hello.py exception explicitly, so it no longer contradicts that pipeline's deliberate exclusion. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YBq4p2BbA7GzbZUSoUYtT8 --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Support for opaque
user_datafield in pipeline YAML configurations, allowing users to store arbitrary metadata that is preserved through the set-pipeline/get-pipeline cycle.The feature allows users to store arbitrary metadata in pipeline configurations, addressing the use case described in issue #8426 where teams need to attach organizational information to pipelines for programmatic processing.
Closes GitHub Issue: #8426
Example Usage
Pipeline YAML with user_data
Workflow