mirror of
https://github.com/dbt-labs/dbt-core
synced 2025-12-19 10:31:27 +00:00
Compare commits
17 Commits
enable-pos
...
v0.19.1rc2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
908b275570 | ||
|
|
116fe428ff | ||
|
|
ec907b46e8 | ||
|
|
b55d461abe | ||
|
|
841b2115a4 | ||
|
|
114fc0e6cf | ||
|
|
21c6294c09 | ||
|
|
cc9472d865 | ||
|
|
974cb516e6 | ||
|
|
eabbbb2c76 | ||
|
|
4bb7a84182 | ||
|
|
5c66893b01 | ||
|
|
27a08cdbf9 | ||
|
|
e47d642d3f | ||
|
|
597448d9ef | ||
|
|
47b345a0c2 | ||
|
|
de864a7eed |
44
.bumpversion.cfg
Normal file
44
.bumpversion.cfg
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
[bumpversion]
|
||||||
|
current_version = 0.19.1rc2
|
||||||
|
parse = (?P<major>\d+)
|
||||||
|
\.(?P<minor>\d+)
|
||||||
|
\.(?P<patch>\d+)
|
||||||
|
((?P<prerelease>[a-z]+)(?P<num>\d+))?
|
||||||
|
serialize =
|
||||||
|
{major}.{minor}.{patch}{prerelease}{num}
|
||||||
|
{major}.{minor}.{patch}
|
||||||
|
commit = False
|
||||||
|
tag = False
|
||||||
|
|
||||||
|
[bumpversion:part:prerelease]
|
||||||
|
first_value = a
|
||||||
|
values =
|
||||||
|
a
|
||||||
|
b
|
||||||
|
rc
|
||||||
|
|
||||||
|
[bumpversion:part:num]
|
||||||
|
first_value = 1
|
||||||
|
|
||||||
|
[bumpversion:file:setup.py]
|
||||||
|
|
||||||
|
[bumpversion:file:core/setup.py]
|
||||||
|
|
||||||
|
[bumpversion:file:core/dbt/version.py]
|
||||||
|
|
||||||
|
[bumpversion:file:plugins/postgres/setup.py]
|
||||||
|
|
||||||
|
[bumpversion:file:plugins/redshift/setup.py]
|
||||||
|
|
||||||
|
[bumpversion:file:plugins/snowflake/setup.py]
|
||||||
|
|
||||||
|
[bumpversion:file:plugins/bigquery/setup.py]
|
||||||
|
|
||||||
|
[bumpversion:file:plugins/postgres/dbt/adapters/postgres/__version__.py]
|
||||||
|
|
||||||
|
[bumpversion:file:plugins/redshift/dbt/adapters/redshift/__version__.py]
|
||||||
|
|
||||||
|
[bumpversion:file:plugins/snowflake/dbt/adapters/snowflake/__version__.py]
|
||||||
|
|
||||||
|
[bumpversion:file:plugins/bigquery/dbt/adapters/bigquery/__version__.py]
|
||||||
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
## Previous Releases
|
|
||||||
|
|
||||||
For information on prior major and minor releases, see their changelogs:
|
|
||||||
|
|
||||||
|
|
||||||
* [1.10](https://github.com/dbt-labs/dbt-core/blob/1.10.latest/CHANGELOG.md)
|
|
||||||
* [1.9](https://github.com/dbt-labs/dbt-core/blob/1.9.latest/CHANGELOG.md)
|
|
||||||
* [1.8](https://github.com/dbt-labs/dbt-core/blob/1.8.latest/CHANGELOG.md)
|
|
||||||
* [1.7](https://github.com/dbt-labs/dbt-core/blob/1.7.latest/CHANGELOG.md)
|
|
||||||
* [1.6](https://github.com/dbt-labs/dbt-core/blob/1.6.latest/CHANGELOG.md)
|
|
||||||
* [1.5](https://github.com/dbt-labs/dbt-core/blob/1.5.latest/CHANGELOG.md)
|
|
||||||
* [1.4](https://github.com/dbt-labs/dbt-core/blob/1.4.latest/CHANGELOG.md)
|
|
||||||
* [1.3](https://github.com/dbt-labs/dbt-core/blob/1.3.latest/CHANGELOG.md)
|
|
||||||
* [1.2](https://github.com/dbt-labs/dbt-core/blob/1.2.latest/CHANGELOG.md)
|
|
||||||
* [1.1](https://github.com/dbt-labs/dbt-core/blob/1.1.latest/CHANGELOG.md)
|
|
||||||
* [1.0](https://github.com/dbt-labs/dbt-core/blob/1.0.latest/CHANGELOG.md)
|
|
||||||
* [0.21](https://github.com/dbt-labs/dbt-core/blob/0.21.latest/CHANGELOG.md)
|
|
||||||
* [0.20](https://github.com/dbt-labs/dbt-core/blob/0.20.latest/CHANGELOG.md)
|
|
||||||
* [0.19](https://github.com/dbt-labs/dbt-core/blob/0.19.latest/CHANGELOG.md)
|
|
||||||
* [0.18](https://github.com/dbt-labs/dbt-core/blob/0.18.latest/CHANGELOG.md)
|
|
||||||
* [0.17](https://github.com/dbt-labs/dbt-core/blob/0.17.latest/CHANGELOG.md)
|
|
||||||
* [0.16](https://github.com/dbt-labs/dbt-core/blob/0.16.latest/CHANGELOG.md)
|
|
||||||
* [0.15](https://github.com/dbt-labs/dbt-core/blob/0.15.latest/CHANGELOG.md)
|
|
||||||
* [0.14](https://github.com/dbt-labs/dbt-core/blob/0.14.latest/CHANGELOG.md)
|
|
||||||
* [0.13](https://github.com/dbt-labs/dbt-core/blob/0.13.latest/CHANGELOG.md)
|
|
||||||
* [0.12](https://github.com/dbt-labs/dbt-core/blob/0.12.latest/CHANGELOG.md)
|
|
||||||
* [0.11 and earlier](https://github.com/dbt-labs/dbt-core/blob/0.11.latest/CHANGELOG.md)
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
# CHANGELOG Automation
|
|
||||||
|
|
||||||
We use [changie](https://changie.dev/) to automate `CHANGELOG` generation. For installation and format/command specifics, see the documentation.
|
|
||||||
|
|
||||||
### Quick Tour
|
|
||||||
|
|
||||||
- All new change entries get generated under `/.changes/unreleased` as a yaml file
|
|
||||||
- `header.tpl.md` contains the contents of the entire CHANGELOG file
|
|
||||||
- `0.0.0.md` contains the contents of the footer for the entire CHANGELOG file. changie looks to be in the process of supporting a footer file the same as it supports a header file. Switch to that when available. For now, the 0.0.0 in the file name forces it to the bottom of the changelog no matter what version we are releasing.
|
|
||||||
- `.changie.yaml` contains the fields in a change, the format of a single change, as well as the format of the Contributors section for each version.
|
|
||||||
|
|
||||||
### Workflow
|
|
||||||
|
|
||||||
#### Daily workflow
|
|
||||||
Almost every code change we make associated with an issue will require a `CHANGELOG` entry. After you have created the PR in GitHub, run `changie new` and follow the command prompts to generate a yaml file with your change details. This only needs to be done once per PR.
|
|
||||||
|
|
||||||
The `changie new` command will ensure correct file format and file name. There is a one to one mapping of issues to changes. Multiple issues cannot be lumped into a single entry. If you make a mistake, the yaml file may be directly modified and saved as long as the format is preserved.
|
|
||||||
|
|
||||||
Note: If your PR has been cleared by the Core Team as not needing a changelog entry, the `Skip Changelog` label may be put on the PR to bypass the GitHub action that blacks PRs from being merged when they are missing a `CHANGELOG` entry.
|
|
||||||
|
|
||||||
#### Prerelease Workflow
|
|
||||||
These commands batch up changes in `/.changes/unreleased` to be included in this prerelease and move those files to a directory named for the release version. The `--move-dir` will be created if it does not exist and is created in `/.changes`.
|
|
||||||
|
|
||||||
```
|
|
||||||
changie batch <version> --move-dir '<version>' --prerelease 'rc1'
|
|
||||||
changie merge
|
|
||||||
```
|
|
||||||
|
|
||||||
Example
|
|
||||||
```
|
|
||||||
changie batch 1.0.5 --move-dir '1.0.5' --prerelease 'rc1'
|
|
||||||
changie merge
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Final Release Workflow
|
|
||||||
These commands batch up changes in `/.changes/unreleased` as well as `/.changes/<version>` to be included in this final release and delete all prereleases. This rolls all prereleases up into a single final release. All `yaml` files in `/unreleased` and `<version>` will be deleted at this point.
|
|
||||||
|
|
||||||
```
|
|
||||||
changie batch <version> --include '<version>' --remove-prereleases
|
|
||||||
changie merge
|
|
||||||
```
|
|
||||||
|
|
||||||
Example
|
|
||||||
```
|
|
||||||
changie batch 1.0.5 --include '1.0.5' --remove-prereleases
|
|
||||||
changie merge
|
|
||||||
```
|
|
||||||
|
|
||||||
### A Note on Manual Edits & Gotchas
|
|
||||||
- Changie generates markdown files in the `.changes` directory that are parsed together with the `changie merge` command. Every time `changie merge` is run, it regenerates the entire file. For this reason, any changes made directly to `CHANGELOG.md` will be overwritten on the next run of `changie merge`.
|
|
||||||
- If changes need to be made to the `CHANGELOG.md`, make the changes to the relevant `<version>.md` file located in the `/.changes` directory. You will then run `changie merge` to regenerate the `CHANGELOG.MD`.
|
|
||||||
- Do not run `changie batch` again on released versions. Our final release workflow deletes all of the yaml files associated with individual changes. If for some reason modifications to the `CHANGELOG.md` are required after we've generated the final release `CHANGELOG.md`, the modifications need to be done manually to the `<version>.md` file in the `/.changes` directory.
|
|
||||||
- changie can modify, create and delete files depending on the command you run. This is expected. Be sure to commit everything that has been modified and deleted.
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# dbt Core Changelog
|
|
||||||
|
|
||||||
- This file provides a full account of all changes to `dbt-core`
|
|
||||||
- Changes are listed under the (pre)release in which they first appear. Subsequent releases include changes from previous releases.
|
|
||||||
- "Breaking changes" listed under a version may require action from end users or external maintainers when upgrading to that version.
|
|
||||||
- Do not edit this file directly. This file is auto-generated using [changie](https://github.com/miniscruff/changie). For details on how to document a change, see [the contributing guide](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md#adding-changelog-entry)
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Dependencies
|
|
||||||
body: Use EventCatcher from dbt-common instead of maintaining a local copy
|
|
||||||
time: 2025-11-18T15:53:54.284561+05:30
|
|
||||||
custom:
|
|
||||||
Author: 3loka
|
|
||||||
Issue: "12124"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Features
|
|
||||||
body: Support partial parsing for function nodes
|
|
||||||
time: 2025-10-06T14:03:52.258104-05:00
|
|
||||||
custom:
|
|
||||||
Author: QMalcolm
|
|
||||||
Issue: "12072"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Features
|
|
||||||
body: Allow for defining funciton arguments with default values
|
|
||||||
time: 2025-11-17T14:10:53.860178-06:00
|
|
||||||
custom:
|
|
||||||
Author: QMalcolm
|
|
||||||
Issue: "12044"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Features
|
|
||||||
body: Raise jsonschema-based deprecation warnings by default
|
|
||||||
time: 2025-12-01T16:52:09.354436-05:00
|
|
||||||
custom:
|
|
||||||
Author: michelleark
|
|
||||||
Issue: 12240
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Features
|
|
||||||
body: ':bug: :snowman: Disable unit tests whose model is disabled'
|
|
||||||
time: 2025-12-03T12:29:26.209248-05:00
|
|
||||||
custom:
|
|
||||||
Author: michelleark
|
|
||||||
Issue: "10540"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Features
|
|
||||||
body: Implement config.meta_get and config.meta_require
|
|
||||||
time: 2025-12-10T20:20:01.354288-05:00
|
|
||||||
custom:
|
|
||||||
Author: gshank
|
|
||||||
Issue: "12012"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: Address Click 8.2+ deprecation warning
|
|
||||||
time: 2025-09-22T15:17:26.983151-06:00
|
|
||||||
custom:
|
|
||||||
Author: edgarrmondragon
|
|
||||||
Issue: "12038"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: Include macros in unit test parsing
|
|
||||||
time: 2025-11-17T14:06:49.518566-05:00
|
|
||||||
custom:
|
|
||||||
Author: michelleark nathanskone
|
|
||||||
Issue: "10157"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: Allow dbt deps to run when vars lack defaults in dbt_project.yml
|
|
||||||
time: 2025-11-17T18:50:25.759091+05:30
|
|
||||||
custom:
|
|
||||||
Author: 3loka
|
|
||||||
Issue: "8913"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: Restore DuplicateResourceNameError for intra-project node name duplication, behind behavior flag `require_unique_project_resource_names`
|
|
||||||
time: 2025-11-18T17:11:06.454784-05:00
|
|
||||||
custom:
|
|
||||||
Author: michelleark
|
|
||||||
Issue: "12152"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: Allow the usage of `function` with `--exclude-resource-type` flag
|
|
||||||
time: 2025-11-19T19:50:34.703236-06:00
|
|
||||||
custom:
|
|
||||||
Author: QMalcolm
|
|
||||||
Issue: "12143"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: Fix bug where schemas of functions weren't guaranteed to exist
|
|
||||||
time: 2025-11-24T15:56:29.467004-06:00
|
|
||||||
custom:
|
|
||||||
Author: QMalcolm
|
|
||||||
Issue: "12142"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: Fix generation of deprecations summary
|
|
||||||
time: 2025-11-24T15:57:56.544123-08:00
|
|
||||||
custom:
|
|
||||||
Author: asiunov
|
|
||||||
Issue: "12146"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: ':bug: :snowman: Correctly reference foreign key references when --defer and --state provided'
|
|
||||||
time: 2025-11-24T17:08:55.387946-05:00
|
|
||||||
custom:
|
|
||||||
Author: michellark
|
|
||||||
Issue: "11885"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: ':bug: :snowman: Add exception when using --state and referring to a removed
|
|
||||||
test'
|
|
||||||
time: 2025-11-25T12:02:46.635026-05:00
|
|
||||||
custom:
|
|
||||||
Author: emmyoop
|
|
||||||
Issue: "10630"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: ':bug: :snowman: Stop emitting `NoNodesForSelectionCriteria` three times during `build` command'
|
|
||||||
time: 2025-11-25T12:20:20.132379-06:00
|
|
||||||
custom:
|
|
||||||
Author: QMalcolm
|
|
||||||
Issue: "11627"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: ":bug: :snowman: Fix long Python stack traces appearing when package dependencies have incompatible version requirements"
|
|
||||||
time: 2025-11-27T14:13:08.082542-05:00
|
|
||||||
custom:
|
|
||||||
Author: emmyoop
|
|
||||||
Issue: "12049"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: ':bug: :snowman: Fixed issue where changing data type size/precision/scale (e.g.,
|
|
||||||
varchar(3) to varchar(10)) incorrectly triggered a breaking change error fo'
|
|
||||||
time: 2025-11-27T14:59:29.256274-05:00
|
|
||||||
custom:
|
|
||||||
Author: emmyoop
|
|
||||||
Issue: "11186"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: ':bug: :snowman: Support unit testing models that depend on sources with the same name'
|
|
||||||
time: 2025-11-27T17:01:24.193516-05:00
|
|
||||||
custom:
|
|
||||||
Author: michelleark
|
|
||||||
Issue: 11975 10433
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: Fix bug in partial parsing when updating a model with a schema file that is referenced by a singular test
|
|
||||||
time: 2025-11-28T10:21:29.911147Z
|
|
||||||
custom:
|
|
||||||
Author: mattogburke
|
|
||||||
Issue: "12223"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: ':bug: :snowman: Avoid retrying successful run-operation commands'
|
|
||||||
time: 2025-11-28T12:28:38.546261-05:00
|
|
||||||
custom:
|
|
||||||
Author: michelleark
|
|
||||||
Issue: "11850"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: ':bug: :snowman: Fix `dbt deps --add-package` crash when packages.yml contains `warn-unpinned:
|
|
||||||
false`'
|
|
||||||
time: 2025-11-28T16:19:37.608722-05:00
|
|
||||||
custom:
|
|
||||||
Author: emmyoop
|
|
||||||
Issue: "9104"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: ':bug: :snowman: Improve `dbt deps --add-package` duplicate detection with better
|
|
||||||
cross-source matching and word boundaries'
|
|
||||||
time: 2025-11-28T16:31:44.344099-05:00
|
|
||||||
custom:
|
|
||||||
Author: emmyoop
|
|
||||||
Issue: "12239"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: ':bug: :snowman: Fix false positive deprecation warning of pre/post-hook SQL configs'
|
|
||||||
time: 2025-12-02T13:37:05.012112-05:00
|
|
||||||
custom:
|
|
||||||
Author: michelleark
|
|
||||||
Issue: "12244"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: Ensure recent deprecation warnings include event name in message
|
|
||||||
time: 2025-12-09T17:50:31.334618-06:00
|
|
||||||
custom:
|
|
||||||
Author: QMalcolm
|
|
||||||
Issue: "12264"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Fixes
|
|
||||||
body: Improve error message clarity when detecting nodes with space in name
|
|
||||||
time: 2025-12-10T14:39:35.107841-08:00
|
|
||||||
custom:
|
|
||||||
Author: michelleark
|
|
||||||
Issue: "11835"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Under the Hood
|
|
||||||
body: Update jsonschemas for schema.yml and dbt_project.yml deprecations
|
|
||||||
time: 2025-11-19T11:01:10.616676-05:00
|
|
||||||
custom:
|
|
||||||
Author: michelleark
|
|
||||||
Issue: "12180"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Under the Hood
|
|
||||||
body: Replace setuptools and tox with hatch for build, test, and environment management.
|
|
||||||
time: 2025-11-21T14:05:15.838252-05:00
|
|
||||||
custom:
|
|
||||||
Author: emmyoop
|
|
||||||
Issue: "12151"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
kind: Under the Hood
|
|
||||||
body: Add add_catalog_integration call even if we have a pre-existing manifest
|
|
||||||
time: 2025-12-09T13:18:57.043254-08:00
|
|
||||||
custom:
|
|
||||||
Author: colin-rogers-dbt
|
|
||||||
Issue: "12262"
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
changesDir: .changes
|
|
||||||
unreleasedDir: unreleased
|
|
||||||
headerPath: header.tpl.md
|
|
||||||
versionHeaderPath: ""
|
|
||||||
changelogPath: CHANGELOG.md
|
|
||||||
versionExt: md
|
|
||||||
envPrefix: "CHANGIE_"
|
|
||||||
versionFormat: '## dbt-core {{.Version}} - {{.Time.Format "January 02, 2006"}}'
|
|
||||||
kindFormat: '### {{.Kind}}'
|
|
||||||
changeFormat: |-
|
|
||||||
{{- $IssueList := list }}
|
|
||||||
{{- $changes := splitList " " $.Custom.Issue }}
|
|
||||||
{{- range $issueNbr := $changes }}
|
|
||||||
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-core/issues/nbr)" | replace "nbr" $issueNbr }}
|
|
||||||
{{- $IssueList = append $IssueList $changeLink }}
|
|
||||||
{{- end -}}
|
|
||||||
- {{.Body}} ({{ range $index, $element := $IssueList }}{{if $index}}, {{end}}{{$element}}{{end}})
|
|
||||||
|
|
||||||
kinds:
|
|
||||||
- label: Breaking Changes
|
|
||||||
- label: Features
|
|
||||||
- label: Fixes
|
|
||||||
- label: Docs
|
|
||||||
changeFormat: |-
|
|
||||||
{{- $IssueList := list }}
|
|
||||||
{{- $changes := splitList " " $.Custom.Issue }}
|
|
||||||
{{- range $issueNbr := $changes }}
|
|
||||||
{{- $changeLink := "[dbt-docs/#nbr](https://github.com/dbt-labs/dbt-docs/issues/nbr)" | replace "nbr" $issueNbr }}
|
|
||||||
{{- $IssueList = append $IssueList $changeLink }}
|
|
||||||
{{- end -}}
|
|
||||||
- {{.Body}} ({{ range $index, $element := $IssueList }}{{if $index}}, {{end}}{{$element}}{{end}})
|
|
||||||
- label: Under the Hood
|
|
||||||
- label: Dependencies
|
|
||||||
- label: Security
|
|
||||||
|
|
||||||
newlines:
|
|
||||||
afterChangelogHeader: 1
|
|
||||||
afterKind: 1
|
|
||||||
afterChangelogVersion: 1
|
|
||||||
beforeKind: 1
|
|
||||||
endOfVersion: 1
|
|
||||||
|
|
||||||
custom:
|
|
||||||
- key: Author
|
|
||||||
label: GitHub Username(s) (separated by a single space if multiple)
|
|
||||||
type: string
|
|
||||||
minLength: 3
|
|
||||||
- key: Issue
|
|
||||||
label: GitHub Issue Number (separated by a single space if multiple)
|
|
||||||
type: string
|
|
||||||
minLength: 1
|
|
||||||
|
|
||||||
footerFormat: |
|
|
||||||
{{- $contributorDict := dict }}
|
|
||||||
{{- /* ensure we always skip snyk and dependabot */}}
|
|
||||||
{{- $bots := list "dependabot[bot]" "snyk-bot"}}
|
|
||||||
{{- range $change := .Changes }}
|
|
||||||
{{- $authorList := splitList " " $change.Custom.Author }}
|
|
||||||
{{- /* loop through all authors for a single changelog */}}
|
|
||||||
{{- range $author := $authorList }}
|
|
||||||
{{- $authorLower := lower $author }}
|
|
||||||
{{- /* we only want to include non-bot contributors */}}
|
|
||||||
{{- if not (has $authorLower $bots)}}
|
|
||||||
{{- $changeList := splitList " " $change.Custom.Author }}
|
|
||||||
{{- $IssueList := list }}
|
|
||||||
{{- $changeLink := $change.Kind }}
|
|
||||||
{{- $changes := splitList " " $change.Custom.Issue }}
|
|
||||||
{{- range $issueNbr := $changes }}
|
|
||||||
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-core/issues/nbr)" | replace "nbr" $issueNbr }}
|
|
||||||
{{- $IssueList = append $IssueList $changeLink }}
|
|
||||||
{{- end }}
|
|
||||||
{{- /* check if this contributor has other changes associated with them already */}}
|
|
||||||
{{- if hasKey $contributorDict $author }}
|
|
||||||
{{- $contributionList := get $contributorDict $author }}
|
|
||||||
{{- $contributionList = concat $contributionList $IssueList }}
|
|
||||||
{{- $contributorDict := set $contributorDict $author $contributionList }}
|
|
||||||
{{- else }}
|
|
||||||
{{- $contributionList := $IssueList }}
|
|
||||||
{{- $contributorDict := set $contributorDict $author $contributionList }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end}}
|
|
||||||
{{- end}}
|
|
||||||
{{- end }}
|
|
||||||
{{- /* no indentation here for formatting so the final markdown doesn't have unneeded indentations */}}
|
|
||||||
{{- if $contributorDict}}
|
|
||||||
### Contributors
|
|
||||||
{{- range $k,$v := $contributorDict }}
|
|
||||||
- [@{{$k}}](https://github.com/{{$k}}) ({{ range $index, $element := $v }}{{if $index}}, {{end}}{{$element}}{{end}})
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
218
.circleci/config.yml
Normal file
218
.circleci/config.yml
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
version: 2.1
|
||||||
|
jobs:
|
||||||
|
unit:
|
||||||
|
docker: &test_only
|
||||||
|
- image: fishtownanalytics/test-container:9
|
||||||
|
environment:
|
||||||
|
DBT_INVOCATION_ENV: circle
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: tox -e flake8,mypy,unit-py36,unit-py38
|
||||||
|
build-wheels:
|
||||||
|
docker: *test_only
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Build wheels
|
||||||
|
command: |
|
||||||
|
python3.8 -m venv "${PYTHON_ENV}"
|
||||||
|
export PYTHON_BIN="${PYTHON_ENV}/bin/python"
|
||||||
|
$PYTHON_BIN -m pip install -U pip setuptools
|
||||||
|
$PYTHON_BIN -m pip install -r requirements.txt
|
||||||
|
$PYTHON_BIN -m pip install -r dev_requirements.txt
|
||||||
|
/bin/bash ./scripts/build-wheels.sh
|
||||||
|
$PYTHON_BIN ./scripts/collect-dbt-contexts.py > ./dist/context_metadata.json
|
||||||
|
$PYTHON_BIN ./scripts/collect-artifact-schema.py > ./dist/artifact_schemas.json
|
||||||
|
environment:
|
||||||
|
PYTHON_ENV: /home/tox/build_venv/
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./dist
|
||||||
|
destination: dist
|
||||||
|
integration-postgres-py36:
|
||||||
|
docker: &test_and_postgres
|
||||||
|
- image: fishtownanalytics/test-container:9
|
||||||
|
environment:
|
||||||
|
DBT_INVOCATION_ENV: circle
|
||||||
|
- image: postgres
|
||||||
|
name: database
|
||||||
|
environment: &pgenv
|
||||||
|
POSTGRES_USER: "root"
|
||||||
|
POSTGRES_PASSWORD: "password"
|
||||||
|
POSTGRES_DB: "dbt"
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: &setupdb
|
||||||
|
name: Setup postgres
|
||||||
|
command: bash test/setup_db.sh
|
||||||
|
environment:
|
||||||
|
PGHOST: database
|
||||||
|
PGUSER: root
|
||||||
|
PGPASSWORD: password
|
||||||
|
PGDATABASE: postgres
|
||||||
|
- run:
|
||||||
|
name: Run tests
|
||||||
|
command: tox -e integration-postgres-py36
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./logs
|
||||||
|
integration-snowflake-py36:
|
||||||
|
docker: *test_only
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Run tests
|
||||||
|
command: tox -e integration-snowflake-py36
|
||||||
|
no_output_timeout: 1h
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./logs
|
||||||
|
integration-redshift-py36:
|
||||||
|
docker: *test_only
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Run tests
|
||||||
|
command: tox -e integration-redshift-py36
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./logs
|
||||||
|
integration-bigquery-py36:
|
||||||
|
docker: *test_only
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Run tests
|
||||||
|
command: tox -e integration-bigquery-py36
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./logs
|
||||||
|
integration-postgres-py38:
|
||||||
|
docker: *test_and_postgres
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: *setupdb
|
||||||
|
- run:
|
||||||
|
name: Run tests
|
||||||
|
command: tox -e integration-postgres-py38
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./logs
|
||||||
|
integration-snowflake-py38:
|
||||||
|
docker: *test_only
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Run tests
|
||||||
|
command: tox -e integration-snowflake-py38
|
||||||
|
no_output_timeout: 1h
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./logs
|
||||||
|
integration-redshift-py38:
|
||||||
|
docker: *test_only
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Run tests
|
||||||
|
command: tox -e integration-redshift-py38
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./logs
|
||||||
|
integration-bigquery-py38:
|
||||||
|
docker: *test_only
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Run tests
|
||||||
|
command: tox -e integration-bigquery-py38
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./logs
|
||||||
|
|
||||||
|
integration-postgres-py39:
|
||||||
|
docker: *test_and_postgres
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: *setupdb
|
||||||
|
- run:
|
||||||
|
name: Run tests
|
||||||
|
command: tox -e integration-postgres-py39
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./logs
|
||||||
|
integration-snowflake-py39:
|
||||||
|
docker: *test_only
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Run tests
|
||||||
|
command: tox -e integration-snowflake-py39
|
||||||
|
no_output_timeout: 1h
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./logs
|
||||||
|
integration-redshift-py39:
|
||||||
|
docker: *test_only
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Run tests
|
||||||
|
command: tox -e integration-redshift-py39
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./logs
|
||||||
|
integration-bigquery-py39:
|
||||||
|
docker: *test_only
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Run tests
|
||||||
|
command: tox -e integration-bigquery-py39
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./logs
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
test-everything:
|
||||||
|
jobs:
|
||||||
|
- unit
|
||||||
|
- integration-postgres-py36:
|
||||||
|
requires:
|
||||||
|
- unit
|
||||||
|
- integration-redshift-py36:
|
||||||
|
requires:
|
||||||
|
- integration-postgres-py36
|
||||||
|
- integration-bigquery-py36:
|
||||||
|
requires:
|
||||||
|
- integration-postgres-py36
|
||||||
|
- integration-snowflake-py36:
|
||||||
|
requires:
|
||||||
|
- integration-postgres-py36
|
||||||
|
- integration-postgres-py38:
|
||||||
|
requires:
|
||||||
|
- unit
|
||||||
|
- integration-redshift-py38:
|
||||||
|
requires:
|
||||||
|
- integration-postgres-py38
|
||||||
|
- integration-bigquery-py38:
|
||||||
|
requires:
|
||||||
|
- integration-postgres-py38
|
||||||
|
- integration-snowflake-py38:
|
||||||
|
requires:
|
||||||
|
- integration-postgres-py38
|
||||||
|
- integration-postgres-py39:
|
||||||
|
requires:
|
||||||
|
- unit
|
||||||
|
- integration-redshift-py39:
|
||||||
|
requires:
|
||||||
|
- integration-postgres-py39
|
||||||
|
- integration-bigquery-py39:
|
||||||
|
requires:
|
||||||
|
- integration-postgres-py39
|
||||||
|
# - integration-snowflake-py39:
|
||||||
|
# requires:
|
||||||
|
# - integration-postgres-py39
|
||||||
|
- build-wheels:
|
||||||
|
requires:
|
||||||
|
- unit
|
||||||
|
- integration-postgres-py36
|
||||||
|
- integration-redshift-py36
|
||||||
|
- integration-bigquery-py36
|
||||||
|
- integration-snowflake-py36
|
||||||
|
- integration-postgres-py38
|
||||||
|
- integration-redshift-py38
|
||||||
|
- integration-bigquery-py38
|
||||||
|
- integration-snowflake-py38
|
||||||
|
- integration-postgres-py39
|
||||||
|
- integration-redshift-py39
|
||||||
|
- integration-bigquery-py39
|
||||||
|
# - integration-snowflake-py39
|
||||||
14
.flake8
14
.flake8
@@ -1,14 +0,0 @@
|
|||||||
[flake8]
|
|
||||||
select =
|
|
||||||
E
|
|
||||||
W
|
|
||||||
F
|
|
||||||
ignore =
|
|
||||||
W503 # makes Flake8 work like black
|
|
||||||
W504
|
|
||||||
E203 # makes Flake8 work like black
|
|
||||||
E704 # makes Flake8 work like black
|
|
||||||
E741
|
|
||||||
E501 # long line checking is done in black
|
|
||||||
per-file-ignores =
|
|
||||||
*/__init__.py: F401
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# Reformatting dbt-core via black, flake8, mypy, and assorted pre-commit hooks.
|
|
||||||
43e3fc22c4eae4d3d901faba05e33c40f1f1dc5a
|
|
||||||
6
.gitattributes
vendored
6
.gitattributes
vendored
@@ -1,6 +0,0 @@
|
|||||||
core/dbt/task/docs/index.html binary
|
|
||||||
tests/functional/artifacts/data/state/*/manifest.json binary
|
|
||||||
core/dbt/docs/build/html/searchindex.js binary
|
|
||||||
core/dbt/docs/build/html/index.html binary
|
|
||||||
performance/runner/Cargo.lock binary
|
|
||||||
core/dbt/events/types_pb2.py binary
|
|
||||||
18
.github/CODEOWNERS
vendored
18
.github/CODEOWNERS
vendored
@@ -1,18 +0,0 @@
|
|||||||
# This file contains the code owners for the dbt-core repo.
|
|
||||||
# PRs will be automatically assigned for review to the associated
|
|
||||||
# team(s) or person(s) that touches any files that are mapped to them.
|
|
||||||
#
|
|
||||||
# A statement takes precedence over the statements above it so more general
|
|
||||||
# assignments are found at the top with specific assignments being lower in
|
|
||||||
# the ordering (i.e. catch all assignment should be the first item)
|
|
||||||
#
|
|
||||||
# Consult GitHub documentation for formatting guidelines:
|
|
||||||
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#example-of-a-codeowners-file
|
|
||||||
|
|
||||||
# As a default for areas with no assignment,
|
|
||||||
# the core team as a whole will be assigned
|
|
||||||
* @dbt-labs/core-team
|
|
||||||
|
|
||||||
### ARTIFACTS
|
|
||||||
|
|
||||||
/schemas/dbt @dbt-labs/cloud-artifacts
|
|
||||||
97
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
97
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@@ -1,97 +0,0 @@
|
|||||||
name: 🐞 Bug
|
|
||||||
description: Report a bug or an issue you've found with dbt
|
|
||||||
title: "[Bug] <title>"
|
|
||||||
labels: ["bug", "triage"]
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
Thanks for taking the time to fill out this bug report!
|
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: Is this a new bug in dbt-core?
|
|
||||||
description: >
|
|
||||||
In other words, is this an error, flaw, failure or fault in our software?
|
|
||||||
|
|
||||||
If this is a bug that broke existing functionality that used to work, please open a regression issue.
|
|
||||||
If this is a bug in an adapter plugin, please open an issue in the adapter's repository.
|
|
||||||
If this is a bug experienced while using dbt Cloud, please report to [support](mailto:support@getdbt.com).
|
|
||||||
If this is a request for help or troubleshooting code in your own dbt project, please join our [dbt Community Slack](https://www.getdbt.com/community/join-the-community/) or open a [Discussion question](https://github.com/dbt-labs/docs.getdbt.com/discussions).
|
|
||||||
|
|
||||||
Please search to see if an issue already exists for the bug you encountered.
|
|
||||||
options:
|
|
||||||
- label: I believe this is a new bug in dbt-core
|
|
||||||
required: true
|
|
||||||
- label: I have searched the existing issues, and I could not find an existing issue for this bug
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Current Behavior
|
|
||||||
description: A concise description of what you're experiencing.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Expected Behavior
|
|
||||||
description: A concise description of what you expected to happen.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Steps To Reproduce
|
|
||||||
description: Steps to reproduce the behavior.
|
|
||||||
placeholder: |
|
|
||||||
1. In this environment...
|
|
||||||
2. With this config...
|
|
||||||
3. Run '...'
|
|
||||||
4. See error...
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: logs
|
|
||||||
attributes:
|
|
||||||
label: Relevant log output
|
|
||||||
description: |
|
|
||||||
If applicable, log output to help explain your problem.
|
|
||||||
render: shell
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Environment
|
|
||||||
description: |
|
|
||||||
examples:
|
|
||||||
- **OS**: Ubuntu 24.04
|
|
||||||
- **Python**: 3.10.12 (`python3 --version`)
|
|
||||||
- **dbt-core**: 1.1.1 (`dbt --version`)
|
|
||||||
value: |
|
|
||||||
- OS:
|
|
||||||
- Python:
|
|
||||||
- dbt:
|
|
||||||
render: markdown
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: dropdown
|
|
||||||
id: database
|
|
||||||
attributes:
|
|
||||||
label: Which database adapter are you using with dbt?
|
|
||||||
description: If the bug is specific to the database or adapter, please open the issue in that adapter's repository instead
|
|
||||||
multiple: true
|
|
||||||
options:
|
|
||||||
- postgres
|
|
||||||
- redshift
|
|
||||||
- snowflake
|
|
||||||
- bigquery
|
|
||||||
- spark
|
|
||||||
- other (mention it in "Additional Context")
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Additional Context
|
|
||||||
description: |
|
|
||||||
Links? References? Anything that will give us more context about the issue you are encountering!
|
|
||||||
|
|
||||||
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
41
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
41
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Report a bug or an issue you've found with dbt
|
||||||
|
title: ''
|
||||||
|
labels: bug, triage
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Describe the bug
|
||||||
|
A clear and concise description of what the bug is. What command did you run? What happened?
|
||||||
|
|
||||||
|
### Steps To Reproduce
|
||||||
|
In as much detail as possible, please provide steps to reproduce the issue. Sample data that triggers the issue, example model code, etc is all very helpful here.
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
### Screenshots and log output
|
||||||
|
If applicable, add screenshots or log output to help explain your problem.
|
||||||
|
|
||||||
|
### System information
|
||||||
|
**Which database are you using dbt with?**
|
||||||
|
- [ ] postgres
|
||||||
|
- [ ] redshift
|
||||||
|
- [ ] bigquery
|
||||||
|
- [ ] snowflake
|
||||||
|
- [ ] other (specify: ____________)
|
||||||
|
|
||||||
|
|
||||||
|
**The output of `dbt --version`:**
|
||||||
|
```
|
||||||
|
<output goes here>
|
||||||
|
```
|
||||||
|
|
||||||
|
**The operating system you're using:**
|
||||||
|
|
||||||
|
**The output of `python --version`:**
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
Add any other context about the problem here.
|
||||||
18
.github/ISSUE_TEMPLATE/code-docs.yml
vendored
18
.github/ISSUE_TEMPLATE/code-docs.yml
vendored
@@ -1,18 +0,0 @@
|
|||||||
name: 📄 Code docs
|
|
||||||
description: Report an issue for markdown files within this repo, such as README, ARCHITECTURE, etc.
|
|
||||||
title: "[Code docs] <title>"
|
|
||||||
labels: ["triage"]
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
Thanks for taking the time to fill out this code docs issue!
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Please describe the issue and your proposals.
|
|
||||||
description: |
|
|
||||||
Links? References? Anything that will give us more context about the issue you are encountering!
|
|
||||||
|
|
||||||
Tip: You can attach images by clicking this area to highlight it and then dragging files in.
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
17
.github/ISSUE_TEMPLATE/config.yml
vendored
17
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,17 +0,0 @@
|
|||||||
blank_issues_enabled: false
|
|
||||||
contact_links:
|
|
||||||
- name: Documentation
|
|
||||||
url: https://github.com/dbt-labs/docs.getdbt.com/issues/new/choose
|
|
||||||
about: Problems and issues with dbt product documentation hosted on docs.getdbt.com. Issues for markdown files within this repo, such as README, should be opened using the "Code docs" template.
|
|
||||||
- name: Ask the community for help
|
|
||||||
url: https://github.com/dbt-labs/docs.getdbt.com/discussions
|
|
||||||
about: Need help troubleshooting? Check out our guide on how to ask
|
|
||||||
- name: Contact dbt Cloud support
|
|
||||||
url: mailto:support@getdbt.com
|
|
||||||
about: Are you using dbt Cloud? Contact our support team for help!
|
|
||||||
- name: Participate in Discussions
|
|
||||||
url: https://github.com/dbt-labs/dbt-core/discussions
|
|
||||||
about: Do you have a Big Idea for dbt? Read open discussions, or start a new one
|
|
||||||
- name: Create an issue for adapters
|
|
||||||
url: https://github.com/dbt-labs/dbt-adapters/issues/new/choose
|
|
||||||
about: Report a bug or request a feature for an adapter
|
|
||||||
59
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
59
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
@@ -1,59 +0,0 @@
|
|||||||
name: ✨ Feature
|
|
||||||
description: Propose a straightforward extension of dbt functionality
|
|
||||||
title: "[Feature] <title>"
|
|
||||||
labels: ["enhancement", "triage"]
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
Thanks for taking the time to fill out this feature request!
|
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: Is this your first time submitting a feature request?
|
|
||||||
description: >
|
|
||||||
We want to make sure that features are distinct and discoverable,
|
|
||||||
so that other members of the community can find them and offer their thoughts.
|
|
||||||
|
|
||||||
Issues are the right place to request straightforward extensions of existing dbt functionality.
|
|
||||||
For "big ideas" about future capabilities of dbt, we ask that you open a
|
|
||||||
[discussion](https://github.com/dbt-labs/dbt-core/discussions) in the "Ideas" category instead.
|
|
||||||
options:
|
|
||||||
- label: I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
|
|
||||||
required: true
|
|
||||||
- label: I have searched the existing issues, and I could not find an existing issue for this feature
|
|
||||||
required: true
|
|
||||||
- label: I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Describe the feature
|
|
||||||
description: A clear and concise description of what you want to happen.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Describe alternatives you've considered
|
|
||||||
description: |
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Who will this benefit?
|
|
||||||
description: |
|
|
||||||
What kind of use case will this feature be useful for? Please be specific and provide examples, this will help us prioritize properly.
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: input
|
|
||||||
attributes:
|
|
||||||
label: Are you interested in contributing this feature?
|
|
||||||
description: Let us know if you want to write some code, and how we can help.
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Anything else?
|
|
||||||
description: |
|
|
||||||
Links? References? Anything that will give us more context about the feature you are suggesting!
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
23
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
23
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for dbt
|
||||||
|
title: ''
|
||||||
|
labels: enhancement, triage
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Describe the feature
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
### Describe alternatives you've considered
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
Is this feature database-specific? Which database(s) is/are relevant? Please include any other relevant context here.
|
||||||
|
|
||||||
|
### Who will this benefit?
|
||||||
|
What kind of use case will this feature be useful for? Please be specific and provide examples, this will help us prioritize properly.
|
||||||
|
|
||||||
|
### Are you interested in contributing this feature?
|
||||||
|
Let us know if you want to write some code, and how we can help.
|
||||||
67
.github/ISSUE_TEMPLATE/implementation-ticket.yml
vendored
67
.github/ISSUE_TEMPLATE/implementation-ticket.yml
vendored
@@ -1,67 +0,0 @@
|
|||||||
name: 🛠️ Implementation
|
|
||||||
description: This is an implementation ticket intended for use by the maintainers of dbt-core
|
|
||||||
title: "[<project>] <title>"
|
|
||||||
labels: ["user docs"]
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: This is an implementation ticket intended for use by the maintainers of dbt-core
|
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: Housekeeping
|
|
||||||
description: >
|
|
||||||
A couple friendly reminders:
|
|
||||||
1. Remove the `user docs` label if the scope of this work does not require changes to https://docs.getdbt.com/docs: no end-user interface (e.g. yml spec, CLI, error messages, etc) or functional changes
|
|
||||||
2. Link any blocking issues in the "Blocked on" field under the "Core devs & maintainers" project.
|
|
||||||
options:
|
|
||||||
- label: I am a maintainer of dbt-core
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Short description
|
|
||||||
description: |
|
|
||||||
Describe the scope of the ticket, a high-level implementation approach and any tradeoffs to consider
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Acceptance criteria
|
|
||||||
description: |
|
|
||||||
What is the definition of done for this ticket? Include any relevant edge cases and/or test cases
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Suggested Tests
|
|
||||||
description: |
|
|
||||||
Provide scenarios to test. Link to existing similar tests if appropriate.
|
|
||||||
placeholder: |
|
|
||||||
1. Test with no version specified in the schema file and use selection logic on a versioned model for a specific version. Expect pass.
|
|
||||||
2. Test with a version specified in the schema file that is no valid. Expect ParsingError.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Impact to Other Teams
|
|
||||||
description: |
|
|
||||||
Will this change impact other teams? Include details of the kinds of changes required (new tests, code changes, related tickets) and _add the relevant `Impact:[team]` label_.
|
|
||||||
placeholder: |
|
|
||||||
Example: This change impacts `dbt-redshift` because the tests will need to be modified. The `Impact:[Adapter]` label has been added.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Will backports be required?
|
|
||||||
description: |
|
|
||||||
Will this change need to be backported to previous versions? Add details, possible blockers to backporting and _add the relevant backport labels `backport 1.x.latest`_
|
|
||||||
placeholder: |
|
|
||||||
Example: Backport to 1.6.latest, 1.5.latest and 1.4.latest. Since 1.4 isn't using click, the backport may be complicated. The `backport 1.6.latest`, `backport 1.5.latest` and `backport 1.4.latest` labels have been added.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Context
|
|
||||||
description: |
|
|
||||||
Provide the "why", motivation, and alternative approaches considered -- linking to previous refinement issues, spikes and documentation as appropriate
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
93
.github/ISSUE_TEMPLATE/regression-report.yml
vendored
93
.github/ISSUE_TEMPLATE/regression-report.yml
vendored
@@ -1,93 +0,0 @@
|
|||||||
name: ☣️ Regression
|
|
||||||
description: Report a regression you've observed in a newer version of dbt
|
|
||||||
title: "[Regression] <title>"
|
|
||||||
labels: ["bug", "regression", "triage"]
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
Thanks for taking the time to fill out this regression report!
|
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: Is this a regression in a recent version of dbt-core?
|
|
||||||
description: >
|
|
||||||
A regression is when documented functionality works as expected in an older version of dbt-core,
|
|
||||||
and no longer works after upgrading to a newer version of dbt-core
|
|
||||||
options:
|
|
||||||
- label: I believe this is a regression in dbt-core functionality
|
|
||||||
required: true
|
|
||||||
- label: I have searched the existing issues, and I could not find an existing issue for this regression
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Current Behavior
|
|
||||||
description: A concise description of what you're experiencing.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Expected/Previous Behavior
|
|
||||||
description: A concise description of what you expected to happen.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Steps To Reproduce
|
|
||||||
description: Steps to reproduce the behavior.
|
|
||||||
placeholder: |
|
|
||||||
1. In this environment...
|
|
||||||
2. With this config...
|
|
||||||
3. Run '...'
|
|
||||||
4. See error...
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: logs
|
|
||||||
attributes:
|
|
||||||
label: Relevant log output
|
|
||||||
description: |
|
|
||||||
If applicable, log output to help explain your problem.
|
|
||||||
render: shell
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Environment
|
|
||||||
description: |
|
|
||||||
examples:
|
|
||||||
- **OS**: Ubuntu 24.04
|
|
||||||
- **Python**: 3.10.12 (`python3 --version`)
|
|
||||||
- **dbt-core (working version)**: 1.1.1 (`dbt --version`)
|
|
||||||
- **dbt-core (regression version)**: 1.2.0 (`dbt --version`)
|
|
||||||
value: |
|
|
||||||
- OS:
|
|
||||||
- Python:
|
|
||||||
- dbt (working version):
|
|
||||||
- dbt (regression version):
|
|
||||||
render: markdown
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: database
|
|
||||||
attributes:
|
|
||||||
label: Which database adapter are you using with dbt?
|
|
||||||
description: If the regression is specific to the database or adapter, please open the issue in that adapter's repository instead
|
|
||||||
multiple: true
|
|
||||||
options:
|
|
||||||
- postgres
|
|
||||||
- redshift
|
|
||||||
- snowflake
|
|
||||||
- bigquery
|
|
||||||
- spark
|
|
||||||
- other (mention it in "Additional Context")
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Additional Context
|
|
||||||
description: |
|
|
||||||
Links? References? Anything that will give us more context about the issue you are encountering!
|
|
||||||
|
|
||||||
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
223
.github/_README.md
vendored
223
.github/_README.md
vendored
@@ -1,223 +0,0 @@
|
|||||||
<!-- GitHub will publish this readme on the main repo page if the name is `README.md` so we've added the leading underscore to prevent this -->
|
|
||||||
<!-- Do not rename this file `README.md` -->
|
|
||||||
<!-- See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes -->
|
|
||||||
|
|
||||||
## What are GitHub Actions?
|
|
||||||
|
|
||||||
GitHub Actions are used for many different purposes. We use them to run tests in CI, validate PRs are in an expected state, and automate processes.
|
|
||||||
|
|
||||||
- [Overview of GitHub Actions](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions)
|
|
||||||
- [What's a workflow?](https://docs.github.com/en/actions/using-workflows/about-workflows)
|
|
||||||
- [GitHub Actions guides](https://docs.github.com/en/actions/guides)
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
## Where do actions and workflows live
|
|
||||||
|
|
||||||
We try to maintain actions that are shared across repositories in a single place so that necesary changes can be made in a single place.
|
|
||||||
|
|
||||||
[dbt-labs/actions](https://github.com/dbt-labs/actions/) is the central repository of actions and workflows we use across repositories.
|
|
||||||
|
|
||||||
GitHub Actions also live locally within a repository. The workflows can be found at `.github/workflows` from the root of the repository. These should be specific to that code base.
|
|
||||||
|
|
||||||
Note: We are actively moving actions into the central Action repository so there is currently some duplication across repositories.
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
## Basics of Using Actions
|
|
||||||
|
|
||||||
### Viewing Output
|
|
||||||
|
|
||||||
- View the detailed action output for your PR in the **Checks** tab of the PR. This only shows the most recent run. You can also view high level **Checks** output at the bottom on the PR.
|
|
||||||
|
|
||||||
- View _all_ action output for a repository from the [**Actions**](https://github.com/dbt-labs/dbt-core/actions) tab. Workflow results last 1 year. Artifacts last 90 days, unless specified otherwise in individual workflows.
|
|
||||||
|
|
||||||
This view often shows what seem like duplicates of the same workflow. This occurs when files are renamed but the workflow name has not changed. These are in fact _not_ duplicates.
|
|
||||||
|
|
||||||
You can see the branch the workflow runs from in this view. It is listed in the table between the workflow name and the time/duration of the run. When blank, the workflow is running in the context of the `main` branch.
|
|
||||||
|
|
||||||
### How to view what workflow file is being referenced from a run
|
|
||||||
|
|
||||||
- When viewing the output of a specific workflow run, click the 3 dots at the top right of the display. There will be an option to `View workflow file`.
|
|
||||||
|
|
||||||
### How to manually run a workflow
|
|
||||||
|
|
||||||
- If a workflow has the `on: workflow_dispatch` trigger, it can be manually triggered
|
|
||||||
- From the [**Actions**](https://github.com/dbt-labs/dbt-core/actions) tab, find the workflow you want to run, select it and fill in any inputs requied. That's it!
|
|
||||||
|
|
||||||
### How to re-run jobs
|
|
||||||
|
|
||||||
- From the UI you can rerun from failure
|
|
||||||
- You can retrigger the cla check by commenting on the PR with `@cla-bot check`
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
## General Standards
|
|
||||||
|
|
||||||
### Permissions
|
|
||||||
- By default, workflows have read permissions in the repository for the contents scope only when no permissions are explicitly set.
|
|
||||||
- It is best practice to always define the permissions explicitly. This will allow actions to continue to work when the default permissions on the repository are changed. It also allows explicit grants of the least permissions possible.
|
|
||||||
- There are a lot of permissions available. [Read up on them](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs) if you're unsure what to use.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: write
|
|
||||||
```
|
|
||||||
|
|
||||||
### Secrets
|
|
||||||
- When to use a [Personal Access Token (PAT)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) vs the [GITHUB_TOKEN](https://docs.github.com/en/actions/security-guides/automatic-token-authentication) generated for the action?
|
|
||||||
|
|
||||||
The `GITHUB_TOKEN` is used by default. In most cases it is sufficient for what you need.
|
|
||||||
|
|
||||||
If you expect the workflow to result in a commit to that should retrigger workflows, you will need to use a Personal Access Token for the bot to commit the file. When using the GITHUB_TOKEN, the resulting commit will not trigger another GitHub Actions Workflow run. This is due to limitations set by GitHub. See [the docs](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow) for a more detailed explanation.
|
|
||||||
|
|
||||||
For example, we must use a PAT in our workflow to commit a new changelog yaml file for bot PRs. Once the file has been committed to the branch, it should retrigger the check to validate that a changelog exists on the PR. Otherwise, it would stay in a failed state since the check would never retrigger.
|
|
||||||
|
|
||||||
### Triggers
|
|
||||||
You can configure your workflows to run when specific activity on GitHub happens, at a scheduled time, or when an event outside of GitHub occurs. Read more details in the [GitHub docs](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows).
|
|
||||||
|
|
||||||
These triggers are under the `on` key of the workflow and more than one can be listed.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- "main"
|
|
||||||
- "*.latest"
|
|
||||||
- "releases/*"
|
|
||||||
pull_request:
|
|
||||||
# catch when the PR is opened with the label or when the label is added
|
|
||||||
types: [opened, labeled]
|
|
||||||
workflow_dispatch:
|
|
||||||
```
|
|
||||||
|
|
||||||
Some triggers of note that we use:
|
|
||||||
|
|
||||||
- `push` - Runs your workflow when you push a commit or tag.
|
|
||||||
- `pull_request` - Runs your workflow when activity on a pull request in the workflow's repository occurs. Takes in a list of activity types (opened, labeled, etc) if appropriate.
|
|
||||||
- `pull_request_target` - Same as `pull_request` but runs in the context of the PR target branch.
|
|
||||||
- `workflow_call` - used with reusable workflows. Triggered by another workflow calling it.
|
|
||||||
- `workflow_dispatch` - Gives the ability to manually trigger a workflow from the GitHub API, GitHub CLI, or GitHub browser interface.
|
|
||||||
|
|
||||||
|
|
||||||
### Basic Formatting
|
|
||||||
- Add a description of what your workflow does at the top in this format
|
|
||||||
|
|
||||||
```
|
|
||||||
# **what?**
|
|
||||||
# Describe what the action does.
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# Why does this action exist?
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# How/when will it be triggered?
|
|
||||||
```
|
|
||||||
|
|
||||||
- Leave blank lines between steps and jobs
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
jobs:
|
|
||||||
dependency_changelog:
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Get File Name Timestamp
|
|
||||||
id: filename_time
|
|
||||||
uses: nanzm/get-time-action@v1.1
|
|
||||||
with:
|
|
||||||
format: 'YYYYMMDD-HHmmss'
|
|
||||||
|
|
||||||
- name: Get File Content Timestamp
|
|
||||||
id: file_content_time
|
|
||||||
uses: nanzm/get-time-action@v1.1
|
|
||||||
with:
|
|
||||||
format: 'YYYY-MM-DDTHH:mm:ss.000000-05:00'
|
|
||||||
|
|
||||||
- name: Generate Filepath
|
|
||||||
id: fp
|
|
||||||
run: |
|
|
||||||
FILEPATH=.changes/unreleased/Dependencies-${{ steps.filename_time.outputs.time }}.yaml
|
|
||||||
echo "FILEPATH=$FILEPATH" >> $GITHUB_OUTPUT
|
|
||||||
```
|
|
||||||
|
|
||||||
- Print out all variables you will reference as the first step of a job. This allows for easier debugging. The first job should log all inputs. Subsequent jobs should reference outputs of other jobs, if present.
|
|
||||||
|
|
||||||
When possible, generate variables at the top of your workflow in a single place to reference later. This is not always strictly possible since you may generate a value to be used later mid-workflow.
|
|
||||||
|
|
||||||
Be sure to use quotes around these logs so special characters are not interpreted.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
job1:
|
|
||||||
- name: "[DEBUG] Print Variables"
|
|
||||||
run: |
|
|
||||||
echo "all variables defined as inputs"
|
|
||||||
echo "The last commit sha in the release: ${{ inputs.sha }}"
|
|
||||||
echo "The release version number: ${{ inputs.version_number }}"
|
|
||||||
echo "The changelog_path: ${{ inputs.changelog_path }}"
|
|
||||||
echo "The build_script_path: ${{ inputs.build_script_path }}"
|
|
||||||
echo "The s3_bucket_name: ${{ inputs.s3_bucket_name }}"
|
|
||||||
echo "The package_test_command: ${{ inputs.package_test_command }}"
|
|
||||||
|
|
||||||
# collect all the variables that need to be used in subsequent jobs
|
|
||||||
- name: Set Variables
|
|
||||||
id: variables
|
|
||||||
run: |
|
|
||||||
echo "important_path='performance/runner/Cargo.toml'" >> $GITHUB_OUTPUT
|
|
||||||
echo "release_id=${{github.event.inputs.release_id}}" >> $GITHUB_OUTPUT
|
|
||||||
echo "open_prs=${{github.event.inputs.open_prs}}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
job2:
|
|
||||||
needs: [job1]
|
|
||||||
- name: "[DEBUG] Print Variables"
|
|
||||||
run: |
|
|
||||||
echo "all variables defined in job1 > Set Variables > outputs"
|
|
||||||
echo "important_path: ${{ needs.job1.outputs.important_path }}"
|
|
||||||
echo "release_id: ${{ needs.job1.outputs.release_id }}"
|
|
||||||
echo "open_prs: ${{ needs.job1.outputs.open_prs }}"
|
|
||||||
```
|
|
||||||
|
|
||||||
- When it's not obvious what something does, add a comment!
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
## Tips
|
|
||||||
|
|
||||||
### Context
|
|
||||||
- The [GitHub CLI](https://cli.github.com/) is available in the default runners
|
|
||||||
- Actions run in your context. ie, using an action from the marketplace that uses the GITHUB_TOKEN uses the GITHUB_TOKEN generated by your workflow run.
|
|
||||||
|
|
||||||
### Runners
|
|
||||||
- We dynamically set runners based on repository vars. Admins can view repository vars and reset them. Current values are the following but are subject to change:
|
|
||||||
- `vars.UBUNTU_LATEST` -> `ubuntu-latest`
|
|
||||||
- `vars.WINDOWS_LATEST` -> `windows-latest`
|
|
||||||
- `vars.MACOS_LATEST` -> `macos-14`
|
|
||||||
|
|
||||||
### Actions from the Marketplace
|
|
||||||
- Don’t use external actions for things that can easily be accomplished manually.
|
|
||||||
- Always read through what an external action does before using it! Often an action in the GitHub Actions Marketplace can be replaced with a few lines in bash. This is much more maintainable (and won’t change under us) and clear as to what’s actually happening. It also prevents any
|
|
||||||
- Pin actions _we don't control_ to tags.
|
|
||||||
|
|
||||||
### Connecting to AWS
|
|
||||||
- Authenticate with the aws managed workflow
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Configure AWS credentials from Test account
|
|
||||||
uses: aws-actions/configure-aws-credentials@v2
|
|
||||||
with:
|
|
||||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
aws-region: us-east-1
|
|
||||||
```
|
|
||||||
|
|
||||||
- Then access with the aws command that comes installed on the action runner machines
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Copy Artifacts from S3 via CLI
|
|
||||||
run: aws s3 cp ${{ env.s3_bucket }} . --recursive
|
|
||||||
```
|
|
||||||
|
|
||||||
### Testing
|
|
||||||
|
|
||||||
- Depending on what your action does, you may be able to use [`act`](https://github.com/nektos/act) to test the action locally. Some features of GitHub Actions do not work with `act`, among those are reusable workflows. If you can't use `act`, you'll have to push your changes up before being able to test. This can be slow.
|
|
||||||
14
.github/actions/latest-wrangler/Dockerfile
vendored
14
.github/actions/latest-wrangler/Dockerfile
vendored
@@ -1,14 +0,0 @@
|
|||||||
FROM python:3-slim AS builder
|
|
||||||
ADD . /app
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# We are installing a dependency here directly into our app source dir
|
|
||||||
RUN pip install --target=/app requests packaging
|
|
||||||
|
|
||||||
# A distroless container image with Python and some basics like SSL certificates
|
|
||||||
# https://github.com/GoogleContainerTools/distroless
|
|
||||||
FROM gcr.io/distroless/python3-debian10
|
|
||||||
COPY --from=builder /app /app
|
|
||||||
WORKDIR /app
|
|
||||||
ENV PYTHONPATH /app
|
|
||||||
CMD ["/app/main.py"]
|
|
||||||
50
.github/actions/latest-wrangler/README.md
vendored
50
.github/actions/latest-wrangler/README.md
vendored
@@ -1,50 +0,0 @@
|
|||||||
# Github package 'latest' tag wrangler for containers
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
Plug in the necessary inputs to determine if the container being built should be tagged 'latest; at the package level, for example `dbt-redshift:latest`.
|
|
||||||
|
|
||||||
## Inputs
|
|
||||||
| Input | Description |
|
|
||||||
| - | - |
|
|
||||||
| `package` | Name of the GH package to check against |
|
|
||||||
| `new_version` | Semver of new container |
|
|
||||||
| `gh_token` | GH token with package read scope|
|
|
||||||
| `halt_on_missing` | Return non-zero exit code if requested package does not exist. (defaults to false)|
|
|
||||||
|
|
||||||
|
|
||||||
## Outputs
|
|
||||||
| Output | Description |
|
|
||||||
| - | - |
|
|
||||||
| `latest` | Wether or not the new container should be tagged 'latest'|
|
|
||||||
| `minor_latest` | Wether or not the new container should be tagged major.minor.latest |
|
|
||||||
|
|
||||||
## Example workflow
|
|
||||||
```yaml
|
|
||||||
name: Ship it!
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
package:
|
|
||||||
description: The package to publish
|
|
||||||
required: true
|
|
||||||
version_number:
|
|
||||||
description: The version number
|
|
||||||
required: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Wrangle latest tag
|
|
||||||
id: is_latest
|
|
||||||
uses: ./.github/actions/latest-wrangler
|
|
||||||
with:
|
|
||||||
package: ${{ github.event.inputs.package }}
|
|
||||||
new_version: ${{ github.event.inputs.new_version }}
|
|
||||||
gh_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Print the results
|
|
||||||
run: |
|
|
||||||
echo "Is it latest? Survey says: ${{ steps.is_latest.outputs.latest }} !"
|
|
||||||
echo "Is it minor.latest? Survey says: ${{ steps.is_latest.outputs.minor_latest }} !"
|
|
||||||
```
|
|
||||||
21
.github/actions/latest-wrangler/action.yml
vendored
21
.github/actions/latest-wrangler/action.yml
vendored
@@ -1,21 +0,0 @@
|
|||||||
name: "GitHub package `latest` tag wrangler for containers"
|
|
||||||
description: "Determines if the published image should include `latest` tags"
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
package_name:
|
|
||||||
description: "Package being published (i.e. `dbt-core`, `dbt-redshift`, etc.)"
|
|
||||||
required: true
|
|
||||||
new_version:
|
|
||||||
description: "SemVer of the package being published (i.e. 1.7.2, 1.8.0a1, etc.)"
|
|
||||||
required: true
|
|
||||||
github_token:
|
|
||||||
description: "Auth token for GitHub (must have view packages scope)"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
tags:
|
|
||||||
description: "A list of tags to associate with this version"
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "docker"
|
|
||||||
image: "Dockerfile"
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
name: Ship it!
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
package:
|
|
||||||
description: The package to publish
|
|
||||||
required: true
|
|
||||||
version_number:
|
|
||||||
description: The version number
|
|
||||||
required: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Wrangle latest tag
|
|
||||||
id: is_latest
|
|
||||||
uses: ./.github/actions/latest-wrangler
|
|
||||||
with:
|
|
||||||
package: ${{ github.event.inputs.package }}
|
|
||||||
new_version: ${{ github.event.inputs.new_version }}
|
|
||||||
gh_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Print the results
|
|
||||||
run: |
|
|
||||||
echo "Is it latest? Survey says: ${{ steps.is_latest.outputs.latest }} !"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"inputs": {
|
|
||||||
"version_number": "1.0.1",
|
|
||||||
"package": "dbt-redshift"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
72
.github/actions/latest-wrangler/main.py
vendored
72
.github/actions/latest-wrangler/main.py
vendored
@@ -1,72 +0,0 @@
|
|||||||
import os
|
|
||||||
import sys
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import requests
|
|
||||||
from packaging.version import Version, parse
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
package_name: str = os.environ["INPUT_PACKAGE_NAME"]
|
|
||||||
new_version: Version = parse(os.environ["INPUT_NEW_VERSION"])
|
|
||||||
github_token: str = os.environ["INPUT_GITHUB_TOKEN"]
|
|
||||||
|
|
||||||
response = _package_metadata(package_name, github_token)
|
|
||||||
published_versions = _published_versions(response)
|
|
||||||
new_version_tags = _new_version_tags(new_version, published_versions)
|
|
||||||
_register_tags(new_version_tags, package_name)
|
|
||||||
|
|
||||||
|
|
||||||
def _package_metadata(package_name: str, github_token: str) -> requests.Response:
|
|
||||||
url = f"https://api.github.com/orgs/dbt-labs/packages/container/{package_name}/versions"
|
|
||||||
return requests.get(url, auth=("", github_token))
|
|
||||||
|
|
||||||
|
|
||||||
def _published_versions(response: requests.Response) -> List[Version]:
|
|
||||||
package_metadata = response.json()
|
|
||||||
return [
|
|
||||||
parse(tag)
|
|
||||||
for version in package_metadata
|
|
||||||
for tag in version["metadata"]["container"]["tags"]
|
|
||||||
if "latest" not in tag
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def _new_version_tags(new_version: Version, published_versions: List[Version]) -> List[str]:
|
|
||||||
# the package version is always a tag
|
|
||||||
tags = [str(new_version)]
|
|
||||||
|
|
||||||
# pre-releases don't get tagged with `latest`
|
|
||||||
if new_version.is_prerelease:
|
|
||||||
return tags
|
|
||||||
|
|
||||||
if new_version > max(published_versions):
|
|
||||||
tags.append("latest")
|
|
||||||
|
|
||||||
published_patches = [
|
|
||||||
version
|
|
||||||
for version in published_versions
|
|
||||||
if version.major == new_version.major and version.minor == new_version.minor
|
|
||||||
]
|
|
||||||
if new_version > max(published_patches):
|
|
||||||
tags.append(f"{new_version.major}.{new_version.minor}.latest")
|
|
||||||
|
|
||||||
return tags
|
|
||||||
|
|
||||||
|
|
||||||
def _register_tags(tags: List[str], package_name: str) -> None:
|
|
||||||
fully_qualified_tags = ",".join([f"ghcr.io/dbt-labs/{package_name}:{tag}" for tag in tags])
|
|
||||||
github_output = os.environ.get("GITHUB_OUTPUT")
|
|
||||||
with open(github_output, "at", encoding="utf-8") as gh_output:
|
|
||||||
gh_output.write(f"fully_qualified_tags={fully_qualified_tags}")
|
|
||||||
|
|
||||||
|
|
||||||
def _validate_response(response: requests.Response) -> None:
|
|
||||||
message = response["message"]
|
|
||||||
if response.status_code != 200:
|
|
||||||
print(f"Call to GitHub API failed: {response.status_code} - {message}")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
name: "Set up postgres (windows)"
|
|
||||||
description: "Set up postgres service on windows vm for dbt integration tests"
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- shell: pwsh
|
|
||||||
run: |
|
|
||||||
Write-Host -Object "Installing PostgreSQL 16 as windows service..."
|
|
||||||
$installerArgs = @("--install_runtimes 0", "--superpassword root", "--enable_acledit 1", "--unattendedmodeui none", "--mode unattended")
|
|
||||||
$filePath = Invoke-DownloadWithRetry -Url "https://get.enterprisedb.com/postgresql/postgresql-16.1-1-windows-x64.exe" -Path "$env:PGROOT/postgresql-16.1-1-windows-x64.exe"
|
|
||||||
Start-Process -FilePath $filePath -ArgumentList $installerArgs -Wait -PassThru
|
|
||||||
|
|
||||||
Write-Host -Object "Validating PostgreSQL 16 Install..."
|
|
||||||
Get-Service -Name postgresql*
|
|
||||||
$pgReady = Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
|
|
||||||
$exitCode = $pgReady.ExitCode
|
|
||||||
if ($exitCode -ne 0) {
|
|
||||||
Write-Host -Object "PostgreSQL is not ready. Exitcode: $exitCode"
|
|
||||||
exit $exitCode
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host -Object "Starting PostgreSQL 16 Service..."
|
|
||||||
$pgService = Get-Service -Name postgresql-x64-16
|
|
||||||
Set-Service -InputObject $pgService -Status running -StartupType automatic
|
|
||||||
$env:Path += ";$env:PGBIN"
|
|
||||||
bash ${{ github.action_path }}/setup_db.sh
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../scripts/setup_db.sh
|
|
||||||
169
.github/dbt-postgres-testing.yml
vendored
169
.github/dbt-postgres-testing.yml
vendored
@@ -1,169 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# Runs all tests in dbt-postgres with this branch of dbt-core to ensure nothing is broken
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# Ensure dbt-core changes do not break dbt-postgres, as a basic proxy for other adapters
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# This will run when trying to merge a PR into main.
|
|
||||||
# It can also be manually triggered.
|
|
||||||
|
|
||||||
# This workflow can be skipped by adding the "Skip Postgres Testing" label to the PR. This is
|
|
||||||
# useful when making a change in both `dbt-postgres` and `dbt-core` where the changes are dependant
|
|
||||||
# and cause the other repository to break.
|
|
||||||
|
|
||||||
name: "dbt-postgres Tests"
|
|
||||||
run-name: >-
|
|
||||||
${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call')
|
|
||||||
&& format('dbt-postgres@{0} with dbt-core@{1}', inputs.dbt-postgres-ref, inputs.dbt-core-ref)
|
|
||||||
|| 'dbt-postgres@main with dbt-core branch' }}
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- "main"
|
|
||||||
- "*.latest"
|
|
||||||
- "releases/*"
|
|
||||||
pull_request:
|
|
||||||
merge_group:
|
|
||||||
types: [checks_requested]
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
dbt-postgres-ref:
|
|
||||||
description: "The branch of dbt-postgres to test against"
|
|
||||||
default: "main"
|
|
||||||
dbt-core-ref:
|
|
||||||
description: "The branch of dbt-core to test against"
|
|
||||||
default: "main"
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
dbt-postgres-ref:
|
|
||||||
description: "The branch of dbt-postgres to test against"
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: "main"
|
|
||||||
dbt-core-ref:
|
|
||||||
description: "The branch of dbt-core to test against"
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: "main"
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
# will cancel previous workflows triggered by the same event
|
|
||||||
# and for the same ref for PRs/merges or same SHA otherwise
|
|
||||||
# and for the same inputs on workflow_dispatch or workflow_call
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(fromJson('["pull_request", "merge_group"]'), github.event_name) && github.event.pull_request.head.ref || github.sha }}-${{ contains(fromJson('["workflow_call", "workflow_dispatch"]'), github.event_name) && github.event.inputs.dbt-postgres-ref && github.event.inputs.dbt-core-ref || github.sha }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
job-prep:
|
|
||||||
# This allow us to run the workflow on pull_requests as well so we can always run unit tests
|
|
||||||
# and only run integration tests on merge for time purposes
|
|
||||||
name: Setup Repo Refs
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
dbt-postgres-ref: ${{ steps.core-ref.outputs.ref }}
|
|
||||||
dbt-core-ref: ${{ steps.common-ref.outputs.ref }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "Input Refs"
|
|
||||||
id: job-inputs
|
|
||||||
run: |
|
|
||||||
echo "inputs.dbt-postgres-ref=${{ inputs.dbt-postgres-ref }}"
|
|
||||||
echo "inputs.dbt-core-ref=${{ inputs.dbt-core-ref }}"
|
|
||||||
|
|
||||||
- name: "Determine dbt-postgres ref"
|
|
||||||
id: core-ref
|
|
||||||
run: |
|
|
||||||
if [[ -z "${{ inputs.dbt-postgres-ref }}" ]]; then
|
|
||||||
REF="main"
|
|
||||||
else
|
|
||||||
REF=${{ inputs.dbt-postgres-ref }}
|
|
||||||
fi
|
|
||||||
echo "ref=$REF" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: "Determine dbt-core ref"
|
|
||||||
id: common-ref
|
|
||||||
run: |
|
|
||||||
if [[ -z "${{ inputs.dbt-core-ref }}" ]]; then
|
|
||||||
# these will be commits instead of branches
|
|
||||||
if [[ "${{ github.event_name }}" == "merge_group" ]]; then
|
|
||||||
REF=${{ github.event.merge_group.head_sha }}
|
|
||||||
else
|
|
||||||
REF=${{ github.event.pull_request.base.sha }}
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
REF=${{ inputs.dbt-core-ref }}
|
|
||||||
fi
|
|
||||||
echo "ref=$REF" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: "Final Refs"
|
|
||||||
run: |
|
|
||||||
echo "dbt-postgres-ref=${{ steps.core-ref.outputs.ref }}"
|
|
||||||
echo "dbt-core-ref=${{ steps.common-ref.outputs.ref }}"
|
|
||||||
|
|
||||||
integration-tests-postgres:
|
|
||||||
name: "dbt-postgres integration tests"
|
|
||||||
needs: [job-prep]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: "./dbt-postgres"
|
|
||||||
environment:
|
|
||||||
name: "dbt-postgres"
|
|
||||||
env:
|
|
||||||
POSTGRES_TEST_HOST: ${{ vars.POSTGRES_TEST_HOST }}
|
|
||||||
POSTGRES_TEST_PORT: ${{ vars.POSTGRES_TEST_PORT }}
|
|
||||||
POSTGRES_TEST_USER: ${{ vars.POSTGRES_TEST_USER }}
|
|
||||||
POSTGRES_TEST_PASS: ${{ secrets.POSTGRES_TEST_PASS }}
|
|
||||||
POSTGRES_TEST_DATABASE: ${{ vars.POSTGRES_TEST_DATABASE }}
|
|
||||||
POSTGRES_TEST_THREADS: ${{ vars.POSTGRES_TEST_THREADS }}
|
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
ports:
|
|
||||||
- ${{ vars.POSTGRES_TEST_PORT }}:5432
|
|
||||||
steps:
|
|
||||||
- name: "Check out dbt-adapters@${{ needs.job-prep.outputs.dbt-postgres-ref }}"
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: dbt-labs/dbt-adapters
|
|
||||||
ref: ${{ needs.job-prep.outputs.dbt-postgres-ref }}
|
|
||||||
|
|
||||||
- name: "Set up Python"
|
|
||||||
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: ${{ inputs.python-version }}
|
|
||||||
|
|
||||||
- name: "Set environment variables"
|
|
||||||
run: |
|
|
||||||
echo "HATCH_PYTHON=${{ inputs.python-version }}" >> $GITHUB_ENV
|
|
||||||
echo "PIP_ONLY_BINARY=psycopg2-binary" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: "Setup test database"
|
|
||||||
run: psql -f ./scripts/setup_test_database.sql
|
|
||||||
env:
|
|
||||||
PGHOST: ${{ vars.POSTGRES_TEST_HOST }}
|
|
||||||
PGPORT: ${{ vars.POSTGRES_TEST_PORT }}
|
|
||||||
PGUSER: postgres
|
|
||||||
PGPASSWORD: postgres
|
|
||||||
PGDATABASE: postgres
|
|
||||||
|
|
||||||
- name: "Install hatch"
|
|
||||||
uses: pypa/hatch@257e27e51a6a5616ed08a39a408a21c35c9931bc # pypa/hatch@install
|
|
||||||
|
|
||||||
- name: "Run integration tests"
|
|
||||||
run: hatch run ${{ inputs.hatch-env }}:integration-tests
|
|
||||||
32
.github/dependabot.yml
vendored
32
.github/dependabot.yml
vendored
@@ -1,32 +0,0 @@
|
|||||||
version: 2
|
|
||||||
updates:
|
|
||||||
# python dependencies
|
|
||||||
- package-ecosystem: "pip"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
rebase-strategy: "disabled"
|
|
||||||
- package-ecosystem: "pip"
|
|
||||||
directory: "/core"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
rebase-strategy: "disabled"
|
|
||||||
|
|
||||||
# docker dependencies
|
|
||||||
- package-ecosystem: "docker"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "weekly"
|
|
||||||
rebase-strategy: "disabled"
|
|
||||||
- package-ecosystem: "docker"
|
|
||||||
directory: "/docker"
|
|
||||||
schedule:
|
|
||||||
interval: "weekly"
|
|
||||||
rebase-strategy: "disabled"
|
|
||||||
|
|
||||||
# github dependencies
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "weekly"
|
|
||||||
rebase-strategy: "disabled"
|
|
||||||
31
.github/pull_request_template.md
vendored
31
.github/pull_request_template.md
vendored
@@ -1,33 +1,22 @@
|
|||||||
Resolves #
|
resolves #
|
||||||
|
|
||||||
<!---
|
<!---
|
||||||
Include the number of the issue addressed by this PR above, if applicable.
|
Include the number of the issue addressed by this PR above if applicable.
|
||||||
PRs for code changes without an associated issue *will not be merged*.
|
PRs for code changes without an associated issue *will not be merged*.
|
||||||
See CONTRIBUTING.md for more information.
|
See CONTRIBUTING.md for more information.
|
||||||
|
|
||||||
Add the `user docs` label to this PR if it will need docs changes. An
|
Example:
|
||||||
issue will get opened in docs.getdbt.com upon successful merge of this PR.
|
resolves #1234
|
||||||
-->
|
-->
|
||||||
|
|
||||||
### Problem
|
|
||||||
|
|
||||||
<!---
|
### Description
|
||||||
Describe the problem this PR is solving. What is the application state
|
|
||||||
before this PR is merged?
|
|
||||||
-->
|
|
||||||
|
|
||||||
### Solution
|
<!--- Describe the Pull Request here -->
|
||||||
|
|
||||||
<!---
|
|
||||||
Describe the way this PR solves the above problem. Add as much detail as you
|
|
||||||
can to help reviewers understand your changes. Include any alternatives and
|
|
||||||
tradeoffs you considered.
|
|
||||||
-->
|
|
||||||
|
|
||||||
### Checklist
|
### Checklist
|
||||||
|
- [ ] I have signed the [CLA](https://docs.getdbt.com/docs/contributor-license-agreements)
|
||||||
- [ ] I have read [the contributing guide](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md) and understand what's expected of me.
|
- [ ] I have run this code in development and it appears to resolve the stated issue
|
||||||
- [ ] I have run this code in development, and it appears to resolve the stated issue.
|
- [ ] This PR includes tests, or tests are not required/relevant for this PR
|
||||||
- [ ] This PR includes tests, or tests are not required or relevant for this PR.
|
- [ ] I have updated the `CHANGELOG.md` and added information about my change to the "dbt next" section.
|
||||||
- [ ] This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
|
|
||||||
- [ ] This PR includes [type annotations](https://docs.python.org/3/library/typing.html) for new and modified functions.
|
|
||||||
|
|||||||
186
.github/workflows/artifact-reviews.yml
vendored
186
.github/workflows/artifact-reviews.yml
vendored
@@ -1,186 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# Enforces 2 reviews when artifact or validation files are modified.
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# Ensure artifact changes receive proper review from designated team members. GitHub doesn't support
|
|
||||||
# multiple reviews on a single PR based on files changed, so we need to enforce this manually.
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# This will run when reviews are submitted and dismissed.
|
|
||||||
|
|
||||||
name: "Enforce Additional Reviews on Artifact and Validations Changes"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
checks: write
|
|
||||||
pull-requests: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
on:
|
|
||||||
# trigger check on review events. use pull_request_target for forks.
|
|
||||||
pull_request_target:
|
|
||||||
types: [opened, reopened, ready_for_review, synchronize, review_requested]
|
|
||||||
pull_request_review:
|
|
||||||
types: [submitted, edited, dismissed]
|
|
||||||
|
|
||||||
# only run this once per PR at a time
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
env:
|
|
||||||
required_approvals: 2
|
|
||||||
team: "core-group"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-reviews:
|
|
||||||
name: "Validate Additional Reviews"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: "Get list of changed files"
|
|
||||||
id: changed_files
|
|
||||||
run: |
|
|
||||||
# Fetch files as JSON and process with jq to sanitize output
|
|
||||||
gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files \
|
|
||||||
| jq -r '.[].filename' \
|
|
||||||
| while IFS= read -r file; do
|
|
||||||
# Sanitize the filename by removing any special characters and command injection attempts
|
|
||||||
clean_file=$(echo "$file" | sed 's/[^a-zA-Z0-9\.\/\-_]//g')
|
|
||||||
echo "$clean_file"
|
|
||||||
done > changed_files.txt
|
|
||||||
echo "CHANGED_FILES<<EOF" >> $GITHUB_OUTPUT
|
|
||||||
cat changed_files.txt >> $GITHUB_OUTPUT
|
|
||||||
echo "EOF" >> $GITHUB_OUTPUT
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: "Check if any artifact files changed"
|
|
||||||
id: artifact_files_changed
|
|
||||||
run: |
|
|
||||||
artifact_changes=false
|
|
||||||
while IFS= read -r file; do
|
|
||||||
# Only process if file path looks legitimate
|
|
||||||
if [[ "$file" =~ ^[a-zA-Z0-9\.\/\-_]+$ ]]; then
|
|
||||||
if [[ "$file" == "core/dbt/artifacts/"* ]] ; then
|
|
||||||
artifact_changes=true
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done < changed_files.txt
|
|
||||||
echo "artifact_changes=$artifact_changes" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: "Get Core Team Members"
|
|
||||||
if: steps.artifact_files_changed.outputs.artifact_changes == 'true'
|
|
||||||
id: core_members
|
|
||||||
run: |
|
|
||||||
gh api -H "Accept: application/vnd.github+json" \
|
|
||||||
/orgs/dbt-labs/teams/${{ env.team }}/members > core_members.json
|
|
||||||
|
|
||||||
# Extract usernames and set as multiline output
|
|
||||||
echo "membership<<EOF" >> $GITHUB_OUTPUT
|
|
||||||
jq -r '.[].login' core_members.json >> $GITHUB_OUTPUT
|
|
||||||
echo "EOF" >> $GITHUB_OUTPUT
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.IT_TEAM_MEMBERSHIP }}
|
|
||||||
|
|
||||||
- name: "Verify ${{ env.required_approvals }} core team approvals"
|
|
||||||
if: steps.artifact_files_changed.outputs.artifact_changes == 'true'
|
|
||||||
id: check_approvals
|
|
||||||
run: |
|
|
||||||
|
|
||||||
# Get all reviews
|
|
||||||
REVIEWS=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews)
|
|
||||||
echo "All reviews:"
|
|
||||||
echo "$REVIEWS"
|
|
||||||
# Count approved reviews from core team members (only most recent review per user)
|
|
||||||
CORE_APPROVALS=0
|
|
||||||
while IFS= read -r member; do
|
|
||||||
echo "Checking member: $member"
|
|
||||||
APPROVED=$(echo "$REVIEWS" | jq --arg user "$member" '
|
|
||||||
group_by(.user.login) |
|
|
||||||
map(select(.[0].user.login == $user) |
|
|
||||||
sort_by(.submitted_at) |
|
|
||||||
last) |
|
|
||||||
map(select(.state == "APPROVED" and (.state != "DISMISSED"))) |
|
|
||||||
length')
|
|
||||||
echo "Latest review state for $member: $APPROVED"
|
|
||||||
CORE_APPROVALS=$((CORE_APPROVALS + APPROVED))
|
|
||||||
echo "Running total: $CORE_APPROVALS"
|
|
||||||
done <<< "${{ steps.core_members.outputs.membership }}"
|
|
||||||
|
|
||||||
echo "CORE_APPROVALS=$CORE_APPROVALS" >> $GITHUB_OUTPUT
|
|
||||||
echo "CORE_APPROVALS=$CORE_APPROVALS"
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: "Find Comment"
|
|
||||||
if: steps.artifact_files_changed.outputs.artifact_changes == 'true' && steps.check_approvals.outputs.CORE_APPROVALS < env.required_approvals
|
|
||||||
uses: peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1 # peter-evans/find-comment@v2
|
|
||||||
id: find-comment
|
|
||||||
with:
|
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
|
||||||
comment-author: 'github-actions[bot]'
|
|
||||||
body-includes: "### Additional Artifact Review Required"
|
|
||||||
|
|
||||||
- name: "Create Comment"
|
|
||||||
if: steps.artifact_files_changed.outputs.artifact_changes == 'true' && steps.find-comment.outputs.comment-id == '' && steps.check_approvals.outputs.CORE_APPROVALS < env.required_approvals
|
|
||||||
uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # peter-evans/create-or-update-comment@v3
|
|
||||||
with:
|
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
|
||||||
body: |
|
|
||||||
### Additional Artifact Review Required
|
|
||||||
|
|
||||||
Changes to artifact directory files requires at least ${{ env.required_approvals }} approvals from core team members.
|
|
||||||
|
|
||||||
- name: "Notify if not enough approvals"
|
|
||||||
if: steps.artifact_files_changed.outputs.artifact_changes == 'true'
|
|
||||||
run: |
|
|
||||||
if [[ "${{ steps.check_approvals.outputs.CORE_APPROVALS }}" -ge "${{ env.required_approvals }}" ]]; then
|
|
||||||
title="Extra requirements met"
|
|
||||||
message="Changes to artifact directory files requires at least ${{ env.required_approvals }} approvals from core team members. Current number of core team approvals: ${{ steps.check_approvals.outputs.CORE_APPROVALS }} "
|
|
||||||
echo "::notice title=$title::$message"
|
|
||||||
echo "REVIEW_STATUS=success" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
title="PR Approval Requirements Not Met"
|
|
||||||
message="Changes to artifact directory files requires at least ${{ env.required_approvals }} approvals from core team members. Current number of core team approvals: ${{ steps.check_approvals.outputs.CORE_APPROVALS }} "
|
|
||||||
echo "::notice title=$title::$message"
|
|
||||||
echo "REVIEW_STATUS=neutral" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
id: review_check
|
|
||||||
|
|
||||||
- name: "Set check status"
|
|
||||||
id: status_check
|
|
||||||
run: |
|
|
||||||
if [[ "${{ steps.artifact_files_changed.outputs.artifact_changes }}" == 'false' ]]; then
|
|
||||||
# no extra review required
|
|
||||||
echo "current_status=success" >> $GITHUB_OUTPUT
|
|
||||||
elif [[ "${{ steps.review_check.outputs.REVIEW_STATUS }}" == "success" ]]; then
|
|
||||||
# we have all the required reviews
|
|
||||||
echo "current_status=success" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
# neutral exit - neither success nor failure
|
|
||||||
# we can't fail here because we use multiple triggers for this workflow and they won't reset the check
|
|
||||||
# workaround is to use a neutral exit to skip the check run until it's actually successful
|
|
||||||
echo "current_status=neutral" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: "Post Event"
|
|
||||||
# This step posts the status of the check because the workflow is triggered by multiple events
|
|
||||||
# and we need to ensure the check is always updated. Otherwise we would end up with duplicate
|
|
||||||
# checks in the GitHub UI.
|
|
||||||
run: |
|
|
||||||
if [[ "${{ steps.status_check.outputs.current_status }}" == "success" ]]; then
|
|
||||||
state="success"
|
|
||||||
else
|
|
||||||
state="failure"
|
|
||||||
fi
|
|
||||||
|
|
||||||
gh api \
|
|
||||||
--method POST \
|
|
||||||
-H "Accept: application/vnd.github+json" \
|
|
||||||
/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.base.sha }} \
|
|
||||||
-f state="$state" \
|
|
||||||
-f description="Artifact Review Check" \
|
|
||||||
-f context="Artifact Review Check" \
|
|
||||||
-f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.FISHTOWN_BOT_PAT }}
|
|
||||||
50
.github/workflows/auto-respond-bug-reports.yml
vendored
50
.github/workflows/auto-respond-bug-reports.yml
vendored
@@ -1,50 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# Check if the an issue is opened near or during an extended holiday period.
|
|
||||||
# If so, post an automatically-generated comment about the holiday for bug reports.
|
|
||||||
# Also provide specific information to customers of dbt Cloud.
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# Explain why responses will be delayed during our holiday period.
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# This will run when new issues are opened.
|
|
||||||
|
|
||||||
name: Auto-Respond to Bug Reports During Holiday Period
|
|
||||||
|
|
||||||
on:
|
|
||||||
issues:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
issues: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
auto-response:
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
steps:
|
|
||||||
- name: Check if current date is within holiday period
|
|
||||||
id: date-check
|
|
||||||
run: |
|
|
||||||
current_date=$(date -u +"%Y-%m-%d")
|
|
||||||
start_date="2024-12-23"
|
|
||||||
end_date="2025-01-05"
|
|
||||||
|
|
||||||
if [[ "$current_date" < "$start_date" || "$current_date" > "$end_date" ]]; then
|
|
||||||
echo "outside_holiday=true" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "outside_holiday=false" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Post comment
|
|
||||||
if: ${{ env.outside_holiday == 'false' && contains(github.event.issue.labels.*.name, 'bug') }}
|
|
||||||
run: |
|
|
||||||
gh issue comment ${{ github.event.issue.number }} --repo ${{ github.repository }} --body "Thank you for your bug report! Our team is will be out of the office for [Christmas and our Global Week of Rest](https://handbook.getdbt.com/docs/time_off#2024-us-holidays), from December 25, 2024, through January 3, 2025.
|
|
||||||
|
|
||||||
We will review your issue as soon as possible after returning.
|
|
||||||
Thank you for your understanding, and happy holidays! 🎄🎉
|
|
||||||
|
|
||||||
If you are a customer of dbt Cloud, please contact our Customer Support team via the dbt Cloud web interface or email **support@dbtlabs.com**."
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
40
.github/workflows/backport.yml
vendored
40
.github/workflows/backport.yml
vendored
@@ -1,40 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# When a PR is merged, if it has the backport label, it will create
|
|
||||||
# a new PR to backport those changes to the given branch. If it can't
|
|
||||||
# cleanly do a backport, it will comment on the merged PR of the failure.
|
|
||||||
#
|
|
||||||
# Label naming convention: "backport <branch name to backport to>"
|
|
||||||
# Example: backport 1.0.latest
|
|
||||||
#
|
|
||||||
# You MUST "Squash and merge" the original PR or this won't work.
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# Changes sometimes need to be backported to release branches.
|
|
||||||
# This automates the backporting process
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# Once a PR is "Squash and merge"'d, by adding a backport label, this is triggered
|
|
||||||
|
|
||||||
name: Backport
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- labeled
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
backport:
|
|
||||||
name: Backport
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
# Only react to merged PRs for security reasons.
|
|
||||||
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
|
|
||||||
if: >
|
|
||||||
github.event.pull_request.merged
|
|
||||||
&& contains(github.event.label.name, 'backport')
|
|
||||||
steps:
|
|
||||||
- uses: tibdex/backport@9565281eda0731b1d20c4025c43339fb0a23812e # tibdex/backport@v2.0.4
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
59
.github/workflows/bot-changelog.yml
vendored
59
.github/workflows/bot-changelog.yml
vendored
@@ -1,59 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# When bots create a PR, this action will add a corresponding changie yaml file to that
|
|
||||||
# PR when a specific label is added.
|
|
||||||
#
|
|
||||||
# The file is created off a template:
|
|
||||||
#
|
|
||||||
# kind: <per action matrix>
|
|
||||||
# body: <PR title>
|
|
||||||
# time: <current timestamp>
|
|
||||||
# custom:
|
|
||||||
# Author: <PR User Login (generally the bot)>
|
|
||||||
# Issue: 4904
|
|
||||||
# PR: <PR number>
|
|
||||||
#
|
|
||||||
# **why?**
|
|
||||||
# Automate changelog generation for more visability with automated bot PRs.
|
|
||||||
#
|
|
||||||
# **when?**
|
|
||||||
# Once a PR is created, label should be added to PR before or after creation. You can also
|
|
||||||
# manually trigger this by adding the appropriate label at any time.
|
|
||||||
#
|
|
||||||
# **how to add another bot?**
|
|
||||||
# Add the label and changie kind to the include matrix. That's it!
|
|
||||||
#
|
|
||||||
|
|
||||||
name: Bot Changelog
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
# catch when the PR is opened with the label or when the label is added
|
|
||||||
types: [labeled]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
generate_changelog:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- label: "dependencies"
|
|
||||||
changie_kind: "Dependencies"
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
|
|
||||||
- name: Create and commit changelog on bot PR
|
|
||||||
if: ${{ contains(github.event.pull_request.labels.*.name, matrix.label) }}
|
|
||||||
id: bot_changelog
|
|
||||||
uses: emmyoop/changie_bot@22b70618b13d0d1c64ea95212bafca2d2bf6b764 # emmyoop/changie_bot@v1.1.0
|
|
||||||
with:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.FISHTOWN_BOT_PAT }}
|
|
||||||
commit_author_name: "Github Build Bot"
|
|
||||||
commit_author_email: "<buildbot@fishtownanalytics.com>"
|
|
||||||
commit_message: "Add automated changelog yaml from template for bot PR"
|
|
||||||
changie_kind: ${{ matrix.changie_kind }}
|
|
||||||
label: ${{ matrix.label }}
|
|
||||||
custom_changelog_string: "custom:\n Author: ${{ github.event.pull_request.user.login }}\n Issue: ${{ github.event.pull_request.number }}"
|
|
||||||
40
.github/workflows/changelog-existence.yml
vendored
40
.github/workflows/changelog-existence.yml
vendored
@@ -1,40 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# Checks that a file has been committed under the /.changes directory
|
|
||||||
# as a new CHANGELOG entry. Cannot check for a specific filename as
|
|
||||||
# it is dynamically generated by change type and timestamp.
|
|
||||||
# This workflow runs on pull_request_target because it requires
|
|
||||||
# secrets to post comments.
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# Ensure code change gets reflected in the CHANGELOG.
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# This will run for all PRs going into main and *.latest. It will
|
|
||||||
# run when they are opened, reopened, when any label is added or removed
|
|
||||||
# and when new code is pushed to the branch. The action will then get
|
|
||||||
# skipped if the 'Skip Changelog' label is present is any of the labels.
|
|
||||||
|
|
||||||
name: Check Changelog Entry
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request_target:
|
|
||||||
types: [opened, reopened, labeled, unlabeled, synchronize]
|
|
||||||
paths-ignore: ['.changes/**', '.github/**', 'tests/**', '**.md', '**.yml']
|
|
||||||
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
changelog:
|
|
||||||
uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@main
|
|
||||||
with:
|
|
||||||
changelog_comment: 'Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see [the contributing guide](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md#adding-changelog-entry).'
|
|
||||||
skip_label: 'Skip Changelog'
|
|
||||||
secrets: inherit
|
|
||||||
45
.github/workflows/check-artifact-changes.yml
vendored
45
.github/workflows/check-artifact-changes.yml
vendored
@@ -1,45 +0,0 @@
|
|||||||
name: Check Artifact Changes
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [ opened, reopened, labeled, unlabeled, synchronize ]
|
|
||||||
paths-ignore: [ '.changes/**', '.github/**', 'tests/**', '**.md', '**.yml' ]
|
|
||||||
merge_group:
|
|
||||||
types: [checks_requested]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-artifact-changes:
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'artifact_minor_upgrade') }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Check for changes in core/dbt/artifacts
|
|
||||||
# https://github.com/marketplace/actions/paths-changes-filter
|
|
||||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # dorny/paths-filter@v3
|
|
||||||
id: check_artifact_changes
|
|
||||||
with:
|
|
||||||
filters: |
|
|
||||||
artifacts_changed:
|
|
||||||
- 'core/dbt/artifacts/**'
|
|
||||||
list-files: shell
|
|
||||||
|
|
||||||
- name: Fail CI if artifacts have changed
|
|
||||||
if: steps.check_artifact_changes.outputs.artifacts_changed == 'true'
|
|
||||||
run: |
|
|
||||||
echo "CI failure: Artifact changes checked in core/dbt/artifacts directory."
|
|
||||||
echo "Files changed: ${{ steps.check_artifact_changes.outputs.artifacts_changed_files }}"
|
|
||||||
echo "To bypass this check, confirm that the change is not breaking (https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/artifacts/README.md#breaking-changes) and add the 'artifact_minor_upgrade' label to the PR. Modifications and additions to all fields require updates to https://github.com/dbt-labs/dbt-jsonschema."
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
- name: CI check passed
|
|
||||||
if: steps.check_artifact_changes.outputs.artifacts_changed == 'false'
|
|
||||||
run: |
|
|
||||||
echo "No prohibited artifact changes found in core/dbt/artifacts. CI check passed."
|
|
||||||
44
.github/workflows/community-label.yml
vendored
44
.github/workflows/community-label.yml
vendored
@@ -1,44 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# Label a PR with a `community` label when a PR is opened by a user outside core/adapters
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# To streamline triage and ensure that community contributions are recognized and prioritized
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# When a PR is opened, not in draft or moved from draft to ready for review
|
|
||||||
|
|
||||||
name: Label community PRs
|
|
||||||
|
|
||||||
on:
|
|
||||||
# have to use pull_request_target since community PRs come from forks
|
|
||||||
pull_request_target:
|
|
||||||
types: [opened, ready_for_review]
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
pull-requests: write # labels PRs
|
|
||||||
contents: read # reads team membership
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
open_issues:
|
|
||||||
# If this PR already has the community label, no need to relabel it
|
|
||||||
# If this PR is opened and not draft, determine if it needs to be labeled
|
|
||||||
# if the PR is converted out of draft, determine if it needs to be labeled
|
|
||||||
if: |
|
|
||||||
(
|
|
||||||
!contains(github.event.pull_request.labels.*.name, 'community')
|
|
||||||
&& (
|
|
||||||
(github.event.action == 'opened' && github.event.pull_request.draft == false)
|
|
||||||
|| github.event.action == 'ready_for_review'
|
|
||||||
)
|
|
||||||
&& github.event.pull_request.user.type != 'Bot'
|
|
||||||
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
|
||||||
)
|
|
||||||
uses: dbt-labs/actions/.github/workflows/label-community.yml@main
|
|
||||||
with:
|
|
||||||
github_team: 'core-group'
|
|
||||||
label: 'community'
|
|
||||||
secrets: inherit
|
|
||||||
391
.github/workflows/cut-release-branch.yml
vendored
391
.github/workflows/cut-release-branch.yml
vendored
@@ -1,391 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# Cuts the `*.latest` branch, bumps dependencies on it, cleans up all files in `.changes/unreleased`
|
|
||||||
# and `.changes/previous verion on main and bumps main to the input version.
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# Clean up the main branch after a release branch is cut and automate cutting the release branch.
|
|
||||||
# Generally reduces the workload of engineers and reducing error.
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# This will run when called manually or when triggered in another workflow.
|
|
||||||
|
|
||||||
# Example Usage including required permissions: TODO: update once finalized
|
|
||||||
|
|
||||||
# permissions:
|
|
||||||
# contents: read
|
|
||||||
# pull-requests: write
|
|
||||||
#
|
|
||||||
# name: Cut Release Branch
|
|
||||||
# jobs:
|
|
||||||
# changelog:
|
|
||||||
# uses: dbt-labs/actions/.github/workflows/cut-release-branch.yml@main
|
|
||||||
# with:
|
|
||||||
# new_branch_name: 1.7.latest
|
|
||||||
# PR_title: "Cleanup main after cutting new 1.7.latest branch"
|
|
||||||
# PR_body: "All adapter PRs will fail CI until the dbt-core PR has been merged due to release version conflicts."
|
|
||||||
# secrets:
|
|
||||||
# FISHTOWN_BOT_PAT: ${{ secrets.FISHTOWN_BOT_PAT }}
|
|
||||||
|
|
||||||
# TODOs
|
|
||||||
# add note to eventually commit changes directly and bypass checks - same as release - when we move to this model run test action after merge
|
|
||||||
|
|
||||||
name: Cut new release branch
|
|
||||||
run-name: "Cutting New Branch: ${{ inputs.new_branch_name }}"
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
new_branch_name:
|
|
||||||
description: "The full name of the new branch (ex. 1.5.latest)"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
env:
|
|
||||||
PYTHON_TARGET_VERSION: "3.10"
|
|
||||||
PR_TITLE: "Cleanup main after cutting new ${{ inputs.new_branch_name }} branch"
|
|
||||||
PR_BODY: "All adapter PRs will fail CI until the dbt-core PR has been merged due to release version conflicts."
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
prep_work:
|
|
||||||
name: "Prep Work"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: "[DEBUG] Print Inputs"
|
|
||||||
run: |
|
|
||||||
echo "new_branch_name: ${{ inputs.new_branch_name }}"
|
|
||||||
echo "PR_title: ${{ env.PR_TITLE }}"
|
|
||||||
echo "PR_body: ${{ env.PR_BODY }}"
|
|
||||||
|
|
||||||
create_temp_branch:
|
|
||||||
name: "Create Temp branch off main"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
temp_branch_name: ${{ steps.variables.outputs.BRANCH_NAME }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "Set Branch Value"
|
|
||||||
id: variables
|
|
||||||
run: |
|
|
||||||
echo "BRANCH_NAME=cutting_release_branch/main_cleanup_$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: "Checkout ${{ github.repository }}"
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: "main"
|
|
||||||
token: ${{ secrets.FISHTOWN_BOT_PAT }}
|
|
||||||
|
|
||||||
- name: "Create PR Branch"
|
|
||||||
run: |
|
|
||||||
user="Github Build Bot"
|
|
||||||
email="buildbot@fishtownanalytics.com"
|
|
||||||
git config user.name "$user"
|
|
||||||
git config user.email "$email"
|
|
||||||
git checkout -b ${{ steps.variables.outputs.BRANCH_NAME }}
|
|
||||||
git push --set-upstream origin ${{ steps.variables.outputs.BRANCH_NAME }}
|
|
||||||
|
|
||||||
- name: "[Notification] Temp branch created"
|
|
||||||
run: |
|
|
||||||
message="Temp branch ${{ steps.variables.outputs.BRANCH_NAME }} created"
|
|
||||||
echo "::notice title="Temporary branch created": $title::$message"
|
|
||||||
|
|
||||||
cleanup_changelog:
|
|
||||||
name: "Clean Up Changelog"
|
|
||||||
needs: ["create_temp_branch"]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
next-version: ${{ steps.semver-current.outputs.next-minor-alpha-version }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "Checkout ${{ github.repository }}"
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ needs.create_temp_branch.outputs.temp_branch_name }}
|
|
||||||
token: ${{ secrets.FISHTOWN_BOT_PAT }}
|
|
||||||
|
|
||||||
- name: "Add Homebrew To PATH"
|
|
||||||
run: |
|
|
||||||
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: "Install Homebrew Packages"
|
|
||||||
run: |
|
|
||||||
brew install pre-commit
|
|
||||||
brew tap miniscruff/changie https://github.com/miniscruff/changie
|
|
||||||
brew install changie
|
|
||||||
|
|
||||||
- name: "Check Current Version In Code"
|
|
||||||
id: determine_version
|
|
||||||
run: |
|
|
||||||
current_version=$(grep '^version = ' core/pyproject.toml | sed 's/version = "\(.*\)"/\1/')
|
|
||||||
echo "current_version=$current_version" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: "[Notification] Check Current Version In Code"
|
|
||||||
run: |
|
|
||||||
message="The current version is ${{ steps.determine_version.outputs.current_version }}"
|
|
||||||
echo "::notice title="Version Bump Check": $title::$message"
|
|
||||||
|
|
||||||
- name: "Parse Current Version Into Parts for Changelog Directories"
|
|
||||||
id: semver-current
|
|
||||||
uses: dbt-labs/actions/parse-semver@main
|
|
||||||
with:
|
|
||||||
version: ${{ steps.determine_version.outputs.current_version }}
|
|
||||||
|
|
||||||
- name: "[Notification] Next Alpha Version"
|
|
||||||
run: |
|
|
||||||
message="The next alpha version is ${{ steps.semver-current.outputs.next-minor-alpha-version }}"
|
|
||||||
echo "::notice title="Version Bump Check": $title::$message"
|
|
||||||
|
|
||||||
- name: "Delete Unreleased Changelog YAMLs"
|
|
||||||
# removal fails if no files exist. OK to continue since we're just cleaning up the files.
|
|
||||||
continue-on-error: true
|
|
||||||
run: |
|
|
||||||
rm .changes/unreleased/*.yaml || true
|
|
||||||
|
|
||||||
- name: "Delete Pre Release Changelogs and YAMLs"
|
|
||||||
# removal fails if no files exist. OK to continue since we're just cleaning up the files.
|
|
||||||
continue-on-error: true
|
|
||||||
run: |
|
|
||||||
rm .changes/${{ steps.semver-current.outputs.base-version }}/*.yaml || true
|
|
||||||
rm .changes/${{ steps.semver-current.outputs.major }}.${{ steps.semver-current.outputs.minor }}.*.md || true
|
|
||||||
|
|
||||||
- name: "Cleanup CHANGELOG.md"
|
|
||||||
run: |
|
|
||||||
changie merge
|
|
||||||
|
|
||||||
- name: "Commit Changelog Cleanup to Branch"
|
|
||||||
run: |
|
|
||||||
user="Github Build Bot"
|
|
||||||
email="buildbot@fishtownanalytics.com"
|
|
||||||
git config user.name "$user"
|
|
||||||
git config user.email "$email"
|
|
||||||
git status
|
|
||||||
git add .
|
|
||||||
git commit -m "Clean up changelog on main"
|
|
||||||
git push
|
|
||||||
|
|
||||||
- name: "[Notification] Changelog cleaned up"
|
|
||||||
run: |
|
|
||||||
message="Changelog on ${{ needs.create_temp_branch.outputs.temp_branch_name }} cleaned up"
|
|
||||||
echo "::notice title="Changelog cleaned up": $title::$message"
|
|
||||||
|
|
||||||
bump_version:
|
|
||||||
name: "Bump to next minor version"
|
|
||||||
needs: ["cleanup_changelog", "create_temp_branch"]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "Checkout ${{ github.repository }}"
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ needs.create_temp_branch.outputs.temp_branch_name }}
|
|
||||||
token: ${{ secrets.FISHTOWN_BOT_PAT }}
|
|
||||||
|
|
||||||
- name: "Set up Python - ${{ env.PYTHON_TARGET_VERSION }}"
|
|
||||||
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "${{ env.PYTHON_TARGET_VERSION }}"
|
|
||||||
|
|
||||||
- name: "Install Spark Dependencies"
|
|
||||||
if: ${{ contains(github.repository, 'dbt-labs/dbt-spark') }}
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install libsasl2-dev
|
|
||||||
|
|
||||||
- name: "Install Python Dependencies"
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
python -m pip install hatch
|
|
||||||
|
|
||||||
- name: "Bump Version To ${{ needs.cleanup_changelog.outputs.next-version }}"
|
|
||||||
run: |
|
|
||||||
cd core
|
|
||||||
hatch version ${{ needs.cleanup_changelog.outputs.next-version }}
|
|
||||||
hatch run dev-req
|
|
||||||
dbt --version
|
|
||||||
|
|
||||||
- name: "Commit Version Bump to Branch"
|
|
||||||
run: |
|
|
||||||
user="Github Build Bot"
|
|
||||||
email="buildbot@fishtownanalytics.com"
|
|
||||||
git config user.name "$user"
|
|
||||||
git config user.email "$email"
|
|
||||||
git status
|
|
||||||
git add .
|
|
||||||
git commit -m "Bumping version to ${{ needs.cleanup_changelog.outputs.next-version }}"
|
|
||||||
git push
|
|
||||||
|
|
||||||
- name: "[Notification] Version Bump completed"
|
|
||||||
run: |
|
|
||||||
message="Version on ${{ needs.create_temp_branch.outputs.temp_branch_name }} bumped to ${{ needs.cleanup_changelog.outputs.next-version }}"
|
|
||||||
echo "::notice title="Version Bump Completed": $title::$message"
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
name: "Cleanup Code Quality"
|
|
||||||
needs: ["create_temp_branch", "bump_version"]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: "Checkout ${{ github.repository }}"
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ needs.create_temp_branch.outputs.temp_branch_name }}
|
|
||||||
token: ${{ secrets.FISHTOWN_BOT_PAT }}
|
|
||||||
|
|
||||||
- name: "Add Homebrew To PATH"
|
|
||||||
run: |
|
|
||||||
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: "brew install pre-commit"
|
|
||||||
run: |
|
|
||||||
brew install pre-commit
|
|
||||||
|
|
||||||
# this step will fail on whitespace errors but also correct them
|
|
||||||
- name: "Cleanup - Remove Trailing Whitespace Via Pre-commit"
|
|
||||||
continue-on-error: true
|
|
||||||
run: |
|
|
||||||
pre-commit run trailing-whitespace --files CHANGELOG.md .changes/* || true
|
|
||||||
|
|
||||||
# this step will fail on newline errors but also correct them
|
|
||||||
- name: "Cleanup - Remove Extra Newlines Via Pre-commit"
|
|
||||||
continue-on-error: true
|
|
||||||
run: |
|
|
||||||
pre-commit run end-of-file-fixer --files CHANGELOG.md .changes/* || true
|
|
||||||
|
|
||||||
- name: "Commit Version Bump to Branch"
|
|
||||||
run: |
|
|
||||||
user="Github Build Bot"
|
|
||||||
email="buildbot@fishtownanalytics.com"
|
|
||||||
git config user.name "$user"
|
|
||||||
git config user.email "$email"
|
|
||||||
git status
|
|
||||||
git add .
|
|
||||||
git commit -m "Code quality cleanup"
|
|
||||||
git push
|
|
||||||
|
|
||||||
open_pr:
|
|
||||||
name: "Open PR Against main"
|
|
||||||
needs: ["cleanup_changelog", "create_temp_branch", "cleanup"]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
pr_number: ${{ steps.create_pr.outputs.pull-request-number }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "Checkout ${{ github.repository }}"
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ needs.create_temp_branch.outputs.temp_branch_name }}
|
|
||||||
token: ${{ secrets.FISHTOWN_BOT_PAT }}
|
|
||||||
|
|
||||||
- name: "Determine PR Title"
|
|
||||||
id: pr_title
|
|
||||||
run: |
|
|
||||||
echo "pr_title=${{ env.PR_TITLE }}" >> $GITHUB_OUTPUT
|
|
||||||
if [${{ env.PR_TITLE }} == ""]; then
|
|
||||||
echo "pr_title='Clean up changelogs and bump to version ${{ needs.cleanup_changelog.outputs.next-version }}'" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: "Determine PR Body"
|
|
||||||
id: pr_body
|
|
||||||
run: |
|
|
||||||
echo "pr_body=${{ env.PR_BODY }}" >> $GITHUB_OUTPUT
|
|
||||||
if [${{ env.PR_BODY }} == ""]; then
|
|
||||||
echo "pr_body='Clean up changelogs and bump to version ${{ needs.cleanup_changelog.outputs.next-version }}'" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: "Add Branch Details"
|
|
||||||
id: pr_body_branch
|
|
||||||
run: |
|
|
||||||
branch_details="The workflow that generated this PR also created a new branch: ${{ inputs.new_branch_name }}"
|
|
||||||
full_body="${{ steps.pr_body.outputs.pr_body }} $branch_details"
|
|
||||||
echo "pr_full_body=$full_body" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: "Open Pull Request"
|
|
||||||
id: create_pr
|
|
||||||
run: |
|
|
||||||
pr_url=$(gh pr create -B main -H ${{ needs.create_temp_branch.outputs.temp_branch_name }} -l "Skip Changelog" -t "${{ steps.pr_title.outputs.pr_title }}" -b "${{ steps.pr_body_branch.outputs.pr_full_body }}")
|
|
||||||
echo "pr_url=$pr_url" >> $GITHUB_OUTPUT
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.FISHTOWN_BOT_PAT }}
|
|
||||||
|
|
||||||
- name: "[Notification] Pull Request Opened"
|
|
||||||
run: |
|
|
||||||
message="PR opened at ${{ steps.create_pr.outputs.pr_url }}"
|
|
||||||
echo "::notice title="Pull Request Opened": $title::$message"
|
|
||||||
|
|
||||||
cut_new_branch:
|
|
||||||
# don't cut the new branch until we're done opening the PR against main
|
|
||||||
name: "Cut New Branch ${{ inputs.new_branch_name }}"
|
|
||||||
needs: [open_pr]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "Checkout ${{ github.repository }}"
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.FISHTOWN_BOT_PAT }}
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: "Ensure New Branch Does Not Exist"
|
|
||||||
id: check_new_branch
|
|
||||||
run: |
|
|
||||||
title="Check New Branch Existence"
|
|
||||||
if git show-ref --quiet ${{ inputs.new_branch_name }}; then
|
|
||||||
message="Branch ${{ inputs.new_branch_name }} already exists. Exiting."
|
|
||||||
echo "::error $title::$message"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: "Create New Release Branch"
|
|
||||||
run: |
|
|
||||||
git checkout -b ${{ inputs.new_branch_name }}
|
|
||||||
|
|
||||||
- name: "Push up New Branch"
|
|
||||||
run: |
|
|
||||||
#Data for commit
|
|
||||||
user="Github Build Bot"
|
|
||||||
email="buildbot@fishtownanalytics.com"
|
|
||||||
git config user.name "$user"
|
|
||||||
git config user.email "$email"
|
|
||||||
git push --set-upstream origin ${{ inputs.new_branch_name }}
|
|
||||||
|
|
||||||
- name: "[Notification] New branch created"
|
|
||||||
run: |
|
|
||||||
message="New branch ${{ inputs.new_branch_name }} created"
|
|
||||||
echo "::notice title="New branch created": $title::$message"
|
|
||||||
|
|
||||||
- name: "Bump dependencies via script"
|
|
||||||
# This bumps the dependency on dbt-core in the adapters
|
|
||||||
if: ${{ !contains(github.repository, 'dbt-core') }}
|
|
||||||
run: |
|
|
||||||
echo ${{ github.repository }}
|
|
||||||
echo "running update_dependencies script"
|
|
||||||
bash ${GITHUB_WORKSPACE}/.github/scripts/update_dependencies.sh ${{ inputs.new_branch_name }}
|
|
||||||
commit_message="bumping .latest branch variable in update_dependencies.sh to ${{ inputs.new_branch_name }}"
|
|
||||||
git status
|
|
||||||
git add .
|
|
||||||
git commit -m "$commit_message"
|
|
||||||
git push
|
|
||||||
|
|
||||||
- name: "Bump env variable via script"
|
|
||||||
# bumps the RELEASE_BRANCH variable in nightly-release.yml in adapters
|
|
||||||
if: ${{ !contains(github.repository, 'dbt-core') }}
|
|
||||||
run: |
|
|
||||||
file="./.github/scripts/update_release_branch.sh"
|
|
||||||
if test -f "$file"; then
|
|
||||||
echo ${{ github.repository }}
|
|
||||||
echo "running some script yet to be written now"
|
|
||||||
bash $file ${{ inputs.new_branch_name }}
|
|
||||||
commit_message="updating env variable to ${{ inputs.new_branch_name }} in nightly-release.yml"
|
|
||||||
git status
|
|
||||||
git add .
|
|
||||||
git commit -m "$commit_message"
|
|
||||||
git push
|
|
||||||
else
|
|
||||||
echo "no $file seen skipping step"
|
|
||||||
fi
|
|
||||||
41
.github/workflows/docs-issue.yml
vendored
41
.github/workflows/docs-issue.yml
vendored
@@ -1,41 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# Open an issue in docs.getdbt.com when an issue is labeled `user docs` and closed as completed
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# To reduce barriers for keeping docs up to date
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# When an issue is labeled `user docs` and is closed as completed. Can be labeled before or after the issue is closed.
|
|
||||||
|
|
||||||
|
|
||||||
name: Open issues in docs.getdbt.com repo when an issue is labeled
|
|
||||||
run-name: "Open an issue in docs.getdbt.com for issue #${{ github.event.issue.number }}"
|
|
||||||
|
|
||||||
on:
|
|
||||||
issues:
|
|
||||||
types: [labeled, closed]
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
issues: write # comments on issues
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
open_issues:
|
|
||||||
# we only want to run this when the issue is closed as completed and the label `user docs` has been assigned.
|
|
||||||
# If this logic does not exist in this workflow, it runs the
|
|
||||||
# risk of duplicaton of issues being created due to merge and label both triggering this workflow to run and neither having
|
|
||||||
# generating the comment before the other runs. This lives here instead of the shared workflow because this is where we
|
|
||||||
# decide if it should run or not.
|
|
||||||
if: |
|
|
||||||
(github.event.issue.state == 'closed' &&
|
|
||||||
github.event.issue.state_reason == 'completed' &&
|
|
||||||
contains( github.event.issue.labels.*.name, 'user docs'))
|
|
||||||
uses: dbt-labs/actions/.github/workflows/open-issue-in-repo.yml@main
|
|
||||||
with:
|
|
||||||
issue_repository: "dbt-labs/docs.getdbt.com"
|
|
||||||
issue_title: "[Core] Docs Changes Needed from ${{ github.event.repository.name }} Issue #${{ github.event.issue.number }}"
|
|
||||||
issue_body: "At a minimum, update body to include a link to the page on docs.getdbt.com requiring updates and what part(s) of the page you would like to see updated.\n Originating from this issue: https://github.com/dbt-labs/dbt-core/issues/${{ github.event.issue.number }}"
|
|
||||||
secrets: inherit
|
|
||||||
383
.github/workflows/main.yml
vendored
383
.github/workflows/main.yml
vendored
@@ -1,383 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# Runs code quality checks, unit tests, integration tests and
|
|
||||||
# verifies python build on all code commited to the repository. This workflow
|
|
||||||
# should not require any secrets since it runs for PRs from forked repos. By
|
|
||||||
# default, secrets are not passed to workflows running from a forked repos.
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# Ensure code for dbt meets a certain quality standard.
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# This will run for all PRs, when code is pushed to a release
|
|
||||||
# branch, and when manually triggered.
|
|
||||||
|
|
||||||
name: Tests and Code Checks
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- "main"
|
|
||||||
- "*.latest"
|
|
||||||
- "releases/*"
|
|
||||||
pull_request:
|
|
||||||
merge_group:
|
|
||||||
types: [checks_requested]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
# will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
# top-level adjustments can be made here
|
|
||||||
env:
|
|
||||||
# number of parallel processes to spawn for python integration testing
|
|
||||||
PYTHON_INTEGRATION_TEST_WORKERS: 5
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
code-quality:
|
|
||||||
name: code-quality
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 10
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check out the repository
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # actions/setup-python@v6
|
|
||||||
with:
|
|
||||||
python-version: "3.10"
|
|
||||||
|
|
||||||
- name: Install python dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --user --upgrade pip
|
|
||||||
python -m pip --version
|
|
||||||
python -m pip install hatch
|
|
||||||
cd core
|
|
||||||
hatch run setup
|
|
||||||
|
|
||||||
- name: Verify dbt installation
|
|
||||||
run: |
|
|
||||||
cd core
|
|
||||||
hatch run dbt --version
|
|
||||||
|
|
||||||
- name: Run pre-commit hooks
|
|
||||||
run: |
|
|
||||||
cd core
|
|
||||||
hatch run code-quality
|
|
||||||
|
|
||||||
unit:
|
|
||||||
name: "unit test / python ${{ matrix.python-version }}"
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 10
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check out the repository
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
|
||||||
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # actions/setup-python@v6
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
|
|
||||||
- name: Install python dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --user --upgrade pip
|
|
||||||
python -m pip --version
|
|
||||||
python -m pip install hatch
|
|
||||||
hatch --version
|
|
||||||
|
|
||||||
- name: Run unit tests
|
|
||||||
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # nick-fields/retry@v3
|
|
||||||
with:
|
|
||||||
timeout_minutes: 10
|
|
||||||
max_attempts: 3
|
|
||||||
command: cd core && hatch run ci:unit-tests
|
|
||||||
|
|
||||||
- name: Get current date
|
|
||||||
if: always()
|
|
||||||
id: date
|
|
||||||
run: |
|
|
||||||
CURRENT_DATE=$(date +'%Y-%m-%dT%H_%M_%S') # no colons allowed for artifacts
|
|
||||||
echo "date=$CURRENT_DATE" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Upload Unit Test Coverage to Codecov
|
|
||||||
if: ${{ matrix.python-version == '3.11' }}
|
|
||||||
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # codecov/codecov-action@v5
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
flags: unit
|
|
||||||
fail_ci_if_error: false
|
|
||||||
|
|
||||||
integration-metadata:
|
|
||||||
name: integration test metadata generation
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
split-groups: ${{ steps.generate-split-groups.outputs.split-groups }}
|
|
||||||
include: ${{ steps.generate-include.outputs.include }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: generate split-groups
|
|
||||||
id: generate-split-groups
|
|
||||||
run: |
|
|
||||||
MATRIX_JSON="["
|
|
||||||
for B in $(seq 1 ${{ env.PYTHON_INTEGRATION_TEST_WORKERS }}); do
|
|
||||||
MATRIX_JSON+=$(sed 's/^/"/;s/$/"/' <<< "${B}")
|
|
||||||
done
|
|
||||||
MATRIX_JSON="${MATRIX_JSON//\"\"/\", \"}"
|
|
||||||
MATRIX_JSON+="]"
|
|
||||||
echo "split-groups=${MATRIX_JSON}"
|
|
||||||
echo "split-groups=${MATRIX_JSON}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: generate include
|
|
||||||
id: generate-include
|
|
||||||
run: |
|
|
||||||
INCLUDE=('"python-version":"3.10","os":"windows-latest"' '"python-version":"3.10","os":"macos-14"' )
|
|
||||||
INCLUDE_GROUPS="["
|
|
||||||
for include in ${INCLUDE[@]}; do
|
|
||||||
for group in $(seq 1 ${{ env.PYTHON_INTEGRATION_TEST_WORKERS }}); do
|
|
||||||
INCLUDE_GROUPS+=$(sed 's/$/, /' <<< "{\"split-group\":\"${group}\",${include}}")
|
|
||||||
done
|
|
||||||
done
|
|
||||||
INCLUDE_GROUPS=$(echo $INCLUDE_GROUPS | sed 's/,*$//g')
|
|
||||||
INCLUDE_GROUPS+="]"
|
|
||||||
echo "include=${INCLUDE_GROUPS}"
|
|
||||||
echo "include=${INCLUDE_GROUPS}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
integration-postgres:
|
|
||||||
name: "(${{ matrix.split-group }}) integration test / python ${{ matrix.python-version }} / ${{ matrix.os }}"
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
timeout-minutes: 30
|
|
||||||
needs:
|
|
||||||
- integration-metadata
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
||||||
os: ["ubuntu-latest"]
|
|
||||||
split-group: ${{ fromJson(needs.integration-metadata.outputs.split-groups) }}
|
|
||||||
env:
|
|
||||||
DBT_INVOCATION_ENV: github-actions
|
|
||||||
DBT_TEST_USER_1: dbt_test_user_1
|
|
||||||
DBT_TEST_USER_2: dbt_test_user_2
|
|
||||||
DBT_TEST_USER_3: dbt_test_user_3
|
|
||||||
DD_CIVISIBILITY_AGENTLESS_ENABLED: true
|
|
||||||
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
|
||||||
DD_SITE: datadoghq.com
|
|
||||||
DD_ENV: ci
|
|
||||||
DD_SERVICE: ${{ github.event.repository.name }}
|
|
||||||
|
|
||||||
services:
|
|
||||||
# Label used to access the service container
|
|
||||||
postgres:
|
|
||||||
# Docker Hub image
|
|
||||||
image: postgres
|
|
||||||
# Provide the password for postgres
|
|
||||||
env:
|
|
||||||
POSTGRES_PASSWORD: password
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
# Set health checks to wait until postgres has started
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check out the repository
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
|
||||||
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # actions/setup-python@v6
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
|
|
||||||
- name: Run postgres setup script
|
|
||||||
run: |
|
|
||||||
./scripts/setup_db.sh
|
|
||||||
env:
|
|
||||||
PGHOST: localhost
|
|
||||||
PGPORT: 5432
|
|
||||||
PGPASSWORD: password
|
|
||||||
|
|
||||||
- name: Install python tools
|
|
||||||
run: |
|
|
||||||
python -m pip install --user --upgrade pip
|
|
||||||
python -m pip --version
|
|
||||||
python -m pip install hatch
|
|
||||||
hatch --version
|
|
||||||
|
|
||||||
- name: Run integration tests
|
|
||||||
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # nick-fields/retry@v3
|
|
||||||
with:
|
|
||||||
timeout_minutes: 30
|
|
||||||
max_attempts: 3
|
|
||||||
shell: bash
|
|
||||||
command: cd core && hatch run ci:integration-tests -- --ddtrace --splits ${{ env.PYTHON_INTEGRATION_TEST_WORKERS }} --group ${{ matrix.split-group }}
|
|
||||||
|
|
||||||
- name: Get current date
|
|
||||||
if: always()
|
|
||||||
id: date
|
|
||||||
run: |
|
|
||||||
CURRENT_DATE=$(date +'%Y-%m-%dT%H_%M_%S') # no colons allowed for artifacts
|
|
||||||
echo "date=$CURRENT_DATE" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # actions/upload-artifact@v4
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
name: logs_${{ matrix.python-version }}_${{ matrix.os }}_${{ matrix.split-group }}_${{ steps.date.outputs.date }}
|
|
||||||
path: ./logs
|
|
||||||
|
|
||||||
- name: Upload Integration Test Coverage to Codecov
|
|
||||||
if: ${{ matrix.python-version == '3.11' }}
|
|
||||||
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # codecov/codecov-action@v5
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
flags: integration
|
|
||||||
fail_ci_if_error: false
|
|
||||||
|
|
||||||
integration-mac-windows:
|
|
||||||
name: (${{ matrix.split-group }}) integration test / python ${{ matrix.python-version }} / ${{ matrix.os }}
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
timeout-minutes: 30
|
|
||||||
needs:
|
|
||||||
- integration-metadata
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
# already includes split group and runs mac + windows
|
|
||||||
include: ${{ fromJson(needs.integration-metadata.outputs.include) }}
|
|
||||||
env:
|
|
||||||
DBT_INVOCATION_ENV: github-actions
|
|
||||||
DBT_TEST_USER_1: dbt_test_user_1
|
|
||||||
DBT_TEST_USER_2: dbt_test_user_2
|
|
||||||
DBT_TEST_USER_3: dbt_test_user_3
|
|
||||||
DD_CIVISIBILITY_AGENTLESS_ENABLED: true
|
|
||||||
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
|
||||||
DD_SITE: datadoghq.com
|
|
||||||
DD_ENV: ci
|
|
||||||
DD_SERVICE: ${{ github.event.repository.name }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check out the repository
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
|
||||||
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # actions/setup-python@v6
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
|
|
||||||
- name: Set up postgres (macos)
|
|
||||||
if: runner.os == 'macOS'
|
|
||||||
|
|
||||||
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # nick-fields/retry@v3
|
|
||||||
with:
|
|
||||||
timeout_minutes: 10
|
|
||||||
max_attempts: 3
|
|
||||||
command: ./scripts/setup_db.sh
|
|
||||||
|
|
||||||
- name: Set up postgres (windows)
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
uses: ./.github/actions/setup-postgres-windows
|
|
||||||
|
|
||||||
- name: Install python tools
|
|
||||||
run: |
|
|
||||||
python -m pip install --user --upgrade pip
|
|
||||||
python -m pip --version
|
|
||||||
python -m pip install hatch
|
|
||||||
hatch --version
|
|
||||||
|
|
||||||
- name: Run integration tests
|
|
||||||
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # nick-fields/retry@v3
|
|
||||||
with:
|
|
||||||
timeout_minutes: 30
|
|
||||||
max_attempts: 3
|
|
||||||
shell: bash
|
|
||||||
command: cd core && hatch run ci:integration-tests -- --ddtrace --splits ${{ env.PYTHON_INTEGRATION_TEST_WORKERS }} --group ${{ matrix.split-group }}
|
|
||||||
|
|
||||||
- name: Get current date
|
|
||||||
if: always()
|
|
||||||
id: date
|
|
||||||
run: |
|
|
||||||
CURRENT_DATE=$(date +'%Y-%m-%dT%H_%M_%S') # no colons allowed for artifacts
|
|
||||||
echo "date=$CURRENT_DATE" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # actions/upload-artifact@v4
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
name: logs_${{ matrix.python-version }}_${{ matrix.os }}_${{ matrix.split-group }}_${{ steps.date.outputs.date }}
|
|
||||||
path: ./logs
|
|
||||||
|
|
||||||
- name: Upload Integration Test Coverage to Codecov
|
|
||||||
if: ${{ matrix.python-version == '3.11' }}
|
|
||||||
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # codecov/codecov-action@v5
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
flags: integration
|
|
||||||
fail_ci_if_error: false
|
|
||||||
|
|
||||||
integration-report:
|
|
||||||
if: ${{ always() }}
|
|
||||||
name: Integration Test Suite
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [integration-mac-windows, integration-postgres]
|
|
||||||
steps:
|
|
||||||
- name: "Integration Tests Failed"
|
|
||||||
if: ${{ contains(needs.integration-mac-windows.result, 'failure') || contains(needs.integration-mac-windows.result, 'cancelled') || contains(needs.integration-postgres.result, 'failure') || contains(needs.integration-postgres.result, 'cancelled') }}
|
|
||||||
# when this is true the next step won't execute
|
|
||||||
run: |
|
|
||||||
echo "::notice title='Integration test suite failed'"
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
- name: "Integration Tests Passed"
|
|
||||||
run: |
|
|
||||||
echo "::notice title='Integration test suite passed'"
|
|
||||||
|
|
||||||
build:
|
|
||||||
name: build packages
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check out the repository
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # actions/setup-python@v6
|
|
||||||
with:
|
|
||||||
python-version: "3.10"
|
|
||||||
|
|
||||||
- name: Install python dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --user --upgrade pip
|
|
||||||
python -m pip install --upgrade hatch twine check-wheel-contents
|
|
||||||
python -m pip --version
|
|
||||||
|
|
||||||
- name: Build distributions
|
|
||||||
run: ./scripts/build-dist.sh
|
|
||||||
|
|
||||||
- name: Show distributions
|
|
||||||
run: ls -lh dist/
|
|
||||||
|
|
||||||
- name: Check and verify distributions
|
|
||||||
run: |
|
|
||||||
cd core
|
|
||||||
hatch run build:check-all
|
|
||||||
97
.github/workflows/nightly-release.yml
vendored
97
.github/workflows/nightly-release.yml
vendored
@@ -1,97 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# Nightly releases to GitHub and PyPI. This workflow produces the following outcome:
|
|
||||||
# - generate and validate data for night release (commit SHA, version number, release branch);
|
|
||||||
# - pass data to release workflow;
|
|
||||||
# - night release will be pushed to GitHub as a draft release;
|
|
||||||
# - night build will be pushed to test PyPI;
|
|
||||||
#
|
|
||||||
# **why?**
|
|
||||||
# Ensure an automated and tested release process for nightly builds
|
|
||||||
#
|
|
||||||
# **when?**
|
|
||||||
# This workflow runs on schedule or can be run manually on demand.
|
|
||||||
|
|
||||||
name: Nightly Test Release to GitHub and PyPI
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch: # for manual triggering
|
|
||||||
schedule:
|
|
||||||
- cron: 0 9 * * *
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write # this is the permission that allows creating a new release
|
|
||||||
packages: write # this is the permission that allows Docker release
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
env:
|
|
||||||
RELEASE_BRANCH: "main"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
aggregate-release-data:
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
version_number: ${{ steps.nightly-release-version.outputs.number }}
|
|
||||||
release_branch: ${{ steps.release-branch.outputs.name }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "Checkout ${{ github.repository }} Branch ${{ env.RELEASE_BRANCH }}"
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ env.RELEASE_BRANCH }}
|
|
||||||
|
|
||||||
- name: "Get Current Version Number"
|
|
||||||
id: version-number-sources
|
|
||||||
run: |
|
|
||||||
current_version=$(grep '^version = ' core/dbt/__version__.py | sed 's/version = "\(.*\)"/\1/')
|
|
||||||
echo "current_version=$current_version" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: "Audit Version And Parse Into Parts"
|
|
||||||
id: semver
|
|
||||||
uses: dbt-labs/actions/parse-semver@v1.1.0
|
|
||||||
with:
|
|
||||||
version: ${{ steps.version-number-sources.outputs.current_version }}
|
|
||||||
|
|
||||||
- name: "Get Current Date"
|
|
||||||
id: current-date
|
|
||||||
run: echo "date=$(date +'%m%d%Y')" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: "Generate Nightly Release Version Number"
|
|
||||||
id: nightly-release-version
|
|
||||||
run: |
|
|
||||||
number="${{ steps.semver.outputs.version }}.dev${{ steps.current-date.outputs.date }}"
|
|
||||||
echo "number=$number" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: "Audit Nightly Release Version And Parse Into Parts"
|
|
||||||
uses: dbt-labs/actions/parse-semver@v1.1.0
|
|
||||||
with:
|
|
||||||
version: ${{ steps.nightly-release-version.outputs.number }}
|
|
||||||
|
|
||||||
- name: "Set Release Branch"
|
|
||||||
id: release-branch
|
|
||||||
run: |
|
|
||||||
echo "name=${{ env.RELEASE_BRANCH }}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
log-outputs-aggregate-release-data:
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
needs: [aggregate-release-data]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "[DEBUG] Log Outputs"
|
|
||||||
run: |
|
|
||||||
echo version_number: ${{ needs.aggregate-release-data.outputs.version_number }}
|
|
||||||
echo release_branch: ${{ needs.aggregate-release-data.outputs.release_branch }}
|
|
||||||
|
|
||||||
release-github-pypi:
|
|
||||||
needs: [aggregate-release-data]
|
|
||||||
|
|
||||||
uses: ./.github/workflows/release.yml
|
|
||||||
with:
|
|
||||||
target_branch: ${{ needs.aggregate-release-data.outputs.release_branch }}
|
|
||||||
version_number: ${{ needs.aggregate-release-data.outputs.version_number }}
|
|
||||||
test_run: true
|
|
||||||
nightly_release: true
|
|
||||||
secrets: inherit
|
|
||||||
31
.github/workflows/release-branch-tests.yml
vendored
31
.github/workflows/release-branch-tests.yml
vendored
@@ -1,31 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# The purpose of this workflow is to trigger CI to run for each
|
|
||||||
# release branch and main branch on a regular cadence. If the CI workflow
|
|
||||||
# fails for a branch, it will post to #dev-core-alerts to raise awareness.
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# Ensures release branches and main are always shippable and not broken.
|
|
||||||
# Also, can catch any dependencies shifting beneath us that might
|
|
||||||
# introduce breaking changes (could also impact Cloud).
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# Mainly on a schedule of 9:00, 13:00, 18:00 UTC everyday.
|
|
||||||
# Manual trigger can also test on demand
|
|
||||||
|
|
||||||
name: Release branch scheduled testing
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 9,13,18 * * *' # 9:00, 13:00, 18:00 UTC
|
|
||||||
|
|
||||||
workflow_dispatch: # for manual triggering
|
|
||||||
|
|
||||||
# no special access is needed
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run_tests:
|
|
||||||
uses: dbt-labs/actions/.github/workflows/release-branch-tests.yml@main
|
|
||||||
with:
|
|
||||||
workflows_to_run: '["main.yml"]'
|
|
||||||
secrets: inherit
|
|
||||||
281
.github/workflows/release.yml
vendored
281
.github/workflows/release.yml
vendored
@@ -1,281 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# Release workflow provides the following steps:
|
|
||||||
# - checkout the given commit;
|
|
||||||
# - validate version in sources and changelog file for given version;
|
|
||||||
# - bump the version and generate a changelog if needed;
|
|
||||||
# - merge all changes to the target branch if needed;
|
|
||||||
# - run unit and integration tests against given commit;
|
|
||||||
# - build and package that SHA;
|
|
||||||
# - release it to GitHub and PyPI with that specific build;
|
|
||||||
# - release it to Docker
|
|
||||||
#
|
|
||||||
# **why?**
|
|
||||||
# Ensure an automated and tested release process
|
|
||||||
#
|
|
||||||
# **when?**
|
|
||||||
# This workflow can be run manually on demand or can be called by other workflows
|
|
||||||
|
|
||||||
name: "Release to GitHub, PyPI & Docker"
|
|
||||||
run-name: "Release ${{ inputs.version_number }} to GitHub, PyPI & Docker"
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
target_branch:
|
|
||||||
description: "The branch to release from"
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
version_number:
|
|
||||||
description: "The release version number (i.e. 1.0.0b1)"
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
test_run:
|
|
||||||
description: "Test run (Publish release as draft)"
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
required: false
|
|
||||||
nightly_release:
|
|
||||||
description: "Nightly release to dev environment"
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
required: false
|
|
||||||
only_docker:
|
|
||||||
description: "Only release Docker image, skip GitHub & PyPI"
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
required: false
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
target_branch:
|
|
||||||
description: "The branch to release from"
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
version_number:
|
|
||||||
description: "The release version number (i.e. 1.0.0b1)"
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
test_run:
|
|
||||||
description: "Test run (Publish release as draft)"
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
required: false
|
|
||||||
nightly_release:
|
|
||||||
description: "Nightly release to dev environment"
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
required: false
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write # this is the permission that allows creating a new release
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
env:
|
|
||||||
MIN_HATCH_VERSION: "1.11.0"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
job-setup:
|
|
||||||
name: Log Inputs
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
outputs:
|
|
||||||
use_hatch: ${{ steps.use_hatch.outputs.use_hatch }}
|
|
||||||
steps:
|
|
||||||
- name: "[DEBUG] Print Variables"
|
|
||||||
run: |
|
|
||||||
echo Inputs
|
|
||||||
echo The branch to release from: ${{ inputs.target_branch }}
|
|
||||||
echo The release version number: ${{ inputs.version_number }}
|
|
||||||
echo Test run: ${{ inputs.test_run }}
|
|
||||||
echo Nightly release: ${{ inputs.nightly_release }}
|
|
||||||
echo Only Docker: ${{ inputs.only_docker }}
|
|
||||||
|
|
||||||
# In version env.HATCH_VERSION we started to use hatch for build tooling. Before that we used setuptools.
|
|
||||||
# This needs to check if we're using hatch or setuptools based on the version being released. We should
|
|
||||||
# check if the version is greater than or equal to env.HATCH_VERSION. If it is, we use hatch, otherwise we use setuptools.
|
|
||||||
- name: "Check if using hatch"
|
|
||||||
id: use_hatch
|
|
||||||
run: |
|
|
||||||
# Extract major.minor from versions like 1.11.0a1 -> 1.11
|
|
||||||
INPUT_MAJ_MIN=$(echo "${{ inputs.version_number }}" | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')
|
|
||||||
HATCH_MAJ_MIN=$(echo "${{ env.MIN_HATCH_VERSION }}" | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')
|
|
||||||
|
|
||||||
if [ $(echo "$INPUT_MAJ_MIN >= $HATCH_MAJ_MIN" | bc) -eq 1 ]; then
|
|
||||||
echo "use_hatch=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "use_hatch=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: "Notify if using hatch"
|
|
||||||
run: |
|
|
||||||
if [ ${{ steps.use_hatch.outputs.use_hatch }} = "true" ]; then
|
|
||||||
echo "::notice title="Using Hatch": $title::Using Hatch for release"
|
|
||||||
else
|
|
||||||
echo "::notice title="Using Setuptools": $title::Using Setuptools for release"
|
|
||||||
fi
|
|
||||||
|
|
||||||
bump-version-generate-changelog:
|
|
||||||
name: Bump package version, Generate changelog
|
|
||||||
needs: [job-setup]
|
|
||||||
if: ${{ !inputs.only_docker }}
|
|
||||||
|
|
||||||
uses: dbt-labs/dbt-release/.github/workflows/release-prep.yml@main
|
|
||||||
|
|
||||||
with:
|
|
||||||
version_number: ${{ inputs.version_number }}
|
|
||||||
hatch_directory: "core"
|
|
||||||
target_branch: ${{ inputs.target_branch }}
|
|
||||||
env_setup_script_path: "scripts/env-setup.sh"
|
|
||||||
test_run: ${{ inputs.test_run }}
|
|
||||||
nightly_release: ${{ inputs.nightly_release }}
|
|
||||||
use_hatch: ${{ needs.job-setup.outputs.use_hatch == 'true' }} # workflow outputs are strings...
|
|
||||||
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
log-outputs-bump-version-generate-changelog:
|
|
||||||
name: "[Log output] Bump package version, Generate changelog"
|
|
||||||
if: ${{ !failure() && !cancelled() && !inputs.only_docker }}
|
|
||||||
|
|
||||||
needs: [bump-version-generate-changelog]
|
|
||||||
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Print variables
|
|
||||||
run: |
|
|
||||||
echo Final SHA : ${{ needs.bump-version-generate-changelog.outputs.final_sha }}
|
|
||||||
echo Changelog path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }}
|
|
||||||
|
|
||||||
build-test-package:
|
|
||||||
name: Build, Test, Package
|
|
||||||
if: ${{ !failure() && !cancelled() && !inputs.only_docker }}
|
|
||||||
needs: [job-setup, bump-version-generate-changelog]
|
|
||||||
|
|
||||||
uses: dbt-labs/dbt-release/.github/workflows/build.yml@main
|
|
||||||
|
|
||||||
with:
|
|
||||||
sha: ${{ needs.bump-version-generate-changelog.outputs.final_sha }}
|
|
||||||
version_number: ${{ inputs.version_number }}
|
|
||||||
hatch_directory: "core"
|
|
||||||
changelog_path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }}
|
|
||||||
build_script_path: "scripts/build-dist.sh"
|
|
||||||
package_test_command: "dbt --version"
|
|
||||||
test_run: ${{ inputs.test_run }}
|
|
||||||
nightly_release: ${{ inputs.nightly_release }}
|
|
||||||
use_hatch: ${{ needs.job-setup.outputs.use_hatch == 'true' }} # workflow outputs are strings...
|
|
||||||
|
|
||||||
github-release:
|
|
||||||
name: GitHub Release
|
|
||||||
if: ${{ !failure() && !cancelled() && !inputs.only_docker }}
|
|
||||||
|
|
||||||
needs: [bump-version-generate-changelog, build-test-package]
|
|
||||||
|
|
||||||
uses: dbt-labs/dbt-release/.github/workflows/github-release.yml@main
|
|
||||||
|
|
||||||
with:
|
|
||||||
sha: ${{ needs.bump-version-generate-changelog.outputs.final_sha }}
|
|
||||||
version_number: ${{ inputs.version_number }}
|
|
||||||
changelog_path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }}
|
|
||||||
test_run: ${{ inputs.test_run }}
|
|
||||||
|
|
||||||
pypi-release:
|
|
||||||
name: PyPI Release
|
|
||||||
|
|
||||||
needs: [github-release]
|
|
||||||
|
|
||||||
uses: dbt-labs/dbt-release/.github/workflows/pypi-release.yml@main
|
|
||||||
|
|
||||||
with:
|
|
||||||
version_number: ${{ inputs.version_number }}
|
|
||||||
test_run: ${{ inputs.test_run }}
|
|
||||||
|
|
||||||
secrets:
|
|
||||||
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
||||||
TEST_PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
|
||||||
|
|
||||||
determine-docker-package:
|
|
||||||
# dbt-postgres exists within dbt-core for versions 1.7 and earlier but is a separate package for 1.8 and later.
|
|
||||||
# determine if we need to release dbt-core or both dbt-core and dbt-postgres
|
|
||||||
name: Determine Docker Package
|
|
||||||
if: ${{ !failure() && !cancelled() }}
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
needs: [pypi-release]
|
|
||||||
outputs:
|
|
||||||
matrix: ${{ steps.determine-docker-package.outputs.matrix }}
|
|
||||||
steps:
|
|
||||||
- name: "Audit Version And Parse Into Parts"
|
|
||||||
id: semver
|
|
||||||
uses: dbt-labs/actions/parse-semver@v1.1.0
|
|
||||||
with:
|
|
||||||
version: ${{ inputs.version_number }}
|
|
||||||
|
|
||||||
- name: "Determine Packages to Release"
|
|
||||||
id: determine-docker-package
|
|
||||||
run: |
|
|
||||||
if [ ${{ steps.semver.outputs.minor }} -ge 8 ]; then
|
|
||||||
json_output={\"package\":[\"dbt-core\"]}
|
|
||||||
else
|
|
||||||
json_output={\"package\":[\"dbt-core\",\"dbt-postgres\"]}
|
|
||||||
fi
|
|
||||||
echo "matrix=$json_output" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
docker-release:
|
|
||||||
name: "Docker Release for ${{ matrix.package }}"
|
|
||||||
needs: [determine-docker-package]
|
|
||||||
# We cannot release to docker on a test run because it uses the tag in GitHub as
|
|
||||||
# what we need to release but draft releases don't actually tag the commit so it
|
|
||||||
# finds nothing to release
|
|
||||||
if: ${{ !failure() && !cancelled() && (!inputs.test_run || inputs.only_docker) }}
|
|
||||||
strategy:
|
|
||||||
matrix: ${{fromJson(needs.determine-docker-package.outputs.matrix)}}
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
uses: dbt-labs/dbt-release/.github/workflows/release-docker.yml@main
|
|
||||||
with:
|
|
||||||
package: ${{ matrix.package }}
|
|
||||||
version_number: ${{ inputs.version_number }}
|
|
||||||
test_run: ${{ inputs.test_run }}
|
|
||||||
|
|
||||||
slack-notification:
|
|
||||||
name: Slack Notification
|
|
||||||
if: ${{ failure() && (!inputs.test_run || inputs.nightly_release) }}
|
|
||||||
|
|
||||||
needs:
|
|
||||||
[
|
|
||||||
bump-version-generate-changelog,
|
|
||||||
build-test-package,
|
|
||||||
github-release,
|
|
||||||
pypi-release,
|
|
||||||
docker-release,
|
|
||||||
]
|
|
||||||
|
|
||||||
uses: dbt-labs/dbt-release/.github/workflows/slack-post-notification.yml@main
|
|
||||||
with:
|
|
||||||
status: "failure"
|
|
||||||
|
|
||||||
secrets:
|
|
||||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEV_CORE_ALERTS }}
|
|
||||||
|
|
||||||
testing-slack-notification:
|
|
||||||
# sends notifications to #slackbot-test
|
|
||||||
name: Testing - Slack Notification
|
|
||||||
if: ${{ failure() && inputs.test_run && !inputs.nightly_release }}
|
|
||||||
|
|
||||||
needs:
|
|
||||||
[
|
|
||||||
bump-version-generate-changelog,
|
|
||||||
build-test-package,
|
|
||||||
github-release,
|
|
||||||
pypi-release,
|
|
||||||
docker-release,
|
|
||||||
]
|
|
||||||
|
|
||||||
uses: dbt-labs/dbt-release/.github/workflows/slack-post-notification.yml@main
|
|
||||||
with:
|
|
||||||
status: "failure"
|
|
||||||
|
|
||||||
secrets:
|
|
||||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_TESTING_WEBHOOK_URL }}
|
|
||||||
30
.github/workflows/repository-cleanup.yml
vendored
30
.github/workflows/repository-cleanup.yml
vendored
@@ -1,30 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# Cleanup branches left over from automation and testing. Also cleanup
|
|
||||||
# draft releases from release testing.
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# The automations are leaving behind branches and releases that clutter
|
|
||||||
# the repository. Sometimes we need them to debug processes so we don't
|
|
||||||
# want them immediately deleted. Running on Saturday to avoid running
|
|
||||||
# at the same time as an actual release to prevent breaking a release
|
|
||||||
# mid-release.
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# Mainly on a schedule of 12:00 Saturday.
|
|
||||||
# Manual trigger can also run on demand
|
|
||||||
|
|
||||||
name: Repository Cleanup
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 12 * * SAT' # At 12:00 on Saturday - details in `why` above
|
|
||||||
|
|
||||||
workflow_dispatch: # for manual triggering
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
cleanup-repo:
|
|
||||||
uses: dbt-labs/actions/.github/workflows/repository-cleanup.yml@main
|
|
||||||
secrets: inherit
|
|
||||||
101
.github/workflows/schema-check.yml
vendored
101
.github/workflows/schema-check.yml
vendored
@@ -1,101 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# Compares the schema of the dbt version of the given ref vs
|
|
||||||
# the latest official schema releases found in schemas.getdbt.com.
|
|
||||||
# If there are differences, the workflow will fail and upload the
|
|
||||||
# diff as an artifact. The metadata team should be alerted to the change.
|
|
||||||
#
|
|
||||||
# **why?**
|
|
||||||
# Reaction work may need to be done if artifact schema changes
|
|
||||||
# occur so we want to proactively alert to it.
|
|
||||||
#
|
|
||||||
# **when?**
|
|
||||||
# Only can be run manually
|
|
||||||
name: Artifact Schema Check
|
|
||||||
|
|
||||||
on:
|
|
||||||
# pull_request:
|
|
||||||
# types: [ opened, reopened, labeled, unlabeled, synchronize ]
|
|
||||||
# paths-ignore: [ '.changes/**', '.github/**', 'tests/**', '**.md', '**.yml' ]
|
|
||||||
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
target_branch:
|
|
||||||
description: "The branch to check against"
|
|
||||||
type: string
|
|
||||||
default: "main"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
# no special access is needed
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
env:
|
|
||||||
LATEST_SCHEMA_PATH: ${{ github.workspace }}/new_schemas
|
|
||||||
SCHEMA_DIFF_ARTIFACT: ${{ github.workspace }}/schema_changes.txt
|
|
||||||
DBT_REPO_DIRECTORY: ${{ github.workspace }}/dbt
|
|
||||||
SCHEMA_REPO_DIRECTORY: ${{ github.workspace }}/schemas.getdbt.com
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
checking-schemas:
|
|
||||||
name: "Post-merge schema changes required"
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # actions/setup-python@v6
|
|
||||||
with:
|
|
||||||
python-version: "3.10"
|
|
||||||
|
|
||||||
- name: Checkout dbt repo
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
with:
|
|
||||||
path: ${{ env.DBT_REPO_DIRECTORY }}
|
|
||||||
ref: ${{ inputs.target_branch }}
|
|
||||||
|
|
||||||
- name: Check for changes in core/dbt/artifacts
|
|
||||||
# https://github.com/marketplace/actions/paths-changes-filter
|
|
||||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # dorny/paths-filter@v3
|
|
||||||
id: check_artifact_changes
|
|
||||||
with:
|
|
||||||
filters: |
|
|
||||||
artifacts_changed:
|
|
||||||
- 'core/dbt/artifacts/**'
|
|
||||||
list-files: shell
|
|
||||||
working-directory: ${{ env.DBT_REPO_DIRECTORY }}
|
|
||||||
|
|
||||||
- name: Succeed if no artifacts have changed
|
|
||||||
if: steps.check_artifact_changes.outputs.artifacts_changed == 'false'
|
|
||||||
run: |
|
|
||||||
echo "No artifact changes found in core/dbt/artifacts. CI check passed."
|
|
||||||
|
|
||||||
- name: Checkout schemas.getdbt.com repo
|
|
||||||
if: steps.check_artifact_changes.outputs.artifacts_changed == 'true'
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: dbt-labs/schemas.getdbt.com
|
|
||||||
ref: "main"
|
|
||||||
path: ${{ env.SCHEMA_REPO_DIRECTORY }}
|
|
||||||
|
|
||||||
- name: Generate current schema
|
|
||||||
if: steps.check_artifact_changes.outputs.artifacts_changed == 'true'
|
|
||||||
run: |
|
|
||||||
cd ${{ env.DBT_REPO_DIRECTORY }}/core
|
|
||||||
pip install --upgrade pip hatch
|
|
||||||
hatch run setup
|
|
||||||
hatch run json-schema -- --path ${{ env.LATEST_SCHEMA_PATH }}
|
|
||||||
|
|
||||||
# Copy generated schema files into the schemas.getdbt.com repo
|
|
||||||
# Do a git diff to find any changes
|
|
||||||
# Ignore any lines with date-like (yyyy-mm-dd) or version-like (x.y.z) changes
|
|
||||||
- name: Compare schemas
|
|
||||||
if: steps.check_artifact_changes.outputs.artifacts_changed == 'true'
|
|
||||||
run: |
|
|
||||||
cp -r ${{ env.LATEST_SCHEMA_PATH }}/dbt ${{ env.SCHEMA_REPO_DIRECTORY }}
|
|
||||||
cd ${{ env.SCHEMA_REPO_DIRECTORY }}
|
|
||||||
git diff -I='*[0-9]{4}-[0-9]{2}-[0-9]{2}' -I='*[0-9]+\.[0-9]+\.[0-9]+' --exit-code > ${{ env.SCHEMA_DIFF_ARTIFACT }}
|
|
||||||
|
|
||||||
- name: Upload schema diff
|
|
||||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # actions/upload-artifact@v4
|
|
||||||
if: ${{ failure() && steps.check_artifact_changes.outputs.artifacts_changed == 'true' }}
|
|
||||||
with:
|
|
||||||
name: "schema_changes.txt"
|
|
||||||
path: "${{ env.SCHEMA_DIFF_ARTIFACT }}"
|
|
||||||
12
.github/workflows/stale.yml
vendored
12
.github/workflows/stale.yml
vendored
@@ -1,12 +0,0 @@
|
|||||||
name: "Close stale issues and PRs"
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: "30 1 * * *"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
issues: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
stale:
|
|
||||||
uses: dbt-labs/actions/.github/workflows/stale-bot-matrix.yml@main
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
# This Action checks makes a dbt run to sample json structured logs
|
|
||||||
# and checks that they conform to the currently documented schema.
|
|
||||||
#
|
|
||||||
# If this action fails it either means we have unintentionally deviated
|
|
||||||
# from our documented structured logging schema, or we need to bump the
|
|
||||||
# version of our structured logging and add new documentation to
|
|
||||||
# communicate these changes.
|
|
||||||
|
|
||||||
name: Structured Logging Schema Check
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- "main"
|
|
||||||
- "*.latest"
|
|
||||||
- "releases/*"
|
|
||||||
pull_request:
|
|
||||||
merge_group:
|
|
||||||
types: [checks_requested]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
# top-level adjustments can be made here
|
|
||||||
env:
|
|
||||||
# number of parallel processes to spawn for python testing
|
|
||||||
PYTHON_INTEGRATION_TEST_WORKERS: 5
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
integration-metadata:
|
|
||||||
name: integration test metadata generation
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
split-groups: ${{ steps.generate-split-groups.outputs.split-groups }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: generate split-groups
|
|
||||||
id: generate-split-groups
|
|
||||||
run: |
|
|
||||||
MATRIX_JSON="["
|
|
||||||
for B in $(seq 1 ${{ env.PYTHON_INTEGRATION_TEST_WORKERS }}); do
|
|
||||||
MATRIX_JSON+=$(sed 's/^/"/;s/$/"/' <<< "${B}")
|
|
||||||
done
|
|
||||||
MATRIX_JSON="${MATRIX_JSON//\"\"/\", \"}"
|
|
||||||
MATRIX_JSON+="]"
|
|
||||||
echo "split-groups=${MATRIX_JSON}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# run the performance measurements on the current or default branch
|
|
||||||
test-schema:
|
|
||||||
name: Test Log Schema
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 30
|
|
||||||
needs:
|
|
||||||
- integration-metadata
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
split-group: ${{ fromJson(needs.integration-metadata.outputs.split-groups) }}
|
|
||||||
env:
|
|
||||||
# turns warnings into errors
|
|
||||||
RUSTFLAGS: "-D warnings"
|
|
||||||
# points tests to the log file
|
|
||||||
LOG_DIR: "/home/runner/work/dbt-core/dbt-core/logs"
|
|
||||||
# tells integration tests to output into json format
|
|
||||||
DBT_LOG_FORMAT: "json"
|
|
||||||
# tell eventmgr to convert logging events into bytes
|
|
||||||
DBT_TEST_BINARY_SERIALIZATION: "true"
|
|
||||||
# Additional test users
|
|
||||||
DBT_TEST_USER_1: dbt_test_user_1
|
|
||||||
DBT_TEST_USER_2: dbt_test_user_2
|
|
||||||
DBT_TEST_USER_3: dbt_test_user_3
|
|
||||||
|
|
||||||
services:
|
|
||||||
# Label used to access the service container
|
|
||||||
postgres:
|
|
||||||
# Docker Hub image
|
|
||||||
image: postgres
|
|
||||||
# Provide the password for postgres
|
|
||||||
env:
|
|
||||||
POSTGRES_PASSWORD: password
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
# Set health checks to wait until postgres has started
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: checkout dev
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Setup Python
|
|
||||||
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # actions/setup-python@v6
|
|
||||||
with:
|
|
||||||
python-version: "3.10"
|
|
||||||
|
|
||||||
- name: Install python dependencies
|
|
||||||
run: |
|
|
||||||
pip install --user --upgrade pip
|
|
||||||
pip --version
|
|
||||||
pip install hatch
|
|
||||||
hatch --version
|
|
||||||
|
|
||||||
- name: Run postgres setup script
|
|
||||||
run: |
|
|
||||||
./scripts/setup_db.sh
|
|
||||||
env:
|
|
||||||
PGHOST: localhost
|
|
||||||
PGPORT: 5432
|
|
||||||
PGPASSWORD: password
|
|
||||||
|
|
||||||
- name: ls
|
|
||||||
run: ls
|
|
||||||
|
|
||||||
# integration tests generate a ton of logs in different files. the next step will find them all.
|
|
||||||
# we actually care if these pass, because the normal test run doesn't usually include many json log outputs
|
|
||||||
- name: Run integration tests
|
|
||||||
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # nick-fields/retry@v3
|
|
||||||
with:
|
|
||||||
timeout_minutes: 30
|
|
||||||
max_attempts: 3
|
|
||||||
command: cd core && hatch run ci:integration-tests -- -nauto
|
|
||||||
env:
|
|
||||||
PYTEST_ADDOPTS: ${{ format('--splits {0} --group {1}', env.PYTHON_INTEGRATION_TEST_WORKERS, matrix.split-group) }}
|
|
||||||
|
|
||||||
test-schema-report:
|
|
||||||
name: Log Schema Test Suite
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: test-schema
|
|
||||||
steps:
|
|
||||||
- name: "[Notification] Log test suite passes"
|
|
||||||
run: |
|
|
||||||
echo "::notice title="Log test suite passes""
|
|
||||||
164
.github/workflows/test-repeater.yml
vendored
164
.github/workflows/test-repeater.yml
vendored
@@ -1,164 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# This workflow will test all test(s) at the input path given number of times to determine if it's flaky or not. You can test with any supported OS/Python combination.
|
|
||||||
# This is batched in 10 to allow more test iterations faster.
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# Testing if a test is flaky and if a previously flaky test has been fixed. This allows easy testing on supported python versions and OS combinations.
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# This is triggered manually from dbt-core.
|
|
||||||
|
|
||||||
name: Flaky Tester
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
branch:
|
|
||||||
description: "Branch to check out"
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: "main"
|
|
||||||
test_path:
|
|
||||||
description: "Path to single test to run (ex: tests/functional/retry/test_retry.py::TestRetry::test_fail_fast)"
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: "tests/functional/..."
|
|
||||||
python_version:
|
|
||||||
description: "Version of Python to Test Against"
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- "3.10"
|
|
||||||
- "3.11"
|
|
||||||
os:
|
|
||||||
description: "OS to run test in"
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- "ubuntu-latest"
|
|
||||||
- "macos-14"
|
|
||||||
- "windows-latest"
|
|
||||||
num_runs_per_batch:
|
|
||||||
description: "Max number of times to run the test per batch. We always run 10 batches."
|
|
||||||
type: number
|
|
||||||
required: true
|
|
||||||
default: "50"
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
debug:
|
|
||||||
runs-on: ${{ vars.UBUNTU_LATEST }}
|
|
||||||
steps:
|
|
||||||
- name: "[DEBUG] Output Inputs"
|
|
||||||
run: |
|
|
||||||
echo "Branch: ${{ inputs.branch }}"
|
|
||||||
echo "test_path: ${{ inputs.test_path }}"
|
|
||||||
echo "python_version: ${{ inputs.python_version }}"
|
|
||||||
echo "os: ${{ inputs.os }}"
|
|
||||||
echo "num_runs_per_batch: ${{ inputs.num_runs_per_batch }}"
|
|
||||||
|
|
||||||
pytest:
|
|
||||||
runs-on: ${{ inputs.os }}
|
|
||||||
strategy:
|
|
||||||
# run all batches, even if one fails. This informs how flaky the test may be.
|
|
||||||
fail-fast: false
|
|
||||||
# using a matrix to speed up the jobs since the matrix will run in parallel when runners are available
|
|
||||||
matrix:
|
|
||||||
batch: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
|
|
||||||
env:
|
|
||||||
PYTEST_ADDOPTS: "-v --color=yes -n4 --csv integration_results.csv"
|
|
||||||
DBT_TEST_USER_1: dbt_test_user_1
|
|
||||||
DBT_TEST_USER_2: dbt_test_user_2
|
|
||||||
DBT_TEST_USER_3: dbt_test_user_3
|
|
||||||
DD_CIVISIBILITY_AGENTLESS_ENABLED: true
|
|
||||||
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
|
||||||
DD_SITE: datadoghq.com
|
|
||||||
DD_ENV: ci
|
|
||||||
DD_SERVICE: ${{ github.event.repository.name }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "Checkout code"
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ inputs.branch }}
|
|
||||||
|
|
||||||
- name: "Setup Python"
|
|
||||||
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # actions/setup-python@v6
|
|
||||||
with:
|
|
||||||
python-version: "${{ inputs.python_version }}"
|
|
||||||
|
|
||||||
- name: "Install hatch"
|
|
||||||
run: python -m pip install --user --upgrade pip hatch
|
|
||||||
|
|
||||||
- name: "Setup Dev Environment"
|
|
||||||
run: |
|
|
||||||
cd core
|
|
||||||
hatch run setup
|
|
||||||
|
|
||||||
- name: "Set up postgres (linux)"
|
|
||||||
if: inputs.os == '${{ vars.UBUNTU_LATEST }}'
|
|
||||||
run: |
|
|
||||||
cd core
|
|
||||||
hatch run setup-db
|
|
||||||
|
|
||||||
# mac and windows don't use make due to limitations with docker with those runners in GitHub
|
|
||||||
- name: Set up postgres (macos)
|
|
||||||
if: runner.os == 'macOS'
|
|
||||||
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # nick-fields/retry@v3
|
|
||||||
with:
|
|
||||||
timeout_minutes: 10
|
|
||||||
max_attempts: 3
|
|
||||||
command: ./scripts/setup_db.sh
|
|
||||||
|
|
||||||
- name: "Set up postgres (windows)"
|
|
||||||
if: inputs.os == 'windows-latest'
|
|
||||||
uses: ./.github/actions/setup-postgres-windows
|
|
||||||
|
|
||||||
- name: "Test Command"
|
|
||||||
id: command
|
|
||||||
run: |
|
|
||||||
test_command="python -m pytest ${{ inputs.test_path }}"
|
|
||||||
echo "test_command=$test_command" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: "Run test ${{ inputs.num_runs_per_batch }} times"
|
|
||||||
id: pytest
|
|
||||||
run: |
|
|
||||||
set +e
|
|
||||||
for ((i=1; i<=${{ inputs.num_runs_per_batch }}; i++))
|
|
||||||
do
|
|
||||||
echo "Running pytest iteration $i..."
|
|
||||||
python -m pytest --ddtrace ${{ inputs.test_path }}
|
|
||||||
exit_code=$?
|
|
||||||
|
|
||||||
if [[ $exit_code -eq 0 ]]; then
|
|
||||||
success=$((success + 1))
|
|
||||||
echo "Iteration $i: Success"
|
|
||||||
else
|
|
||||||
failure=$((failure + 1))
|
|
||||||
echo "Iteration $i: Failure"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "==========================="
|
|
||||||
echo "Successful runs: $success"
|
|
||||||
echo "Failed runs: $failure"
|
|
||||||
echo "==========================="
|
|
||||||
echo
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "failure=$failure" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: "Success and Failure Summary: ${{ inputs.os }}/Python ${{ inputs.python_version }}"
|
|
||||||
run: |
|
|
||||||
echo "Batch: ${{ matrix.batch }}"
|
|
||||||
echo "Successful runs: ${{ steps.pytest.outputs.success }}"
|
|
||||||
echo "Failed runs: ${{ steps.pytest.outputs.failure }}"
|
|
||||||
|
|
||||||
- name: "Error for Failures"
|
|
||||||
if: ${{ steps.pytest.outputs.failure }}
|
|
||||||
run: |
|
|
||||||
echo "Batch ${{ matrix.batch }} failed ${{ steps.pytest.outputs.failure }} of ${{ inputs.num_runs_per_batch }} tests"
|
|
||||||
exit 1
|
|
||||||
31
.github/workflows/triage-labels.yml
vendored
31
.github/workflows/triage-labels.yml
vendored
@@ -1,31 +0,0 @@
|
|||||||
# **what?**
|
|
||||||
# When the core team triages, we sometimes need more information from the issue creator. In
|
|
||||||
# those cases we remove the `triage` label and add the `awaiting_response` label. Once we
|
|
||||||
# recieve a response in the form of a comment, we want the `awaiting_response` label removed
|
|
||||||
# in favor of the `triage` label so we are aware that the issue needs action.
|
|
||||||
|
|
||||||
# **why?**
|
|
||||||
# To help with out team triage issue tracking
|
|
||||||
|
|
||||||
# **when?**
|
|
||||||
# This will run when a comment is added to an issue and that issue has to `awaiting_response` label.
|
|
||||||
|
|
||||||
name: Update Triage Label
|
|
||||||
|
|
||||||
on: issue_comment
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
issues: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
triage_label:
|
|
||||||
if: contains(github.event.issue.labels.*.name, 'awaiting_response')
|
|
||||||
uses: dbt-labs/actions/.github/workflows/swap-labels.yml@main
|
|
||||||
with:
|
|
||||||
add_label: "triage"
|
|
||||||
remove_label: "awaiting_response"
|
|
||||||
secrets: inherit
|
|
||||||
30
.gitignore
vendored
30
.gitignore
vendored
@@ -11,11 +11,8 @@ __pycache__/
|
|||||||
env*/
|
env*/
|
||||||
dbt_env/
|
dbt_env/
|
||||||
build/
|
build/
|
||||||
!tests/functional/build
|
|
||||||
!core/dbt/docs/build
|
|
||||||
develop-eggs/
|
develop-eggs/
|
||||||
dist/
|
dist/
|
||||||
dist-*/
|
|
||||||
downloads/
|
downloads/
|
||||||
eggs/
|
eggs/
|
||||||
.eggs/
|
.eggs/
|
||||||
@@ -27,11 +24,8 @@ var/
|
|||||||
*.egg-info/
|
*.egg-info/
|
||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.egg
|
||||||
.mypy_cache/
|
*.mypy_cache/
|
||||||
.dmypy.json
|
|
||||||
logs/
|
logs/
|
||||||
.user.yml
|
|
||||||
profiles.yml
|
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# Usually these files are written by a python script from a template
|
||||||
@@ -55,12 +49,9 @@ coverage.xml
|
|||||||
*,cover
|
*,cover
|
||||||
.hypothesis/
|
.hypothesis/
|
||||||
test.env
|
test.env
|
||||||
makefile.test.env
|
|
||||||
*.pytest_cache/
|
|
||||||
|
|
||||||
# Unit test artifacts
|
|
||||||
index.html
|
|
||||||
|
|
||||||
|
# Mypy
|
||||||
|
.mypy_cache/
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
*.mo
|
*.mo
|
||||||
@@ -75,10 +66,10 @@ docs/_build/
|
|||||||
# PyBuilder
|
# PyBuilder
|
||||||
target/
|
target/
|
||||||
|
|
||||||
# Ipython Notebook
|
#Ipython Notebook
|
||||||
.ipynb_checkpoints
|
.ipynb_checkpoints
|
||||||
|
|
||||||
# Emacs
|
#Emacs
|
||||||
*~
|
*~
|
||||||
|
|
||||||
# Sublime Text
|
# Sublime Text
|
||||||
@@ -87,7 +78,6 @@ target/
|
|||||||
# Vim
|
# Vim
|
||||||
*.sw*
|
*.sw*
|
||||||
|
|
||||||
# Pyenv
|
|
||||||
.python-version
|
.python-version
|
||||||
|
|
||||||
# Vim
|
# Vim
|
||||||
@@ -95,21 +85,11 @@ target/
|
|||||||
|
|
||||||
# pycharm
|
# pycharm
|
||||||
.idea/
|
.idea/
|
||||||
venv/
|
|
||||||
.venv*/
|
|
||||||
|
|
||||||
# AWS credentials
|
# AWS credentials
|
||||||
.aws/
|
.aws/
|
||||||
|
|
||||||
# MacOS
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
# vscode
|
# vscode
|
||||||
.vscode/
|
.vscode/
|
||||||
*.code-workspace
|
|
||||||
|
|
||||||
# poetry
|
|
||||||
poetry.lock
|
|
||||||
|
|
||||||
# asdf
|
|
||||||
.tool-versions
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
[settings]
|
|
||||||
profile=black
|
|
||||||
extend_skip_glob=.github/*,third-party-stubs/*,scripts/*
|
|
||||||
known_first_party=dbt,dbt_adapters,dbt_common,dbt_extractor,dbt_semantic_interfaces
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
# Configuration for pre-commit hooks (see https://pre-commit.com/).
|
|
||||||
# Eventually the hooks described here will be run as tests before merging each PR.
|
|
||||||
|
|
||||||
exclude: ^(core/dbt/docs/build/|core/dbt/common/events/types_pb2.py|core/dbt/adapters/events/adapter_types_pb2.py)
|
|
||||||
|
|
||||||
# Force all unspecified python hooks to run python 3.10
|
|
||||||
default_language_version:
|
|
||||||
python: python3
|
|
||||||
|
|
||||||
repos:
|
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
||||||
rev: v3.2.0
|
|
||||||
hooks:
|
|
||||||
- id: check-yaml
|
|
||||||
args: [--unsafe]
|
|
||||||
- id: check-json
|
|
||||||
- id: end-of-file-fixer
|
|
||||||
exclude: schemas/dbt/manifest/
|
|
||||||
- id: trailing-whitespace
|
|
||||||
exclude_types:
|
|
||||||
- "markdown"
|
|
||||||
- id: check-case-conflict
|
|
||||||
# local hooks are used to run the hooks in the local environment instead of a pre-commit isolated one.
|
|
||||||
# This ensures that the hooks are run with the same version of the dependencies as the local environment
|
|
||||||
# without having to manually keep them in sync.
|
|
||||||
- repo: local
|
|
||||||
hooks:
|
|
||||||
# Formatter/linter/type-checker pins live in the pyproject.dev optional dependency.
|
|
||||||
- id: isort
|
|
||||||
name: isort
|
|
||||||
entry: python -m isort
|
|
||||||
language: system
|
|
||||||
types: [python]
|
|
||||||
- id: black
|
|
||||||
name: black
|
|
||||||
entry: python -m black
|
|
||||||
language: system
|
|
||||||
types: [python]
|
|
||||||
- id: black-check
|
|
||||||
name: black-check
|
|
||||||
entry: python -m black
|
|
||||||
args:
|
|
||||||
- "--check"
|
|
||||||
- "--diff"
|
|
||||||
language: system
|
|
||||||
stages: [manual]
|
|
||||||
types: [python]
|
|
||||||
- id: flake8
|
|
||||||
name: flake8
|
|
||||||
entry: python -m flake8
|
|
||||||
language: system
|
|
||||||
types: [python]
|
|
||||||
- id: flake8-check
|
|
||||||
name: flake8-check
|
|
||||||
entry: python -m flake8
|
|
||||||
language: system
|
|
||||||
stages: [manual]
|
|
||||||
types: [python]
|
|
||||||
# N.B.: Mypy is... a bit fragile.
|
|
||||||
#
|
|
||||||
# By using `language: system` we run this hook in the local
|
|
||||||
# environment instead of a pre-commit isolated one. This is needed
|
|
||||||
# to ensure mypy correctly parses the project.
|
|
||||||
#
|
|
||||||
# It may cause trouble
|
|
||||||
# in that it adds environmental variables out of our control to the
|
|
||||||
# mix. Unfortunately, there's nothing we can do about per pre-commit's
|
|
||||||
# author.
|
|
||||||
# See https://github.com/pre-commit/pre-commit/issues/730 for details.
|
|
||||||
- id: mypy
|
|
||||||
name: mypy
|
|
||||||
entry: python -m mypy
|
|
||||||
args: [--show-error-codes]
|
|
||||||
files: ^core/dbt/
|
|
||||||
language: system
|
|
||||||
types: [python]
|
|
||||||
- id: mypy-check
|
|
||||||
name: mypy-check
|
|
||||||
entry: python -m mypy
|
|
||||||
args: [--show-error-codes, --pretty]
|
|
||||||
files: ^core/dbt/
|
|
||||||
language: system
|
|
||||||
stages: [manual]
|
|
||||||
types: [python]
|
|
||||||
- id: no_versioned_artifact_resource_imports
|
|
||||||
name: no_versioned_artifact_resource_imports
|
|
||||||
entry: python scripts/pre-commit-hooks/no_versioned_artifact_resource_imports.py
|
|
||||||
language: system
|
|
||||||
files: ^core/dbt/
|
|
||||||
types: [python]
|
|
||||||
pass_filenames: true
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
The core function of dbt is SQL compilation and execution. Users create projects of dbt resources (models, tests, seeds, snapshots, ...), defined in SQL and YAML files, and they invoke dbt to create, update, or query associated views and tables. Today, dbt makes heavy use of Jinja2 to enable the templating of SQL, and to construct a DAG (Directed Acyclic Graph) from all of the resources in a project. Users can also extend their projects by installing resources (including Jinja macros) from other projects, called "packages."
|
|
||||||
|
|
||||||
## dbt-core
|
|
||||||
|
|
||||||
Most of the python code in the repository is within the `core/dbt` directory.
|
|
||||||
- [`single python files`](core/dbt/README.md): A number of individual files, such as 'compilation.py' and 'exceptions.py'
|
|
||||||
|
|
||||||
The main subdirectories of core/dbt:
|
|
||||||
- [`clients`](core/dbt/clients/README.md): Interface with dependencies (agate, jinja) or across operating systems
|
|
||||||
- [`config`](core/dbt/config/README.md): Reconcile user-supplied configuration from connection profiles, project files, and Jinja macros
|
|
||||||
- [`context`](core/dbt/context/README.md): Build and expose dbt-specific Jinja functionality
|
|
||||||
- [`contracts`](core/dbt/contracts/README.md): Define Python objects (dataclasses) that dbt expects to create and validate
|
|
||||||
- [`deps`](core/dbt/deps/README.md): Package installation and dependency resolution
|
|
||||||
- [`events`](core/dbt/events/README.md): Logging events
|
|
||||||
- [`graph`](core/dbt/graph/README.md): Produce a `networkx` DAG of project resources, and selecting those resources given user-supplied criteria
|
|
||||||
- [`include`](core/dbt/include/README.md): Set up the starter project scaffold.
|
|
||||||
- [`parser`](core/dbt/parser/README.md): Read project files, validate, construct python objects
|
|
||||||
- [`task`](core/dbt/task/README.md): Set forth the actions that dbt can perform when invoked
|
|
||||||
|
|
||||||
### Invoking dbt
|
|
||||||
|
|
||||||
The "tasks" map to top-level dbt commands. So `dbt run` => task.run.RunTask, etc. Some are more like abstract base classes (GraphRunnableTask, for example) but all the concrete types outside of task should map to tasks. Currently one executes at a time. The tasks kick off their “Runners” and those do execute in parallel. The parallelism is managed via a thread pool, in GraphRunnableTask.
|
|
||||||
|
|
||||||
core/dbt/task/docs/index.html
|
|
||||||
This is the docs website code. It comes from the dbt-docs repository, and is generated when a release is packaged.
|
|
||||||
|
|
||||||
## Adapters
|
|
||||||
|
|
||||||
dbt uses an adapter-plugin pattern to extend support to different databases, warehouses, query engines, etc.
|
|
||||||
Note: dbt-postgres used to exist in dbt-core but is now in [the dbt-adapters repo](https://github.com/dbt-labs/dbt-adapters/tree/main/dbt-postgres)
|
|
||||||
|
|
||||||
Each adapter is a mix of python, Jinja2, and SQL. The adapter code also makes heavy use of Jinja2 to wrap modular chunks of SQL functionality, define default implementations, and allow plugins to override it.
|
|
||||||
|
|
||||||
Each adapter plugin is a standalone python package that includes:
|
|
||||||
|
|
||||||
- `dbt/include/[name]`: A "sub-global" dbt project, of YAML and SQL files, that reimplements Jinja macros to use the adapter's supported SQL syntax
|
|
||||||
- `dbt/adapters/[name]`: Python modules that inherit, and optionally reimplement, the base adapter classes defined in dbt-core
|
|
||||||
- `pyproject.toml`
|
|
||||||
|
|
||||||
The Postgres adapter code is the most central, and many of its implementations are used as the default defined in the dbt-core global project. The greater the distance of a data technology from Postgres, the more its adapter plugin may need to reimplement.
|
|
||||||
|
|
||||||
## Testing dbt
|
|
||||||
|
|
||||||
The [`tests/`](tests/) subdirectory includes unit and fuctional tests that run as continuous integration checks against open pull requests. Unit tests check mock inputs and outputs of specific python functions. Functional tests perform end-to-end dbt invocations against real adapters (Postgres) and assert that the results match expectations. See [the contributing guide](CONTRIBUTING.md) for a step-by-step walkthrough of setting up a local development and testing environment.
|
|
||||||
|
|
||||||
## Everything else
|
|
||||||
|
|
||||||
- [docker](docker/): All dbt versions are published as Docker images on DockerHub. This subfolder contains the `Dockerfile` (constant) and `requirements.txt` (one for each version).
|
|
||||||
- [scripts](scripts/): Helper scripts for testing, releasing, and producing JSON schemas. These are not included in distributions of dbt, nor are they rigorously tested—they're just handy tools for the dbt maintainers :)
|
|
||||||
2719
CHANGELOG.md
Executable file → Normal file
2719
CHANGELOG.md
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
356
CONTRIBUTING.md
356
CONTRIBUTING.md
@@ -1,298 +1,222 @@
|
|||||||
# Contributing to `dbt-core`
|
# Contributing to dbt
|
||||||
|
|
||||||
`dbt-core` is open source software. It is what it is today because community members have opened issues, provided feedback, and [contributed to the knowledge loop](https://www.getdbt.com/dbt-labs/values/). Whether you are a seasoned open source contributor or a first-time committer, we welcome and encourage you to contribute code, documentation, ideas, or problem statements to this project.
|
1. [About this document](#about-this-document)
|
||||||
|
2. [Proposing a change](#proposing-a-change)
|
||||||
- [Contributing to `dbt-core`](#contributing-to-dbt-core)
|
3. [Getting the code](#getting-the-code)
|
||||||
- [About this document](#about-this-document)
|
4. [Setting up an environment](#setting-up-an-environment)
|
||||||
- [Notes](#notes)
|
5. [Running dbt in development](#running-dbt-in-development)
|
||||||
- [Getting the code](#getting-the-code)
|
6. [Testing](#testing)
|
||||||
- [Installing git](#installing-git)
|
7. [Submitting a Pull Request](#submitting-a-pull-request)
|
||||||
- [External contributors](#external-contributors)
|
|
||||||
- [dbt Labs contributors](#dbt-labs-contributors)
|
|
||||||
- [Setting up an environment](#setting-up-an-environment)
|
|
||||||
- [Tools](#tools)
|
|
||||||
- [Virtual environments](#virtual-environments)
|
|
||||||
- [Docker and `docker-compose`](#docker-and-docker-compose)
|
|
||||||
- [Postgres (optional)](#postgres-optional)
|
|
||||||
- [Running `dbt-core` in development](#running-dbt-core-in-development)
|
|
||||||
- [Installation](#installation)
|
|
||||||
- [Running `dbt-core`](#running-dbt-core)
|
|
||||||
- [Testing](#testing)
|
|
||||||
- [Initial setup](#initial-setup)
|
|
||||||
- [Test commands](#test-commands)
|
|
||||||
- [Hatch scripts](#hatch-scripts)
|
|
||||||
- [`pre-commit`](#pre-commit)
|
|
||||||
- [`pytest`](#pytest)
|
|
||||||
- [Unit, Integration, Functional?](#unit-integration-functional)
|
|
||||||
- [Debugging](#debugging)
|
|
||||||
- [Assorted development tips](#assorted-development-tips)
|
|
||||||
- [Adding or modifying a CHANGELOG Entry](#adding-or-modifying-a-changelog-entry)
|
|
||||||
- [Submitting a Pull Request](#submitting-a-pull-request)
|
|
||||||
- [Troubleshooting Tips](#troubleshooting-tips)
|
|
||||||
|
|
||||||
## About this document
|
## About this document
|
||||||
|
|
||||||
There are many ways to contribute to the ongoing development of `dbt-core`, such as by participating in discussions and issues. We encourage you to first read our higher-level document: ["Expectations for Open Source Contributors"](https://docs.getdbt.com/docs/contributing/oss-expectations).
|
This document is a guide intended for folks interested in contributing to dbt. Below, we document the process by which members of the community should create issues and submit pull requests (PRs) in this repository. It is not intended as a guide for using dbt, and it assumes a certain level of familiarity with Python concepts such as virtualenvs, `pip`, python modules, filesystems, and so on. This guide assumes you are using macOS or Linux and are comfortable with the command line.
|
||||||
|
|
||||||
The rest of this document serves as a more granular guide for contributing code changes to `dbt-core` (this repository). It is not intended as a guide for using `dbt-core`, and some pieces assume a level of familiarity with Python development and package managers. Specific code snippets in this guide assume you are using macOS or Linux and are comfortable with the command line.
|
If you're new to python development or contributing to open-source software, we encourage you to read this document from start to finish. If you get stuck, drop us a line in the #development channel on [slack](community.getdbt.com).
|
||||||
|
|
||||||
If you get stuck, we're happy to help! Drop us a line in the `#dbt-core-development` channel in the [dbt Community Slack](https://community.getdbt.com).
|
### Signing the CLA
|
||||||
|
|
||||||
### Notes
|
Please note that all contributors to dbt must sign the [Contributor License Agreement](https://docs.getdbt.com/docs/contributor-license-agreements) to have their Pull Request merged into the dbt codebase. If you are unable to sign the CLA, then the dbt maintainers will unfortunately be unable to merge your Pull Request. You are, however, welcome to open issues and comment on existing ones.
|
||||||
|
|
||||||
|
## Proposing a change
|
||||||
|
|
||||||
|
dbt is Apache 2.0-licensed open source software. dbt is what it is today because community members like you have opened issues, provided feedback, and contributed to the knowledge loop for the entire communtiy. Whether you are a seasoned open source contributor or a first-time committer, we welcome and encourage you to contribute code, documentation, ideas, or problem statements to this project.
|
||||||
|
|
||||||
|
### Defining the problem
|
||||||
|
|
||||||
|
If you have an idea for a new feature or if you've discovered a bug in dbt, the first step is to open an issue. Please check the list of [open issues](https://github.com/fishtown-analytics/dbt/issues) before creating a new one. If you find a relevant issue, please add a comment to the open issue instead of creating a new one. There are hundreds of open issues in this repository and it can be hard to know where to look for a relevant open issue. **The dbt maintainers are always happy to point contributors in the right direction**, so please err on the side of documenting your idea in a new issue if you are unsure where a problem statement belongs.
|
||||||
|
|
||||||
|
**Note:** All community-contributed Pull Requests _must_ be associated with an open issue. If you submit a Pull Request that does not pertain to an open issue, you will be asked to create an issue describing the problem before the Pull Request can be reviewed.
|
||||||
|
|
||||||
|
### Discussing the idea
|
||||||
|
|
||||||
|
After you open an issue, a dbt maintainer will follow up by commenting on your issue (usually within 1-3 days) to explore your idea further and advise on how to implement the suggested changes. In many cases, community members will chime in with their own thoughts on the problem statement. If you as the issue creator are interested in submitting a Pull Request to address the issue, you should indicate this in the body of the issue. The dbt maintainers are _always_ happy to help contributors with the implementation of fixes and features, so please also indicate if there's anything you're unsure about or could use guidance around in the issue.
|
||||||
|
|
||||||
|
### Submitting a change
|
||||||
|
|
||||||
|
If an issue is appropriately well scoped and describes a beneficial change to the dbt codebase, then anyone may submit a Pull Request to implement the functionality described in the issue. See the sections below on how to do this.
|
||||||
|
|
||||||
|
The dbt maintainers will add a `good first issue` label if an issue is suitable for a first-time contributor. This label often means that the required code change is small, limited to one database adapter, or a net-new addition that does not impact existing functionality. You can see the list of currently open issues on the [Contribute](https://github.com/fishtown-analytics/dbt/contribute) page.
|
||||||
|
|
||||||
|
Here's a good workflow:
|
||||||
|
- Comment on the open issue, expressing your interest in contributing the required code change
|
||||||
|
- Outline your planned implementation. If you want help getting started, ask!
|
||||||
|
- Follow the steps outlined below to develop locally. Once you have opened a PR, one of the dbt maintainers will work with you to review your code.
|
||||||
|
- Add a test! Tests are crucial for both fixes and new features alike. We want to make sure that code works as intended, and that it avoids any bugs previously encountered. Currently, the best resource for understanding dbt's [unit](test/unit) and [integration](test/integration) tests is the tests themselves. One of the maintainers can help by pointing out relevant examples.
|
||||||
|
|
||||||
|
In some cases, the right resolution to an open issue might be tangential to the dbt codebase. The right path forward might be a documentation update or a change that can be made in user-space. In other cases, the issue might describe functionality that the dbt maintainers are unwilling or unable to incorporate into the dbt codebase. When it is determined that an open issue describes functionality that will not translate to a code change in the dbt repository, the issue will be tagged with the `wontfix` label (see below) and closed.
|
||||||
|
|
||||||
|
### Using issue labels
|
||||||
|
|
||||||
|
The dbt maintainers use labels to categorize open issues. Some labels indicate the databases impacted by the issue, while others describe the domain in the dbt codebase germane to the discussion. While most of these labels are self-explanatory (eg. `snowflake` or `bigquery`), there are others that are worth describing.
|
||||||
|
|
||||||
|
| tag | description |
|
||||||
|
| --- | ----------- |
|
||||||
|
| [triage](https://github.com/fishtown-analytics/dbt/labels/triage) | This is a new issue which has not yet been reviewed by a dbt maintainer. This label is removed when a maintainer reviews and responds to the issue. |
|
||||||
|
| [bug](https://github.com/fishtown-analytics/dbt/labels/bug) | This issue represents a defect or regression in dbt |
|
||||||
|
| [enhancement](https://github.com/fishtown-analytics/dbt/labels/enhancement) | This issue represents net-new functionality in dbt |
|
||||||
|
| [good first issue](https://github.com/fishtown-analytics/dbt/labels/good%20first%20issue) | This issue does not require deep knowledge of the dbt codebase to implement. This issue is appropriate for a first-time contributor. |
|
||||||
|
| [help wanted](https://github.com/fishtown-analytics/dbt/labels/help%20wanted) / [discussion](https://github.com/fishtown-analytics/dbt/labels/discussion) | Conversation around this issue in ongoing, and there isn't yet a clear path forward. Input from community members is most welcome. |
|
||||||
|
| [duplicate](https://github.com/fishtown-analytics/dbt/issues/duplicate) | This issue is functionally identical to another open issue. The dbt maintainers will close this issue and encourage community members to focus conversation on the other one. |
|
||||||
|
| [snoozed](https://github.com/fishtown-analytics/dbt/labels/snoozed) | This issue describes a good idea, but one which will probably not be addressed in a six-month time horizon. The dbt maintainers will revist these issues periodically and re-prioritize them accordingly. |
|
||||||
|
| [stale](https://github.com/fishtown-analytics/dbt/labels/stale) | This is an old issue which has not recently been updated. Stale issues will periodically be closed by dbt maintainers, but they can be re-opened if the discussion is restarted. |
|
||||||
|
| [wontfix](https://github.com/fishtown-analytics/dbt/labels/wontfix) | This issue does not require a code change in the dbt repository, or the maintainers are unwilling/unable to merge a Pull Request which implements the behavior described in the issue. |
|
||||||
|
|
||||||
- **Adapters:** Is your issue or proposed code change related to a specific [database adapter](https://docs.getdbt.com/docs/available-adapters)? If so, please open issues, PRs, and discussions in that adapter's repository instead.
|
|
||||||
- **CLA:** Please note that anyone contributing code to `dbt-core` must sign the [Contributor License Agreement](https://docs.getdbt.com/docs/contributor-license-agreements). If you are unable to sign the CLA, the `dbt-core` maintainers will unfortunately be unable to merge any of your Pull Requests. We welcome you to participate in discussions, open issues, and comment on existing ones.
|
|
||||||
- **Branches:** All pull requests from community contributors should target the `main` branch (default). If the change is needed as a patch for a minor version of dbt that has already been released (or is already a release candidate), a maintainer will backport the changes in your PR to the relevant "latest" release branch (`1.0.latest`, `1.1.latest`, ...). If an issue fix applies to a release branch, that fix should be first committed to the development branch and then to the release branch (rarely release-branch fixes may not apply to `main`).
|
|
||||||
- **Releases**: Before releasing a new minor version of Core, we prepare a series of alphas and release candidates to allow users (especially employees of dbt Labs!) to test the new version in live environments. This is an important quality assurance step, as it exposes the new code to a wide variety of complicated deployments and can surface bugs before official release. Releases are accessible via our [supported installation methods](https://docs.getdbt.com/docs/core/installation-overview#install-dbt-core).
|
|
||||||
|
|
||||||
## Getting the code
|
## Getting the code
|
||||||
|
|
||||||
### Installing git
|
### Installing git
|
||||||
|
|
||||||
You will need `git` in order to download and modify the `dbt-core` source code. On macOS, the best way to download git is to just install [Xcode](https://developer.apple.com/support/xcode/).
|
You will need `git` in order to download and modify the dbt source code. On macOS, the best way to download git is to just install [Xcode](https://developer.apple.com/support/xcode/).
|
||||||
|
|
||||||
### External contributors
|
### External contributors
|
||||||
|
|
||||||
If you are not a member of the `dbt-labs` GitHub organization, you can contribute to `dbt-core` by forking the `dbt-core` repository. For a detailed overview on forking, check out the [GitHub docs on forking](https://help.github.com/en/articles/fork-a-repo). In short, you will need to:
|
If you are not a member of the `fishtown-analytics` GitHub organization, you can contribute to dbt by forking the dbt repository. For a detailed overview on forking, check out the [GitHub docs on forking](https://help.github.com/en/articles/fork-a-repo). In short, you will need to:
|
||||||
|
|
||||||
1. Fork the `dbt-core` repository
|
1. fork the dbt repository
|
||||||
2. Clone your fork locally
|
2. clone your fork locally
|
||||||
3. Check out a new branch for your proposed changes
|
3. check out a new branch for your proposed changes
|
||||||
4. Push changes to your fork
|
4. push changes to your fork
|
||||||
5. Open a pull request against `dbt-labs/dbt-core` from your forked repository
|
5. open a pull request against `fishtown-analytics/dbt` from your forked repository
|
||||||
|
|
||||||
### dbt Labs contributors
|
### Core contributors
|
||||||
|
|
||||||
|
If you are a member of the `fishtown-analytics` GitHub organization, you will have push access to the dbt repo. Rather than
|
||||||
|
forking dbt to make your changes, just clone the repository, check out a new branch, and push directly to that branch.
|
||||||
|
|
||||||
If you are a member of the `dbt-labs` GitHub organization, you will have push access to the `dbt-core` repo. Rather than forking `dbt-core` to make your changes, just clone the repository, check out a new branch, and push directly to that branch.
|
|
||||||
|
|
||||||
## Setting up an environment
|
## Setting up an environment
|
||||||
|
|
||||||
There are some tools that will be helpful to you in developing locally. While this is the list relevant for `dbt-core` development, many of these tools are used commonly across open-source python projects.
|
There are some tools that will be helpful to you in developing locally. While this is the list relevant for dbt development, many of these tools are used commonly across open-source python projects.
|
||||||
|
|
||||||
### Tools
|
### Tools
|
||||||
|
|
||||||
These are the tools used in `dbt-core` development and testing:
|
A short list of tools used in dbt testing that will be helpful to your understanding:
|
||||||
|
|
||||||
- [`hatch`](https://hatch.pypa.io/) for build backend, environment management, and running tests across Python versions (3.10, 3.11, 3.12, and 3.13)
|
- [virtualenv](https://virtualenv.pypa.io/en/stable/) to manage dependencies
|
||||||
- [`pytest`](https://docs.pytest.org/en/latest/) to define, discover, and run tests
|
- [tox](https://tox.readthedocs.io/en/latest/) to manage virtualenvs across python versions
|
||||||
- [`flake8`](https://flake8.pycqa.org/en/latest/) for code linting
|
- [pytest](https://docs.pytest.org/en/latest/) to discover/run tests
|
||||||
- [`black`](https://github.com/psf/black) for code formatting
|
- [make](https://users.cs.duke.edu/~ola/courses/programming/Makefiles/Makefiles.html) - but don't worry too much, nobody _really_ understands how make works and our Makefile is super simple
|
||||||
- [`mypy`](https://mypy.readthedocs.io/en/stable/) for static type checking
|
- [flake8](https://gitlab.com/pycqa/flake8) for code linting
|
||||||
- [`pre-commit`](https://pre-commit.com) to easily run those checks
|
- [CircleCI](https://circleci.com/product/) and [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/)
|
||||||
- [`changie`](https://changie.dev/) to create changelog entries, without merge conflicts
|
|
||||||
- [GitHub Actions](https://github.com/features/actions) for automating tests and checks, once a PR is pushed to the `dbt-core` repository
|
|
||||||
|
|
||||||
A deep understanding of these tools in not required to effectively contribute to `dbt-core`, but we recommend checking out the attached documentation if you're interested in learning more about each one.
|
A deep understanding of these tools in not required to effectively contribute to dbt, but we recommend checking out the attached documentation if you're interested in learning more about them.
|
||||||
|
|
||||||
#### Virtual environments
|
#### virtual environments
|
||||||
|
|
||||||
dbt-core uses [Hatch](https://hatch.pypa.io/) for dependency and environment management. Hatch automatically creates and manages isolated environments for development, testing, and building, so you don't need to manually create virtual environments.
|
We strongly recommend using virtual environments when developing code in dbt. We recommend creating this virtualenv
|
||||||
|
in the root of the dbt repository. To create a new virtualenv, run:
|
||||||
|
```
|
||||||
|
python3 -m venv env
|
||||||
|
source env/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
For more information on how Hatch manages environments, see the [Hatch environment documentation](https://hatch.pypa.io/latest/environment/).
|
This will create and activate a new Python virtual environment.
|
||||||
|
|
||||||
#### Docker and `docker-compose`
|
#### docker and docker-compose
|
||||||
|
|
||||||
Docker and `docker-compose` are both used in testing. Specific instructions for you OS can be found [here](https://docs.docker.com/get-docker/).
|
Docker and docker-compose are both used in testing. For macOS, the easiest thing to do is to [download docker for mac](https://store.docker.com/editions/community/docker-ce-desktop-mac). You'll need to make an account. On Linux, you can use one of the packages [here](https://docs.docker.com/install/#server). We recommend installing from docker.com instead of from your package manager. On Linux you also have to install docker-compose separately, following [these instructions](https://docs.docker.com/compose/install/#install-compose).
|
||||||
|
|
||||||
|
|
||||||
#### Postgres (optional)
|
#### postgres (optional)
|
||||||
|
|
||||||
For testing, and later in the examples in this document, you may want to have `psql` available so you can poke around in the database and see what happened. We recommend that you use [homebrew](https://brew.sh/) for that on macOS, and your package manager on Linux. You can install any version of the postgres client that you'd like. On macOS, with homebrew setup, you can run:
|
For testing, and later in the examples in this document, you may want to have `psql` available so you can poke around in the database and see what happened. We recommend that you use [homebrew](https://brew.sh/) for that on macOS, and your package manager on Linux. You can install any version of the postgres client that you'd like. On macOS, with homebrew setup, you can run:
|
||||||
|
|
||||||
```sh
|
```
|
||||||
brew install postgresql
|
brew install postgresql
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running `dbt-core` in development
|
## Running dbt in development
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
First make sure you have Python 3.10 or later installed. Ensure you have the latest version of pip installed with `pip install --upgrade pip`. Next, install `hatch`. Finally set up `dbt-core` for development:
|
First make sure that you set up your `virtualenv` as described in section _Setting up an environment_. Next, install dbt (and its dependencies) with:
|
||||||
|
|
||||||
```sh
|
```
|
||||||
cd core
|
pip install -r editable_requirements.txt
|
||||||
hatch run setup
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This will install all development dependencies and set up pre-commit hooks.
|
When dbt is installed from source in this way, any changes you make to the dbt source code will be reflected immediately in your next `dbt` run.
|
||||||
|
|
||||||
By default, hatch will use whatever Python version is active in your environment. To specify a particular Python version, set the `HATCH_PYTHON` environment variable:
|
### Running dbt
|
||||||
|
|
||||||
```sh
|
With your virtualenv activated, the `dbt` script should point back to the source code you've cloned on your machine. You can verify this by running `which dbt`. This command should show you a path to an executable in your virtualenv.
|
||||||
export HATCH_PYTHON=3.12
|
|
||||||
hatch env create
|
|
||||||
```
|
|
||||||
|
|
||||||
Or add it to your shell profile (e.g., `~/.zshrc` or `~/.bashrc`) for persistence.
|
Configure your [profile](https://docs.getdbt.com/docs/configure-your-profile) as necessary to connect to your target databases. It may be a good idea to add a new profile pointing to a local postgres instance, or a specific test sandbox within your data warehouse if appropriate.
|
||||||
|
|
||||||
When installed in this way, any changes you make to your local copy of the source code will be reflected immediately in your next `dbt` run.
|
|
||||||
|
|
||||||
#### Building dbt-core
|
|
||||||
|
|
||||||
dbt-core uses [Hatch](https://hatch.pypa.io/) (specifically `hatchling`) as its build backend. To build distribution packages:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cd core
|
|
||||||
hatch build
|
|
||||||
```
|
|
||||||
|
|
||||||
This will create both wheel (`.whl`) and source distribution (`.tar.gz`) files in the `dist/` directory.
|
|
||||||
|
|
||||||
The build configuration is defined in `core/pyproject.toml`. You can also use the standard `python -m build` command if you prefer.
|
|
||||||
|
|
||||||
### Running `dbt-core`
|
|
||||||
|
|
||||||
Once you've run `hatch run setup`, the `dbt` command will be available in your PATH. You can verify this by running `which dbt`.
|
|
||||||
|
|
||||||
Configure your [profile](https://docs.getdbt.com/docs/configure-your-profile) as necessary to connect to your target databases. It may be a good idea to add a new profile pointing to a local Postgres instance, or a specific test sandbox within your data warehouse if appropriate. Make sure to create a profile before running integration tests.
|
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
Once you're able to manually test that your code change is working as expected, it's important to run existing automated tests, as well as adding some new ones. These tests will ensure that:
|
Getting the dbt integration tests set up in your local environment will be very helpful as you start to make changes to your local version of dbt. The section that follows outlines some helpful tips for setting up the test environment.
|
||||||
- Your code changes do not unexpectedly break other established functionality
|
|
||||||
- Your code changes can handle all known edge cases
|
|
||||||
- The functionality you're adding will _keep_ working in the future
|
|
||||||
|
|
||||||
Although `dbt-core` works with a number of different databases, you won't need to supply credentials for every one of these databases in your test environment. Instead, you can test most `dbt-core` code changes with Python and Postgres.
|
### Running tests via Docker
|
||||||
|
|
||||||
### Initial setup
|
dbt's unit and integration tests run in Docker. Because dbt works with a number of different databases, you will need to supply credentials for one or more of these databases in your test environment. Most organizations don't have access to each of a BigQuery, Redshift, Snowflake, and Postgres database, so it's likely that you will be unable to run every integration test locally. Fortunately, Fishtown Analytics provides a CI environment with access to sandboxed Redshift, Snowflake, BigQuery, and Postgres databases. See the section on [_Submitting a Pull Request_](#submitting-a-pull-request) below for more information on this CI setup.
|
||||||
|
|
||||||
Postgres offers the easiest way to test most `dbt-core` functionality today. They are the fastest to run, and the easiest to set up. To run the Postgres integration tests, you'll have to do one extra step of setting up the test database:
|
|
||||||
|
|
||||||
```sh
|
### Specifying your test credentials
|
||||||
cd core
|
|
||||||
hatch run setup-db
|
dbt uses test credentials specified in a `test.env` file in the root of the repository. This `test.env` file is git-ignored, but please be _extra_ careful to never check in credentials or other sensitive information when developing against dbt. To create your `test.env` file, copy the provided sample file, then supply your relevant credentials:
|
||||||
|
|
||||||
|
```
|
||||||
|
cp test.env.sample test.env
|
||||||
|
atom test.env # supply your credentials
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, you can run the setup commands directly:
|
We recommend starting with dbt's Postgres tests. These tests cover most of the functionality in dbt, are the fastest to run, and are the easiest to set up. dbt's test suite runs Postgres in a Docker container, so no setup should be required to run these tests.
|
||||||
|
|
||||||
```sh
|
If you additionally want to test Snowflake, Bigquery, or Redshift, locally you'll need to get credentials and add them to the `test.env` file. In general, it's most important to have successful unit and Postgres tests. Once you open a PR, dbt will automatically run integration tests for the other three core database adapters. Of course, if you are a BigQuery user, contributing a BigQuery-only feature, it's important to run BigQuery tests as well.
|
||||||
docker-compose up -d database
|
|
||||||
PGHOST=localhost PGUSER=root PGPASSWORD=password PGDATABASE=postgres bash scripts/setup_db.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test commands
|
### Test commands
|
||||||
|
|
||||||
There are a few methods for running tests locally.
|
dbt's unit tests and Python linter can be run with:
|
||||||
|
|
||||||
#### Hatch scripts
|
```
|
||||||
|
make test-unit
|
||||||
The primary way to run tests and checks is using hatch scripts (defined in `core/hatch.toml`):
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cd core
|
|
||||||
|
|
||||||
# Run all unit tests
|
|
||||||
hatch run unit-tests
|
|
||||||
|
|
||||||
# Run unit tests and all code quality checks
|
|
||||||
hatch run test
|
|
||||||
|
|
||||||
# Run integration tests
|
|
||||||
hatch run integration-tests
|
|
||||||
|
|
||||||
# Run integration tests in fail-fast mode
|
|
||||||
hatch run integration-tests-fail-fast
|
|
||||||
|
|
||||||
# Run linting checks only
|
|
||||||
hatch run lint
|
|
||||||
hatch run flake8
|
|
||||||
hatch run mypy
|
|
||||||
hatch run black
|
|
||||||
|
|
||||||
# Run all pre-commit hooks
|
|
||||||
hatch run code-quality
|
|
||||||
|
|
||||||
# Clean build artifacts
|
|
||||||
hatch run clean
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Hatch manages isolated environments and dependencies automatically. The commands above use the `default` environment which is recommended for most local development.
|
To run the Postgres + Python 3.6 integration tests, you'll have to do one extra step of setting up the test database:
|
||||||
|
|
||||||
**Using the `ci` environment (optional)**
|
```
|
||||||
|
docker-compose up -d database
|
||||||
If you need to replicate exactly what runs in GitHub Actions (e.g., with coverage reporting), use the `ci` environment:
|
PGHOST=localhost PGUSER=root PGPASSWORD=password PGDATABASE=postgres bash test/setup_db.sh
|
||||||
|
|
||||||
```sh
|
|
||||||
cd core
|
|
||||||
|
|
||||||
# Run unit tests with coverage
|
|
||||||
hatch run ci:unit-tests
|
|
||||||
|
|
||||||
# Run unit tests with a specific Python version
|
|
||||||
hatch run +py=3.11 ci:unit-tests
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note:** Most developers should use the default environment (`hatch run unit-tests`). The `ci` environment is primarily for debugging CI failures or running tests with coverage.
|
To run a quick test for Python3 integration tests on Postgres, you can run:
|
||||||
|
|
||||||
#### `pre-commit`
|
```
|
||||||
|
make test-quick
|
||||||
[`pre-commit`](https://pre-commit.com) takes care of running all code-checks for formatting and linting. Run `hatch run setup` to install `pre-commit` in your local environment (we recommend running this command with a python virtual environment active). This installs several pip executables including black, mypy, and flake8. Once installed, hooks will run automatically on `git commit`, or you can run them manually with `hatch run code-quality`.
|
|
||||||
|
|
||||||
#### `pytest`
|
|
||||||
|
|
||||||
Finally, you can also run a specific test or group of tests using [`pytest`](https://docs.pytest.org/en/latest/) directly. After running `hatch run setup`, you can run pytest commands like:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# run all unit tests in a file
|
|
||||||
python3 -m pytest tests/unit/test_invocation_id.py
|
|
||||||
# run a specific unit test
|
|
||||||
python3 -m pytest tests/unit/test_invocation_id.py::TestInvocationId::test_invocation_id
|
|
||||||
# run specific Postgres functional tests
|
|
||||||
python3 -m pytest tests/functional/sources
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> See [pytest usage docs](https://docs.pytest.org/en/6.2.x/usage.html) for an overview of useful command-line options.
|
To run tests for a specific database, invoke `tox` directly with the required flags:
|
||||||
|
```
|
||||||
|
# Run Postgres py36 tests
|
||||||
|
docker-compose run test tox -e integration-postgres-py36 -- -x
|
||||||
|
|
||||||
### Unit, Integration, Functional?
|
# Run Snowflake py36 tests
|
||||||
|
docker-compose run test tox -e integration-snowflake-py36 -- -x
|
||||||
|
|
||||||
Here are some general rules for adding tests:
|
# Run BigQuery py36 tests
|
||||||
* unit tests (`tests/unit`) don’t need to access a database; "pure Python" tests should be written as unit tests
|
docker-compose run test tox -e integration-bigquery-py36 -- -x
|
||||||
* functional tests (`tests/functional`) cover anything that interacts with a database, namely adapter
|
|
||||||
|
|
||||||
## Debugging
|
# Run Redshift py36 tests
|
||||||
|
docker-compose run test tox -e integration-redshift-py36 -- -x
|
||||||
1. The logs for a `dbt run` have stack traces and other information for debugging errors (in `logs/dbt.log` in your project directory).
|
|
||||||
2. Try using a debugger, like `ipdb`. For pytest: `--pdb --pdbcls=IPython.terminal.debugger:pdb`
|
|
||||||
3. Sometimes, it’s easier to debug on a single thread: `dbt --single-threaded run`
|
|
||||||
4. To make print statements from Jinja macros: `{{ log(msg, info=true) }}`
|
|
||||||
5. You can also add `{{ debug() }}` statements, which will drop you into some auto-generated code that the macro wrote.
|
|
||||||
6. The dbt “artifacts” are written out to the ‘target’ directory of your dbt project. They are in unformatted json, which can be hard to read. Format them with:
|
|
||||||
> python -m json.tool target/run_results.json > run_results.json
|
|
||||||
|
|
||||||
### Assorted development tips
|
|
||||||
* Append `# type: ignore` to the end of a line if you need to disable `mypy` on that line.
|
|
||||||
* Sometimes flake8 complains about lines that are actually fine, in which case you can put a comment on the line such as: # noqa or # noqa: ANNN, where ANNN is the error code that flake8 issues.
|
|
||||||
* To collect output for `CProfile`, run dbt with the `-r` option and the name of an output file, i.e. `dbt -r dbt.cprof run`. If you just want to profile parsing, you can do: `dbt -r dbt.cprof parse`. `pip` install `snakeviz` to view the output. Run `snakeviz dbt.cprof` and output will be rendered in a browser window.
|
|
||||||
|
|
||||||
## Adding or modifying a CHANGELOG Entry
|
|
||||||
|
|
||||||
We use [changie](https://changie.dev) to generate `CHANGELOG` entries. **Note:** Do not edit the `CHANGELOG.md` directly. Your modifications will be lost.
|
|
||||||
|
|
||||||
Follow the steps to [install `changie`](https://changie.dev/guide/installation/) for your system.
|
|
||||||
|
|
||||||
Once changie is installed and your PR is created for a new feature, simply run the following command and changie will walk you through the process of creating a changelog entry:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
changie new
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Commit the file that's created and your changelog entry is complete!
|
To run a specific test by itself:
|
||||||
|
```
|
||||||
|
docker-compose run test tox -e explicit-py36 -- -s -x -m profile_{adapter} {path_to_test_file_or_folder}
|
||||||
|
```
|
||||||
|
E.g.
|
||||||
|
```
|
||||||
|
docker-compose run test tox -e explicit-py36 -- -s -x -m profile_snowflake test/integration/001_simple_copy_test
|
||||||
|
```
|
||||||
|
|
||||||
If you are contributing to a feature already in progress, you will modify the changie yaml file in dbt/.changes/unreleased/ related to your change. If you need help finding this file, please ask within the discussion for the pull request!
|
See the `Makefile` contents for more some other examples of ways to run `tox`.
|
||||||
|
|
||||||
You don't need to worry about which `dbt-core` version your change will go into. Just create the changelog entry with `changie`, and open your PR against the `main` branch. All merged changes will be included in the next minor version of `dbt-core`. The Core maintainers _may_ choose to "backport" specific changes in order to patch older minor versions. In that case, a maintainer will take care of that backport after merging your PR, before releasing the new version of `dbt-core`.
|
|
||||||
|
|
||||||
## Submitting a Pull Request
|
## Submitting a Pull Request
|
||||||
|
|
||||||
Code can be merged into the current development branch `main` by opening a pull request. If the proposal looks like it's on the right track, then a `dbt-core` maintainer will triage the PR and label it as `ready_for_review`. From this point, two code reviewers will be assigned with the aim of responding to any updates to the PR within about one week. They may suggest code revision for style or clarity, or request that you add unit or integration test(s). These are good things! We believe that, with a little bit of help, anyone can contribute high-quality code. Once merged, your contribution will be available for the next release of `dbt-core`.
|
Fishtown Analytics provides a sandboxed Redshift, Snowflake, and BigQuery database for use in a CI environment. When pull requests are submitted to the `fishtown-analytics/dbt` repo, GitHub will trigger automated tests in CircleCI and Azure Pipelines.
|
||||||
|
|
||||||
Automated tests run via GitHub Actions. If you're a first-time contributor, all tests (including code checks and unit tests) will require a maintainer to approve. Changes in the `dbt-core` repository trigger integration tests against Postgres. dbt Labs also provides CI environments in which to test changes to other adapters, triggered by PRs in those adapters' repositories, as well as periodic maintenance checks of each adapter in concert with the latest `dbt-core` code changes.
|
A dbt maintainer will review your PR. They may suggest code revision for style or clarity, or request that you add unit or integration test(s). These are good things! We believe that, with a little bit of help, anyone can contribute high-quality code.
|
||||||
|
|
||||||
We require signed git commits. See docs [here](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) for setting up code signing.
|
Once all tests are passing and your PR has been approved, a dbt maintainer will merge your changes into the active development branch. And that's it! Happy developing :tada:
|
||||||
|
|
||||||
Once all tests are passing, all comments are resolved, and your PR has been approved, a `dbt-core` maintainer will merge your changes into the active development branch. And that's it! Happy developing :tada:
|
|
||||||
|
|
||||||
## Troubleshooting Tips
|
|
||||||
|
|
||||||
Sometimes, the content license agreement auto-check bot doesn't find a user's entry in its roster. If you need to force a rerun, add `@cla-bot check` in a comment on the pull request.
|
|
||||||
|
|||||||
@@ -1,16 +1,8 @@
|
|||||||
##
|
FROM ubuntu:18.04
|
||||||
# This dockerfile is used for local development and adapter testing only.
|
|
||||||
# See `/docker` for a generic and production-ready docker file
|
|
||||||
##
|
|
||||||
|
|
||||||
FROM ubuntu:22.04
|
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
software-properties-common gpg-agent \
|
|
||||||
&& add-apt-repository ppa:git-core/ppa -y \
|
|
||||||
&& apt-get dist-upgrade -y \
|
&& apt-get dist-upgrade -y \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
netcat \
|
netcat \
|
||||||
@@ -30,15 +22,22 @@ RUN apt-get update \
|
|||||||
unixodbc-dev \
|
unixodbc-dev \
|
||||||
&& add-apt-repository ppa:deadsnakes/ppa \
|
&& add-apt-repository ppa:deadsnakes/ppa \
|
||||||
&& apt-get install -y \
|
&& apt-get install -y \
|
||||||
python-is-python3 \
|
python \
|
||||||
python-dev-is-python3 \
|
python-dev \
|
||||||
|
python-pip \
|
||||||
|
python3.6 \
|
||||||
|
python3.6-dev \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
python3.10 \
|
python3.6-venv \
|
||||||
python3.10-dev \
|
python3.7 \
|
||||||
python3.10-venv \
|
python3.7-dev \
|
||||||
python3.11 \
|
python3.7-venv \
|
||||||
python3.11-dev \
|
python3.8 \
|
||||||
python3.11-venv \
|
python3.8-dev \
|
||||||
|
python3.8-venv \
|
||||||
|
python3.9 \
|
||||||
|
python3.9-dev \
|
||||||
|
python3.9-venv \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
@@ -47,7 +46,9 @@ RUN curl -LO https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_V
|
|||||||
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
||||||
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
|
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
|
||||||
|
|
||||||
RUN pip3 install -U hatch wheel pre-commit
|
RUN pip3 install -U "tox==3.14.4" wheel "six>=1.14.0,<1.15.0" "virtualenv==20.0.3" setuptools
|
||||||
|
# tox fails if the 'python' interpreter (python2) doesn't have `tox` installed
|
||||||
|
RUN pip install -U "tox==3.14.4" "six>=1.14.0,<1.15.0" "virtualenv==20.0.3" setuptools
|
||||||
|
|
||||||
# These args are passed in via docker-compose, which reads then from the .env file.
|
# These args are passed in via docker-compose, which reads then from the .env file.
|
||||||
# On Linux, run `make .env` to create the .env file for the current user.
|
# On Linux, run `make .env` to create the .env file for the current user.
|
||||||
@@ -62,6 +63,7 @@ RUN if [ ${USER_ID:-0} -ne 0 ] && [ ${GROUP_ID:-0} -ne 0 ]; then \
|
|||||||
useradd -mU -l dbt_test_user; \
|
useradd -mU -l dbt_test_user; \
|
||||||
fi
|
fi
|
||||||
RUN mkdir /usr/app && chown dbt_test_user /usr/app
|
RUN mkdir /usr/app && chown dbt_test_user /usr/app
|
||||||
|
RUN mkdir /home/tox && chown dbt_test_user /home/tox
|
||||||
|
|
||||||
WORKDIR /usr/app
|
WORKDIR /usr/app
|
||||||
VOLUME /usr/app
|
VOLUME /usr/app
|
||||||
|
|||||||
@@ -186,7 +186,7 @@
|
|||||||
same "printed page" as the copyright notice for easier
|
same "printed page" as the copyright notice for easier
|
||||||
identification within third-party archives.
|
identification within third-party archives.
|
||||||
|
|
||||||
Copyright 2021 dbt Labs, Inc.
|
Copyright {yyyy} {name of copyright owner}
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
128
Makefile
128
Makefile
@@ -1,95 +1,49 @@
|
|||||||
# ============================================================================
|
.PHONY: install test test-unit test-integration
|
||||||
# DEPRECATED: This Makefile is maintained for backwards compatibility only.
|
|
||||||
#
|
|
||||||
# dbt-core now uses Hatch for task management and development workflows.
|
|
||||||
# Please migrate to using hatch commands directly:
|
|
||||||
#
|
|
||||||
# make dev → cd core && hatch run setup
|
|
||||||
# make unit → cd core && hatch run unit-tests
|
|
||||||
# make test → cd core && hatch run test
|
|
||||||
# make integration → cd core && hatch run integration-tests
|
|
||||||
# make lint → cd core && hatch run lint
|
|
||||||
# make code_quality → cd core && hatch run code-quality
|
|
||||||
# make setup-db → cd core && hatch run setup-db
|
|
||||||
# make clean → cd core && hatch run clean
|
|
||||||
#
|
|
||||||
# See core/pyproject.toml [tool.hatch.envs.default.scripts] for all available
|
|
||||||
# commands and CONTRIBUTING.md for detailed usage instructions.
|
|
||||||
#
|
|
||||||
# This Makefile will be removed in a future version of dbt-core.
|
|
||||||
# ============================================================================
|
|
||||||
|
|
||||||
.DEFAULT_GOAL:=help
|
changed_tests := `git status --porcelain | grep '^\(M\| M\|A\| A\)' | awk '{ print $$2 }' | grep '\/test_[a-zA-Z_\-\.]\+.py'`
|
||||||
|
|
||||||
.PHONY: dev_req
|
install:
|
||||||
dev_req: ## Installs dbt-* packages in develop mode along with only development dependencies.
|
pip install -e .
|
||||||
@cd core && hatch run dev-req
|
|
||||||
|
|
||||||
.PHONY: dev
|
test: .env
|
||||||
dev: ## Installs dbt-* packages in develop mode along with development dependencies and pre-commit.
|
@echo "Full test run starting..."
|
||||||
@cd core && hatch run setup
|
@time docker-compose run --rm test tox
|
||||||
|
|
||||||
.PHONY: dev-uninstall
|
test-unit: .env
|
||||||
dev-uninstall: ## Uninstall all packages in venv except for build tools
|
@echo "Unit test run starting..."
|
||||||
@pip freeze | grep -v "^-e" | cut -d "@" -f1 | xargs pip uninstall -y; \
|
@time docker-compose run --rm test tox -e unit-py36,flake8
|
||||||
pip uninstall -y dbt-core
|
|
||||||
|
|
||||||
.PHONY: mypy
|
test-integration: .env
|
||||||
mypy: ## Runs mypy against staged changes for static type checking.
|
@echo "Integration test run starting..."
|
||||||
@cd core && hatch run mypy
|
@time docker-compose run --rm test tox -e integration-postgres-py36,integration-redshift-py36,integration-snowflake-py36,integration-bigquery-py36
|
||||||
|
|
||||||
.PHONY: flake8
|
test-quick: .env
|
||||||
flake8: ## Runs flake8 against staged changes to enforce style guide.
|
@echo "Integration test run starting..."
|
||||||
@cd core && hatch run flake8
|
@time docker-compose run --rm test tox -e integration-postgres-py36 -- -x
|
||||||
|
|
||||||
.PHONY: black
|
# This rule creates a file named .env that is used by docker-compose for passing
|
||||||
black: ## Runs black against staged changes to enforce style guide.
|
# the USER_ID and GROUP_ID arguments to the Docker image.
|
||||||
@cd core && hatch run black
|
.env:
|
||||||
|
@touch .env
|
||||||
|
ifneq ($(OS),Windows_NT)
|
||||||
|
ifneq ($(shell uname -s), Darwin)
|
||||||
|
@echo USER_ID=$(shell id -u) > .env
|
||||||
|
@echo GROUP_ID=$(shell id -g) >> .env
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
@time docker-compose build
|
||||||
|
|
||||||
.PHONY: lint
|
clean:
|
||||||
lint: ## Runs flake8 and mypy code checks against staged changes.
|
rm -f .coverage
|
||||||
@cd core && hatch run lint
|
rm -rf .eggs/
|
||||||
|
rm -f .env
|
||||||
.PHONY: code_quality
|
rm -rf .tox/
|
||||||
code_quality: ## Runs all pre-commit hooks against all files.
|
rm -rf build/
|
||||||
@cd core && hatch run code-quality
|
rm -rf dbt.egg-info/
|
||||||
|
rm -f dbt_project.yml
|
||||||
.PHONY: unit
|
rm -rf dist/
|
||||||
unit: ## Runs unit tests with py
|
rm -f htmlcov/*.{css,html,js,json,png}
|
||||||
@cd core && hatch run unit-tests
|
rm -rf logs/
|
||||||
|
rm -rf target/
|
||||||
.PHONY: test
|
find . -type f -name '*.pyc' -delete
|
||||||
test: ## Runs unit tests with py and code checks against staged changes.
|
find . -type d -name '__pycache__' -depth -delete
|
||||||
@cd core && hatch run test
|
|
||||||
|
|
||||||
.PHONY: integration
|
|
||||||
integration: ## Runs core integration tests using postgres with py-integration
|
|
||||||
@cd core && hatch run integration-tests
|
|
||||||
|
|
||||||
.PHONY: integration-fail-fast
|
|
||||||
integration-fail-fast: ## Runs core integration tests using postgres with py-integration in "fail fast" mode.
|
|
||||||
@cd core && hatch run integration-tests-fail-fast
|
|
||||||
|
|
||||||
.PHONY: setup-db
|
|
||||||
setup-db: ## Setup Postgres database with docker-compose for system testing.
|
|
||||||
@cd core && hatch run setup-db
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean: ## Resets development environment.
|
|
||||||
@cd core && hatch run clean
|
|
||||||
|
|
||||||
.PHONY: json_schema
|
|
||||||
json_schema: ## Update generated JSON schema using code changes.
|
|
||||||
@cd core && hatch run json-schema
|
|
||||||
|
|
||||||
.PHONY: help
|
|
||||||
help: ## Show this help message.
|
|
||||||
@echo 'usage: make [target]'
|
|
||||||
@echo
|
|
||||||
@echo 'DEPRECATED: This Makefile is a compatibility shim.'
|
|
||||||
@echo 'Please use "cd core && hatch run <command>" directly.'
|
|
||||||
@echo
|
|
||||||
@echo 'targets:'
|
|
||||||
@grep -E '^[8+a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
||||||
@echo
|
|
||||||
@echo 'For more information, see CONTRIBUTING.md'
|
|
||||||
|
|||||||
46
README.md
46
README.md
@@ -1,16 +1,28 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://raw.githubusercontent.com/dbt-labs/dbt-core/fa1ea14ddfb1d5ae319d5141844910dd53ab2834/etc/dbt-core.svg" alt="dbt logo" width="750"/>
|
<img src="/etc/dbt-logo-full.svg" alt="dbt logo" width="500"/>
|
||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/dbt-labs/dbt-core/actions/workflows/main.yml">
|
<a href="https://codeclimate.com/github/fishtown-analytics/dbt">
|
||||||
<img src="https://github.com/dbt-labs/dbt-core/actions/workflows/main.yml/badge.svg?event=push" alt="CI Badge"/>
|
<img src="https://codeclimate.com/github/fishtown-analytics/dbt/badges/gpa.svg" alt="Code Climate"/>
|
||||||
|
</a>
|
||||||
|
<a href="https://circleci.com/gh/fishtown-analytics/dbt/tree/master">
|
||||||
|
<img src="https://circleci.com/gh/fishtown-analytics/dbt/tree/master.svg?style=svg" alt="CircleCI" />
|
||||||
|
</a>
|
||||||
|
<a href="https://ci.appveyor.com/project/DrewBanin/dbt/branch/development">
|
||||||
|
<img src="https://ci.appveyor.com/api/projects/status/v01rwd3q91jnwp9m/branch/development?svg=true" alt="AppVeyor" />
|
||||||
|
</a>
|
||||||
|
<a href="https://community.getdbt.com">
|
||||||
|
<img src="https://community.getdbt.com/badge.svg" alt="Slack" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.bestpractices.dev/projects/11095"><img src="https://www.bestpractices.dev/projects/11095/badge"></a>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
**[dbt](https://www.getdbt.com/)** enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
|
**[dbt](https://www.getdbt.com/)** (data build tool) enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
|
||||||
|
|
||||||

|
dbt is the T in ELT. Organize, cleanse, denormalize, filter, rename, and pre-aggregate the raw data in your warehouse so that it's ready for analysis.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
dbt can be used to [aggregate pageviews into sessions](https://github.com/fishtown-analytics/snowplow), calculate [ad spend ROI](https://github.com/fishtown-analytics/facebook-ads), or report on [email campaign performance](https://github.com/fishtown-analytics/mailchimp).
|
||||||
|
|
||||||
## Understanding dbt
|
## Understanding dbt
|
||||||
|
|
||||||
@@ -18,22 +30,28 @@ Analysts using dbt can transform their data by simply writing select statements,
|
|||||||
|
|
||||||
These select statements, or "models", form a dbt project. Models frequently build on top of one another – dbt makes it easy to [manage relationships](https://docs.getdbt.com/docs/ref) between models, and [visualize these relationships](https://docs.getdbt.com/docs/documentation), as well as assure the quality of your transformations through [testing](https://docs.getdbt.com/docs/testing).
|
These select statements, or "models", form a dbt project. Models frequently build on top of one another – dbt makes it easy to [manage relationships](https://docs.getdbt.com/docs/ref) between models, and [visualize these relationships](https://docs.getdbt.com/docs/documentation), as well as assure the quality of your transformations through [testing](https://docs.getdbt.com/docs/testing).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
- [Install dbt Core](https://docs.getdbt.com/docs/get-started/installation) or explore the [dbt Cloud CLI](https://docs.getdbt.com/docs/cloud/cloud-cli-installation), a command-line interface powered by [dbt Cloud](https://docs.getdbt.com/docs/cloud/about-cloud/dbt-cloud-features) that enhances collaboration.
|
- [Install dbt](https://docs.getdbt.com/docs/installation)
|
||||||
- Read the [introduction](https://docs.getdbt.com/docs/introduction/) and [viewpoint](https://docs.getdbt.com/docs/about/viewpoint/)
|
- Read the [documentation](https://docs.getdbt.com/).
|
||||||
|
- Productionize your dbt project with [dbt Cloud](https://www.getdbt.com)
|
||||||
|
|
||||||
## Join the dbt Community
|
## Find out more
|
||||||
|
|
||||||
- Be part of the conversation in the [dbt Community Slack](http://community.getdbt.com/)
|
- Check out the [Introduction to dbt](https://docs.getdbt.com/docs/introduction/).
|
||||||
- Read more on the [dbt Community Discourse](https://discourse.getdbt.com)
|
- Read the [dbt Viewpoint](https://docs.getdbt.com/docs/about/viewpoint/).
|
||||||
|
|
||||||
|
## Join thousands of analysts in the dbt community
|
||||||
|
|
||||||
|
- Join the [chat](http://community.getdbt.com/) on Slack.
|
||||||
|
- Find community posts on [dbt Discourse](https://discourse.getdbt.com).
|
||||||
|
|
||||||
## Reporting bugs and contributing code
|
## Reporting bugs and contributing code
|
||||||
|
|
||||||
- Want to report a bug or request a feature? Let us know and open [an issue](https://github.com/dbt-labs/dbt-core/issues/new/choose)
|
- Want to report a bug or request a feature? Let us know on [Slack](http://community.getdbt.com/), or open [an issue](https://github.com/fishtown-analytics/dbt/issues/new).
|
||||||
- Want to help us build dbt? Check out the [Contributing Guide](https://github.com/dbt-labs/dbt-core/blob/HEAD/CONTRIBUTING.md)
|
- Want to help us build dbt? Check out the [Contributing Getting Started Guide](/CONTRIBUTING.md)
|
||||||
|
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
|
|
||||||
|
|||||||
92
RELEASE.md
Normal file
92
RELEASE.md
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
### Release Procedure :shipit:
|
||||||
|
|
||||||
|
#### Branching Strategy
|
||||||
|
|
||||||
|
dbt has three types of branches:
|
||||||
|
|
||||||
|
- **Trunks** track the latest release of a minor version of dbt. Historically, we used the `master` branch as the trunk. Each minor version release has a corresponding trunk. For example, the `0.11.x` series of releases has a branch called `0.11.latest`. This allows us to release new patch versions under `0.11` without necessarily needing to pull them into the latest version of dbt.
|
||||||
|
- **Release Branches** track a specific, not yet complete release of dbt. These releases are codenamed since we don't always know what their semantic version will be. Example: `dev/lucretia-mott` became `0.11.1`.
|
||||||
|
- **Feature Branches** track individual features and fixes. On completion they should be merged into a release branch.
|
||||||
|
|
||||||
|
#### Git & PyPI
|
||||||
|
|
||||||
|
1. Update CHANGELOG.md with the most recent changes
|
||||||
|
2. If this is a release candidate, you want to create it off of your release branch. If it's an actual release, you must first merge to a master branch. Open a Pull Request in Github to merge it into the appropriate trunk (`X.X.latest`)
|
||||||
|
3. Bump the version using `bumpversion`:
|
||||||
|
- Dry run first by running `bumpversion --new-version <desired-version> <part>` and checking the diff. If it looks correct, clean up the chanages and move on:
|
||||||
|
- Alpha releases: `bumpversion --commit --no-tag --new-version 0.10.2a1 num`
|
||||||
|
- Patch releases: `bumpversion --commit --no-tag --new-version 0.10.2 patch`
|
||||||
|
- Minor releases: `bumpversion --commit --no-tag --new-version 0.11.0 minor`
|
||||||
|
- Major releases: `bumpversion --commit --no-tag --new-version 1.0.0 major`
|
||||||
|
4. (If this is a not a release candidate) Merge to `x.x.latest` and (optionally) `master`.
|
||||||
|
5. Update the default branch to the next dev release branch.
|
||||||
|
6. Build source distributions for all packages by running `./scripts/build-sdists.sh`. Note that this will clean out your `dist/` folder, so if you have important stuff in there, don't run it!!!
|
||||||
|
7. Deploy to pypi
|
||||||
|
- `twine upload dist/*`
|
||||||
|
8. Deploy to homebrew (see below)
|
||||||
|
9. Deploy to conda-forge (see below)
|
||||||
|
10. Git release notes (points to changelog)
|
||||||
|
11. Post to slack (point to changelog)
|
||||||
|
|
||||||
|
After releasing a new version, it's important to merge the changes back into the other outstanding release branches. This avoids merge conflicts moving forward.
|
||||||
|
|
||||||
|
In some cases, where the branches have diverged wildly, it's ok to skip this step. But this means that the changes you just released won't be included in future releases.
|
||||||
|
|
||||||
|
#### Homebrew Release Process
|
||||||
|
|
||||||
|
1. Clone the `homebrew-dbt` repository:
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone git@github.com:fishtown-analytics/homebrew-dbt.git
|
||||||
|
```
|
||||||
|
|
||||||
|
2. For ALL releases (prereleases and version releases), copy the relevant formula. To copy from the latest version release of dbt, do:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp Formula/dbt.rb Formula/dbt@{NEW-VERSION}.rb
|
||||||
|
```
|
||||||
|
|
||||||
|
To copy from a different version, simply copy the corresponding file.
|
||||||
|
|
||||||
|
3. Open the file, and edit the following:
|
||||||
|
- the name of the ruby class: this is important, homebrew won't function properly if the class name is wrong. Check historical versions to figure out the right name.
|
||||||
|
- under the `bottle` section, remove all of the hashes (lines starting with `sha256`)
|
||||||
|
|
||||||
|
4. Create a **Python 3.7** virtualenv, activate it, and then install two packages: `homebrew-pypi-poet`, and the version of dbt you are preparing. I use:
|
||||||
|
|
||||||
|
```
|
||||||
|
pyenv virtualenv 3.7.0 homebrew-dbt-{VERSION}
|
||||||
|
pyenv activate homebrew-dbt-{VERSION}
|
||||||
|
pip install dbt=={VERSION} homebrew-pypi-poet
|
||||||
|
```
|
||||||
|
|
||||||
|
homebrew-pypi-poet is a program that generates a valid homebrew formula for an installed pip package. You want to use it to generate a diff against the existing formula. Then you want to apply the diff for the dependency packages only -- e.g. it will tell you that `google-api-core` has been updated and that you need to use the latest version.
|
||||||
|
|
||||||
|
5. reinstall, test, and audit dbt. if the test or audit fails, fix the formula with step 1.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew uninstall --force Formula/{YOUR-FILE}.rb
|
||||||
|
brew install Formula/{YOUR-FILE}.rb
|
||||||
|
brew test dbt
|
||||||
|
brew audit --strict dbt
|
||||||
|
```
|
||||||
|
|
||||||
|
6. Ask Connor to bottle the change (only his laptop can do it!)
|
||||||
|
|
||||||
|
#### Conda Forge Release Process
|
||||||
|
|
||||||
|
1. Clone the fork of `conda-forge/dbt-feedstock` [here](https://github.com/fishtown-analytics/dbt-feedstock)
|
||||||
|
```bash
|
||||||
|
git clone git@github.com:fishtown-analytics/dbt-feedstock.git
|
||||||
|
|
||||||
|
```
|
||||||
|
2. Update the version and sha256 in `recipe/meta.yml`. To calculate the sha256, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wget https://github.com/fishtown-analytics/dbt/archive/v{version}.tar.gz
|
||||||
|
openssl sha256 v{version}.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Push the changes and create a PR against `conda-forge/dbt-feedstock`
|
||||||
|
|
||||||
|
4. Confirm that all automated conda-forge tests are passing
|
||||||
@@ -1 +0,0 @@
|
|||||||
[About dbt Core versions](https://docs.getdbt.com/docs/dbt-versions/core)
|
|
||||||
154
azure-pipelines.yml
Normal file
154
azure-pipelines.yml
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
# Python package
|
||||||
|
# Create and test a Python package on multiple Python versions.
|
||||||
|
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
|
||||||
|
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- master
|
||||||
|
- dev/*
|
||||||
|
- pr/*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- job: UnitTest
|
||||||
|
pool:
|
||||||
|
vmImage: 'vs2017-win2016'
|
||||||
|
steps:
|
||||||
|
- task: UsePythonVersion@0
|
||||||
|
inputs:
|
||||||
|
versionSpec: '3.7'
|
||||||
|
architecture: 'x64'
|
||||||
|
|
||||||
|
- script: python -m pip install --upgrade pip && pip install tox
|
||||||
|
displayName: 'Install dependencies'
|
||||||
|
|
||||||
|
- script: python -m tox -e pywin-unit
|
||||||
|
displayName: Run unit tests
|
||||||
|
|
||||||
|
- job: PostgresIntegrationTest
|
||||||
|
pool:
|
||||||
|
vmImage: 'vs2017-win2016'
|
||||||
|
dependsOn: UnitTest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- pwsh: |
|
||||||
|
$serviceName = Get-Service -Name postgresql*
|
||||||
|
Set-Service -InputObject $serviceName -StartupType Automatic
|
||||||
|
Start-Service -InputObject $serviceName
|
||||||
|
|
||||||
|
& $env:PGBIN\createdb.exe -U postgres dbt
|
||||||
|
& $env:PGBIN\psql.exe -U postgres -c "CREATE ROLE root WITH PASSWORD 'password';"
|
||||||
|
& $env:PGBIN\psql.exe -U postgres -c "ALTER ROLE root WITH LOGIN;"
|
||||||
|
& $env:PGBIN\psql.exe -U postgres -c "GRANT CREATE, CONNECT ON DATABASE dbt TO root WITH GRANT OPTION;"
|
||||||
|
& $env:PGBIN\psql.exe -U postgres -c "CREATE ROLE noaccess WITH PASSWORD 'password' NOSUPERUSER;"
|
||||||
|
& $env:PGBIN\psql.exe -U postgres -c "ALTER ROLE noaccess WITH LOGIN;"
|
||||||
|
& $env:PGBIN\psql.exe -U postgres -c "GRANT CONNECT ON DATABASE dbt TO noaccess;"
|
||||||
|
displayName: Install postgresql and set up database
|
||||||
|
|
||||||
|
- task: UsePythonVersion@0
|
||||||
|
inputs:
|
||||||
|
versionSpec: '3.7'
|
||||||
|
architecture: 'x64'
|
||||||
|
|
||||||
|
- script: python -m pip install --upgrade pip && pip install tox
|
||||||
|
displayName: 'Install dependencies'
|
||||||
|
|
||||||
|
- script: python -m tox -e pywin-postgres
|
||||||
|
displayName: Run integration tests
|
||||||
|
|
||||||
|
# These three are all similar except secure environment variables, which MUST be passed along to their tasks,
|
||||||
|
# but there's probably a better way to do this!
|
||||||
|
- job: SnowflakeIntegrationTest
|
||||||
|
pool:
|
||||||
|
vmImage: 'vs2017-win2016'
|
||||||
|
dependsOn: PostgresIntegrationTest
|
||||||
|
condition: succeeded()
|
||||||
|
steps:
|
||||||
|
- task: UsePythonVersion@0
|
||||||
|
inputs:
|
||||||
|
versionSpec: '3.7'
|
||||||
|
architecture: 'x64'
|
||||||
|
|
||||||
|
- script: python -m pip install --upgrade pip && pip install tox
|
||||||
|
displayName: 'Install dependencies'
|
||||||
|
|
||||||
|
- script: python -m tox -e pywin-snowflake
|
||||||
|
env:
|
||||||
|
SNOWFLAKE_TEST_ACCOUNT: $(SNOWFLAKE_TEST_ACCOUNT)
|
||||||
|
SNOWFLAKE_TEST_PASSWORD: $(SNOWFLAKE_TEST_PASSWORD)
|
||||||
|
SNOWFLAKE_TEST_USER: $(SNOWFLAKE_TEST_USER)
|
||||||
|
SNOWFLAKE_TEST_WAREHOUSE: $(SNOWFLAKE_TEST_WAREHOUSE)
|
||||||
|
SNOWFLAKE_TEST_OAUTH_REFRESH_TOKEN: $(SNOWFLAKE_TEST_OAUTH_REFRESH_TOKEN)
|
||||||
|
SNOWFLAKE_TEST_OAUTH_CLIENT_ID: $(SNOWFLAKE_TEST_OAUTH_CLIENT_ID)
|
||||||
|
SNOWFLAKE_TEST_OAUTH_CLIENT_SECRET: $(SNOWFLAKE_TEST_OAUTH_CLIENT_SECRET)
|
||||||
|
displayName: Run integration tests
|
||||||
|
|
||||||
|
- job: BigQueryIntegrationTest
|
||||||
|
pool:
|
||||||
|
vmImage: 'vs2017-win2016'
|
||||||
|
dependsOn: PostgresIntegrationTest
|
||||||
|
condition: succeeded()
|
||||||
|
steps:
|
||||||
|
- task: UsePythonVersion@0
|
||||||
|
inputs:
|
||||||
|
versionSpec: '3.7'
|
||||||
|
architecture: 'x64'
|
||||||
|
- script: python -m pip install --upgrade pip && pip install tox
|
||||||
|
displayName: 'Install dependencies'
|
||||||
|
- script: python -m tox -e pywin-bigquery
|
||||||
|
env:
|
||||||
|
BIGQUERY_SERVICE_ACCOUNT_JSON: $(BIGQUERY_SERVICE_ACCOUNT_JSON)
|
||||||
|
displayName: Run integration tests
|
||||||
|
|
||||||
|
- job: RedshiftIntegrationTest
|
||||||
|
pool:
|
||||||
|
vmImage: 'vs2017-win2016'
|
||||||
|
dependsOn: PostgresIntegrationTest
|
||||||
|
condition: succeeded()
|
||||||
|
steps:
|
||||||
|
- task: UsePythonVersion@0
|
||||||
|
inputs:
|
||||||
|
versionSpec: '3.7'
|
||||||
|
architecture: 'x64'
|
||||||
|
|
||||||
|
- script: python -m pip install --upgrade pip && pip install tox
|
||||||
|
displayName: 'Install dependencies'
|
||||||
|
|
||||||
|
- script: python -m tox -e pywin-redshift
|
||||||
|
env:
|
||||||
|
REDSHIFT_TEST_DBNAME: $(REDSHIFT_TEST_DBNAME)
|
||||||
|
REDSHIFT_TEST_PASS: $(REDSHIFT_TEST_PASS)
|
||||||
|
REDSHIFT_TEST_USER: $(REDSHIFT_TEST_USER)
|
||||||
|
REDSHIFT_TEST_PORT: $(REDSHIFT_TEST_PORT)
|
||||||
|
REDSHIFT_TEST_HOST: $(REDSHIFT_TEST_HOST)
|
||||||
|
displayName: Run integration tests
|
||||||
|
|
||||||
|
- job: BuildWheel
|
||||||
|
pool:
|
||||||
|
vmImage: 'vs2017-win2016'
|
||||||
|
dependsOn:
|
||||||
|
- UnitTest
|
||||||
|
- PostgresIntegrationTest
|
||||||
|
- RedshiftIntegrationTest
|
||||||
|
- SnowflakeIntegrationTest
|
||||||
|
- BigQueryIntegrationTest
|
||||||
|
condition: succeeded()
|
||||||
|
steps:
|
||||||
|
- task: UsePythonVersion@0
|
||||||
|
inputs:
|
||||||
|
versionSpec: '3.7'
|
||||||
|
architecture: 'x64'
|
||||||
|
- script: python -m pip install --upgrade pip setuptools && python -m pip install -r requirements.txt && python -m pip install -r dev_requirements.txt
|
||||||
|
displayName: Install dependencies
|
||||||
|
- task: ShellScript@2
|
||||||
|
inputs:
|
||||||
|
scriptPath: scripts/build-wheels.sh
|
||||||
|
- task: CopyFiles@2
|
||||||
|
inputs:
|
||||||
|
contents: 'dist\?(*.whl|*.tar.gz)'
|
||||||
|
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
||||||
|
- task: PublishBuildArtifacts@1
|
||||||
|
inputs:
|
||||||
|
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
||||||
|
artifactName: dists
|
||||||
24
codecov.yml
24
codecov.yml
@@ -1,24 +0,0 @@
|
|||||||
ignore:
|
|
||||||
- ".github"
|
|
||||||
- ".changes"
|
|
||||||
|
|
||||||
# Disable all status checks to prevent red X's in CI
|
|
||||||
# Coverage data is still uploaded and PR comments are still posted
|
|
||||||
coverage:
|
|
||||||
status:
|
|
||||||
project: off
|
|
||||||
patch: off
|
|
||||||
|
|
||||||
comment:
|
|
||||||
layout: "header, diff, flags, components" # show component info in the PR comment
|
|
||||||
|
|
||||||
component_management:
|
|
||||||
individual_components:
|
|
||||||
- component_id: unittests
|
|
||||||
name: "Unit Tests"
|
|
||||||
flag_regexes:
|
|
||||||
- "unit"
|
|
||||||
- component_id: integrationtests
|
|
||||||
name: "Integration Tests"
|
|
||||||
flag_regexes:
|
|
||||||
- "integration"
|
|
||||||
73
converter.py
Executable file
73
converter.py
Executable file
@@ -0,0 +1,73 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import json
|
||||||
|
import yaml
|
||||||
|
import sys
|
||||||
|
import argparse
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
import dbt.clients.registry as registry
|
||||||
|
|
||||||
|
|
||||||
|
def yaml_type(fname):
|
||||||
|
with open(fname) as f:
|
||||||
|
return yaml.load(f)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_args():
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("--project", type=yaml_type, default="dbt_project.yml")
|
||||||
|
parser.add_argument("--namespace", required=True)
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def get_full_name(args):
|
||||||
|
return "{}/{}".format(args.namespace, args.project["name"])
|
||||||
|
|
||||||
|
|
||||||
|
def init_project_in_packages(args, packages):
|
||||||
|
full_name = get_full_name(args)
|
||||||
|
if full_name not in packages:
|
||||||
|
packages[full_name] = {
|
||||||
|
"name": args.project["name"],
|
||||||
|
"namespace": args.namespace,
|
||||||
|
"latest": args.project["version"],
|
||||||
|
"assets": {},
|
||||||
|
"versions": {},
|
||||||
|
}
|
||||||
|
return packages[full_name]
|
||||||
|
|
||||||
|
|
||||||
|
def add_version_to_package(args, project_json):
|
||||||
|
project_json["versions"][args.project["version"]] = {
|
||||||
|
"id": "{}/{}".format(get_full_name(args), args.project["version"]),
|
||||||
|
"name": args.project["name"],
|
||||||
|
"version": args.project["version"],
|
||||||
|
"description": "",
|
||||||
|
"published_at": datetime.now(timezone.utc).astimezone().isoformat(),
|
||||||
|
"packages": args.project.get("packages") or [],
|
||||||
|
"works_with": [],
|
||||||
|
"_source": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "",
|
||||||
|
"readme": "",
|
||||||
|
},
|
||||||
|
"downloads": {
|
||||||
|
"tarball": "",
|
||||||
|
"format": "tgz",
|
||||||
|
"sha1": "",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
args = parse_args()
|
||||||
|
packages = registry.packages()
|
||||||
|
project_json = init_project_in_packages(args, packages)
|
||||||
|
if args.project["version"] in project_json["versions"]:
|
||||||
|
raise Exception("Version {} already in packages JSON"
|
||||||
|
.format(args.project["version"]),
|
||||||
|
file=sys.stderr)
|
||||||
|
add_version_to_package(args, project_json)
|
||||||
|
print(json.dumps(packages, indent=2))
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
1
core/MANIFEST.in
Normal file
1
core/MANIFEST.in
Normal file
@@ -0,0 +1 @@
|
|||||||
|
recursive-include dbt/include *.py *.sql *.yml *.html *.md
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
<p align="center">
|
|
||||||
<img src="https://raw.githubusercontent.com/dbt-labs/dbt-core/fa1ea14ddfb1d5ae319d5141844910dd53ab2834/docs/images/dbt-core.svg" alt="dbt logo" width="750"/>
|
|
||||||
</p>
|
|
||||||
<p align="center">
|
|
||||||
<a href="https://github.com/dbt-labs/dbt-core/actions/workflows/main.yml">
|
|
||||||
<img src="https://github.com/dbt-labs/dbt-core/actions/workflows/main.yml/badge.svg?event=push" alt="CI Badge"/>
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
**[dbt](https://www.getdbt.com/)** enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Understanding dbt
|
|
||||||
|
|
||||||
Analysts using dbt can transform their data by simply writing select statements, while dbt handles turning these statements into tables and views in a data warehouse.
|
|
||||||
|
|
||||||
These select statements, or "models", form a dbt project. Models frequently build on top of one another – dbt makes it easy to [manage relationships](https://docs.getdbt.com/docs/ref) between models, and [visualize these relationships](https://docs.getdbt.com/docs/documentation), as well as assure the quality of your transformations through [testing](https://docs.getdbt.com/docs/testing).
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Getting started
|
|
||||||
|
|
||||||
- [Install dbt](https://docs.getdbt.com/docs/installation)
|
|
||||||
- Read the [introduction](https://docs.getdbt.com/docs/introduction/) and [viewpoint](https://docs.getdbt.com/docs/about/viewpoint/)
|
|
||||||
|
|
||||||
## Join the dbt Community
|
|
||||||
|
|
||||||
- Be part of the conversation in the [dbt Community Slack](http://community.getdbt.com/)
|
|
||||||
- Read more on the [dbt Community Discourse](https://discourse.getdbt.com)
|
|
||||||
|
|
||||||
## Reporting bugs and contributing code
|
|
||||||
|
|
||||||
- Want to report a bug or request a feature? Let us know on [Slack](http://community.getdbt.com/), or open [an issue](https://github.com/dbt-labs/dbt-core/issues/new)
|
|
||||||
- Want to help us build dbt? Check out the [Contributing Guide](https://github.com/dbt-labs/dbt-core/blob/HEAD/CONTRIBUTING.md)
|
|
||||||
|
|
||||||
## Code of Conduct
|
|
||||||
|
|
||||||
Everyone interacting in the dbt project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [dbt Code of Conduct](https://community.getdbt.com/code-of-conduct).
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
# core/dbt directory README
|
|
||||||
|
|
||||||
## The following are individual files in this directory.
|
|
||||||
|
|
||||||
### compilation.py
|
|
||||||
|
|
||||||
### constants.py
|
|
||||||
|
|
||||||
### dataclass_schema.py
|
|
||||||
|
|
||||||
### deprecations.py
|
|
||||||
|
|
||||||
### exceptions.py
|
|
||||||
|
|
||||||
### flags.py
|
|
||||||
|
|
||||||
### helper_types.py
|
|
||||||
|
|
||||||
### hooks.py
|
|
||||||
|
|
||||||
### lib.py
|
|
||||||
|
|
||||||
### links.py
|
|
||||||
|
|
||||||
### main.py
|
|
||||||
|
|
||||||
### node_types.py
|
|
||||||
|
|
||||||
### profiler.py
|
|
||||||
|
|
||||||
### selected_resources.py
|
|
||||||
|
|
||||||
### semver.py
|
|
||||||
|
|
||||||
### tracking.py
|
|
||||||
|
|
||||||
### ui.py
|
|
||||||
|
|
||||||
### utils.py
|
|
||||||
|
|
||||||
### version.py
|
|
||||||
|
|
||||||
|
|
||||||
## The subdirectories will be documented in a README in the subdirectory
|
|
||||||
* adapters
|
|
||||||
* cli
|
|
||||||
* clients
|
|
||||||
* config
|
|
||||||
* context
|
|
||||||
* contracts
|
|
||||||
* deps
|
|
||||||
* docs
|
|
||||||
* events
|
|
||||||
* graph
|
|
||||||
* include
|
|
||||||
* parser
|
|
||||||
* task
|
|
||||||
* tests
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# N.B.
|
|
||||||
# This will add to the package’s __path__ all subdirectories of directories on sys.path named after the package which effectively combines both modules into a single namespace (dbt.adapters)
|
|
||||||
# The matching statement is in plugins/postgres/dbt/__init__.py
|
|
||||||
|
|
||||||
from pkgutil import extend_path
|
|
||||||
|
|
||||||
__path__ = extend_path(__path__, __name__)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
version = "1.12.0a1"
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
# type: ignore
|
|
||||||
|
|
||||||
"""Shim to allow support for both Pydantic 1 and Pydantic 2.
|
|
||||||
|
|
||||||
dbt-core must support both major versions of Pydantic because dbt-core users might be using an environment with
|
|
||||||
either version, and we can't restrict them to one or the other. Here, we essentially import all Pydantic objects
|
|
||||||
from version 1 that we use. Throughout the repo, we import these objects from this file instead of from Pydantic
|
|
||||||
directly, meaning that we essentially only use Pydantic 1 in dbt-core currently, but without forcing that restriction
|
|
||||||
on dbt users. The development environment for this repo should be pinned to Pydantic 1 to ensure devs get appropriate
|
|
||||||
type hints.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from importlib.metadata import version
|
|
||||||
|
|
||||||
pydantic_version = version("pydantic")
|
|
||||||
# Pydantic uses semantic versioning, i.e. <major>.<minor>.<patch>, and we need to know the major
|
|
||||||
pydantic_major = pydantic_version.split(".")[0]
|
|
||||||
|
|
||||||
if pydantic_major == "1":
|
|
||||||
from pydantic import BaseSettings # noqa: F401
|
|
||||||
elif pydantic_major == "2":
|
|
||||||
from pydantic.v1 import BaseSettings # noqa: F401
|
|
||||||
else:
|
|
||||||
raise RuntimeError(
|
|
||||||
f"Currently only pydantic 1 and 2 are supported, found pydantic {pydantic_version}"
|
|
||||||
)
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user