Repository navigation
feat(ingest/looker): add opt-in "View in Git" links to Explores #21514
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
base: master
Are you sure you want to change the base?
Changes from 10 commits
f9f443a
eb02102
c48997b
42d0b13
09fe0eb
c8378bb
42e401a
580f7a0
4befb97
0802ca7
0897194
4b41156
dccd5fc
9c70ace
c0b34fb
e67b9ec
815e9dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| import re | ||
|
|
||
| IMPORTED_PROJECTS = "imported_projects" | ||
| IMPORTED_PROJECTS_PREFIX = f"{IMPORTED_PROJECTS}/" | ||
| DIMENSIONS = "dimensions" | ||
|
|
@@ -16,3 +18,16 @@ | |
| VIEW_FIELD_TYPE_ATTRIBUTE = "type" | ||
| VIEW_FIELD_INTERVALS_ATTRIBUTE = "intervals" | ||
| VIEW_FIELD_TIMEFRAMES_ATTRIBUTE = "timeframes" | ||
|
|
||
| # Identifies the links the looker source manages on Explores: links with this label are | ||
| # replaced or removed on each run, so changing it would orphan links already written. | ||
| EXPLORE_GIT_LINK_LABEL = "View in Git" | ||
| # Reading an Explore's links failed with a bad token (401) or throttling (429): it would | ||
| # fail for every Explore, so link reads stop for the run instead of skipping one Explore. | ||
| EXPLORE_GIT_LINK_RUN_WIDE_HTTP_STATUSES = frozenset({401, 429}) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: 403 behaves run-wide in practice too. A DataHub token without dataset read privilege gets 403 on every Explore, so a big instance makes one failing read and adds one warning context per Explore. Consider adding 403 here, or stopping after a few consecutive 403s.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The aspect GET checks READ against the specific URN ( |
||
| # Looker's default when a project has no production branch configured. | ||
| LOOKER_DEFAULT_GIT_BRANCH = "master" | ||
| # LookML IDE link path: /projects/<project>/files/<url-encoded repo path> | ||
| LOOKML_LINK_PATH_PATTERN = re.compile(r"^/projects/[^/]+/files/(.+)$") | ||
| # SCP-style SSH remotes like git@github.com:org/repo.git | ||
| GIT_SCP_REMOTE_PATTERN = re.compile(r"^[^@/]+@([^:/]+):(.+)$") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: git also accepts SCP remotes without a user (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in 4b41156, with one change to the suggested pattern: |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The host is copied as-is, so real GitHub/GitLab remotes on alternate hosts are rejected by
GitReferenceas unsupported:ssh://git@ssh.github.com:443/org/repo.git(GitHub's SSH-over-443),altssh.gitlab.com,www.github.com. Could we map those togithub.comandgitlab.comhere?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 4b41156:
ssh.github.com,www.github.comandaltssh.gitlab.comnow map togithub.com/gitlab.com, with test cases.