apache-airflow-providers-git 0.0.1__tar.gz → 0.0.2rc1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/PKG-INFO +7 -7
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/README.rst +3 -3
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/docs/changelog.rst +17 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/docs/commits.rst +15 -1
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/docs/index.rst +1 -1
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/provider.yaml +2 -1
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/pyproject.toml +4 -4
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/src/airflow/providers/git/__init__.py +1 -1
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/src/airflow/providers/git/bundles/git.py +22 -15
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/tests/unit/git/bundles/test_git.py +131 -14
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/docs/bundles/index.rst +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/docs/conf.py +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/docs/connections/git.rst +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/docs/installing-providers-from-sources.rst +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/docs/security.rst +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/src/airflow/__init__.py +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/src/airflow/providers/__init__.py +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/src/airflow/providers/git/LICENSE +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/src/airflow/providers/git/bundles/__init__.py +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/src/airflow/providers/git/get_provider_info.py +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/src/airflow/providers/git/hooks/__init__.py +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/src/airflow/providers/git/hooks/git.py +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/tests/conftest.py +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/tests/unit/__init__.py +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/tests/unit/git/__init__.py +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/tests/unit/git/bundles/__init__.py +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/tests/unit/git/hooks/__init__.py +0 -0
- {apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/tests/unit/git/hooks/test_git.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apache-airflow-providers-git
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2rc1
|
|
4
4
|
Summary: Provider package apache-airflow-providers-git for Apache Airflow
|
|
5
5
|
Keywords: airflow-provider,git,airflow,integration
|
|
6
6
|
Author-email: Apache Software Foundation <dev@airflow.apache.org>
|
|
@@ -20,11 +20,11 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Topic :: System :: Monitoring
|
|
23
|
-
Requires-Dist: apache-airflow>=3.0.
|
|
23
|
+
Requires-Dist: apache-airflow>=3.0.0rc0
|
|
24
24
|
Requires-Dist: GitPython>=3.1.44
|
|
25
25
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
|
26
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.
|
|
27
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.
|
|
26
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.2/changelog.html
|
|
27
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.2
|
|
28
28
|
Project-URL: Mastodon, https://fosstodon.org/@airflow
|
|
29
29
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
|
30
30
|
Project-URL: Source Code, https://github.com/apache/airflow
|
|
@@ -55,7 +55,7 @@ Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
|
|
|
55
55
|
|
|
56
56
|
Package ``apache-airflow-providers-git``
|
|
57
57
|
|
|
58
|
-
Release: ``0.0.
|
|
58
|
+
Release: ``0.0.2``
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
`Distributed version control system (GIT) <https://git-scm.com/>`__
|
|
@@ -68,7 +68,7 @@ This is a provider package for ``git`` provider. All classes for this provider p
|
|
|
68
68
|
are in ``airflow.providers.git`` python package.
|
|
69
69
|
|
|
70
70
|
You can find package information and changelog for the provider
|
|
71
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.
|
|
71
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.2/>`_.
|
|
72
72
|
|
|
73
73
|
Installation
|
|
74
74
|
------------
|
|
@@ -90,5 +90,5 @@ PIP package Version required
|
|
|
90
90
|
================== ==================
|
|
91
91
|
|
|
92
92
|
The changelog for the provider package can be found in the
|
|
93
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.
|
|
93
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.2/changelog.html>`_.
|
|
94
94
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
Package ``apache-airflow-providers-git``
|
|
25
25
|
|
|
26
|
-
Release: ``0.0.
|
|
26
|
+
Release: ``0.0.2``
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
`Distributed version control system (GIT) <https://git-scm.com/>`__
|
|
@@ -36,7 +36,7 @@ This is a provider package for ``git`` provider. All classes for this provider p
|
|
|
36
36
|
are in ``airflow.providers.git`` python package.
|
|
37
37
|
|
|
38
38
|
You can find package information and changelog for the provider
|
|
39
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.
|
|
39
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.2/>`_.
|
|
40
40
|
|
|
41
41
|
Installation
|
|
42
42
|
------------
|
|
@@ -58,4 +58,4 @@ PIP package Version required
|
|
|
58
58
|
================== ==================
|
|
59
59
|
|
|
60
60
|
The changelog for the provider package can be found in the
|
|
61
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.
|
|
61
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.2/changelog.html>`_.
|
{apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/docs/changelog.rst
RENAMED
|
@@ -15,6 +15,23 @@
|
|
|
15
15
|
specific language governing permissions and limitations
|
|
16
16
|
under the License.
|
|
17
17
|
|
|
18
|
+
0.0.2
|
|
19
|
+
.....
|
|
20
|
+
|
|
21
|
+
Bug Fixes
|
|
22
|
+
~~~~~~~~~
|
|
23
|
+
|
|
24
|
+
* ``Don't log repo_url in git dag bundle (#48909)``
|
|
25
|
+
* ``Make git connection optional for git dag bundle (#49270)``
|
|
26
|
+
|
|
27
|
+
Misc
|
|
28
|
+
~~~~
|
|
29
|
+
|
|
30
|
+
* ``Include subdir in Gitbundle view url (#49239)``
|
|
31
|
+
|
|
32
|
+
.. Below changes are excluded from the changelog. Move them to
|
|
33
|
+
appropriate section above if needed. Do not delete the lines(!):
|
|
34
|
+
|
|
18
35
|
0.0.1
|
|
19
36
|
.....
|
|
20
37
|
|
{apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/docs/commits.rst
RENAMED
|
@@ -34,14 +34,28 @@ For high-level changelog, see :doc:`package information including changelog <ind
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
0.0.2
|
|
38
|
+
.....
|
|
39
|
+
|
|
40
|
+
Latest change: 2025-04-16
|
|
41
|
+
|
|
42
|
+
================================================================================================== =========== ============================================================
|
|
43
|
+
Commit Committed Subject
|
|
44
|
+
================================================================================================== =========== ============================================================
|
|
45
|
+
`192b337c86 <https://github.com/apache/airflow/commit/192b337c86eede5636f802d6f354fa97fe0f9030>`__ 2025-04-16 ``Don't log repo_url in git dag bundle (#48909)``
|
|
46
|
+
`2c7b56ee74 <https://github.com/apache/airflow/commit/2c7b56ee742409f65463534e34fa5f444d651af9>`__ 2025-04-15 ``Make git connection optional for git dag bundle (#49270)``
|
|
47
|
+
`b9052eed42 <https://github.com/apache/airflow/commit/b9052eed423f5f7f20c58815cce89e6cc659903c>`__ 2025-04-15 ``Include subdir in Gitbundle view url (#49239)``
|
|
48
|
+
================================================================================================== =========== ============================================================
|
|
49
|
+
|
|
37
50
|
0.0.1
|
|
38
51
|
.....
|
|
39
52
|
|
|
40
|
-
Latest change: 2025-04-
|
|
53
|
+
Latest change: 2025-04-10
|
|
41
54
|
|
|
42
55
|
================================================================================================== =========== ==================================================================================
|
|
43
56
|
Commit Committed Subject
|
|
44
57
|
================================================================================================== =========== ==================================================================================
|
|
58
|
+
`4a8567b20b <https://github.com/apache/airflow/commit/4a8567b20bdd6555cbdc936d6674bf4fa390b0d5>`__ 2025-04-10 ``Prepare docs for Apr 2nd wave of providers (#49051)``
|
|
45
59
|
`4a1e2ff8ab <https://github.com/apache/airflow/commit/4a1e2ff8ab8e6abca1cb273dc55d651d971e49f2>`__ 2025-04-09 ``Mark git provider as ready (#48860)``
|
|
46
60
|
`c68f31d3db <https://github.com/apache/airflow/commit/c68f31d3db6b957b4aeede7a257cc0ba59f12ce1>`__ 2025-04-08 ``Remove dev0 suffix from Airlfow version (#48934)``
|
|
47
61
|
`7b2ec33c7a <https://github.com/apache/airflow/commit/7b2ec33c7ad4998d9c9735b79593fcdcd3b9dd1f>`__ 2025-04-08 ``Remove unnecessary entries in get_provider_info and update the schema (#48849)``
|
|
@@ -22,9 +22,10 @@ description: |
|
|
|
22
22
|
`Distributed version control system (GIT) <https://git-scm.com/>`__
|
|
23
23
|
|
|
24
24
|
state: ready
|
|
25
|
-
source-date-epoch:
|
|
25
|
+
source-date-epoch: 1744792049
|
|
26
26
|
# note that those versions are maintained by release manager - do not update them manually
|
|
27
27
|
versions:
|
|
28
|
+
- 0.0.2
|
|
28
29
|
- 0.0.1
|
|
29
30
|
|
|
30
31
|
integrations:
|
|
@@ -25,7 +25,7 @@ build-backend = "flit_core.buildapi"
|
|
|
25
25
|
|
|
26
26
|
[project]
|
|
27
27
|
name = "apache-airflow-providers-git"
|
|
28
|
-
version = "0.0.
|
|
28
|
+
version = "0.0.2.rc1"
|
|
29
29
|
description = "Provider package apache-airflow-providers-git for Apache Airflow"
|
|
30
30
|
readme = "README.rst"
|
|
31
31
|
authors = [
|
|
@@ -57,7 +57,7 @@ requires-python = "~=3.9"
|
|
|
57
57
|
# Make sure to run ``breeze static-checks --type update-providers-dependencies --all-files``
|
|
58
58
|
# After you modify the dependencies, and rebuild your Breeze CI image with ``breeze ci-image build``
|
|
59
59
|
dependencies = [
|
|
60
|
-
"apache-airflow>=3.0.
|
|
60
|
+
"apache-airflow>=3.0.0rc0",
|
|
61
61
|
"GitPython>=3.1.44",
|
|
62
62
|
]
|
|
63
63
|
|
|
@@ -95,8 +95,8 @@ apache-airflow-providers-common-sql = {workspace = true}
|
|
|
95
95
|
apache-airflow-providers-standard = {workspace = true}
|
|
96
96
|
|
|
97
97
|
[project.urls]
|
|
98
|
-
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.
|
|
99
|
-
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.
|
|
98
|
+
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.2"
|
|
99
|
+
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.2/changelog.html"
|
|
100
100
|
"Bug Tracker" = "https://github.com/apache/airflow/issues"
|
|
101
101
|
"Source Code" = "https://github.com/apache/airflow"
|
|
102
102
|
"Slack Chat" = "https://s.apache.org/airflow-slack"
|
|
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
|
|
|
29
29
|
|
|
30
30
|
__all__ = ["__version__"]
|
|
31
31
|
|
|
32
|
-
__version__ = "0.0.
|
|
32
|
+
__version__ = "0.0.2"
|
|
33
33
|
|
|
34
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
|
35
35
|
"3.0.0"
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
from __future__ import annotations
|
|
18
18
|
|
|
19
19
|
import os
|
|
20
|
+
from contextlib import nullcontext
|
|
20
21
|
from pathlib import Path
|
|
21
22
|
from urllib.parse import urlparse
|
|
22
23
|
|
|
@@ -53,7 +54,7 @@ class GitDagBundle(BaseDagBundle):
|
|
|
53
54
|
*,
|
|
54
55
|
tracking_ref: str,
|
|
55
56
|
subdir: str | None = None,
|
|
56
|
-
git_conn_id: str =
|
|
57
|
+
git_conn_id: str | None = None,
|
|
57
58
|
repo_url: str | None = None,
|
|
58
59
|
**kwargs,
|
|
59
60
|
) -> None:
|
|
@@ -75,20 +76,23 @@ class GitDagBundle(BaseDagBundle):
|
|
|
75
76
|
repo_path=self.repo_path,
|
|
76
77
|
versions_path=self.versions_dir,
|
|
77
78
|
git_conn_id=self.git_conn_id,
|
|
78
|
-
repo_url=self.repo_url,
|
|
79
79
|
)
|
|
80
80
|
|
|
81
81
|
self._log.debug("bundle configured")
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
self.hook: GitHook | None = None
|
|
83
|
+
if self.git_conn_id:
|
|
84
|
+
try:
|
|
85
|
+
self.hook = GitHook(git_conn_id=self.git_conn_id, repo_url=self.repo_url)
|
|
86
|
+
except AirflowException as e:
|
|
87
|
+
self._log.warning("Could not create GitHook", conn_id=self.git_conn_id, exc=e)
|
|
88
|
+
else:
|
|
89
|
+
self.repo_url = self.hook.repo_url
|
|
90
|
+
self._log.debug("repo_url updated from hook")
|
|
88
91
|
|
|
89
92
|
def _initialize(self):
|
|
90
93
|
with self.lock():
|
|
91
|
-
|
|
94
|
+
cm = self.hook.configure_hook_env() if self.hook else nullcontext()
|
|
95
|
+
with cm:
|
|
92
96
|
self._clone_bare_repo_if_required()
|
|
93
97
|
self._ensure_version_in_bare_repo()
|
|
94
98
|
|
|
@@ -134,7 +138,7 @@ class GitDagBundle(BaseDagBundle):
|
|
|
134
138
|
url=self.repo_url,
|
|
135
139
|
to_path=self.bare_repo_path,
|
|
136
140
|
bare=True,
|
|
137
|
-
env=self.hook.env,
|
|
141
|
+
env=self.hook.env if self.hook else None,
|
|
138
142
|
)
|
|
139
143
|
except GitCommandError as e:
|
|
140
144
|
raise AirflowException("Error cloning repository") from e
|
|
@@ -177,10 +181,10 @@ class GitDagBundle(BaseDagBundle):
|
|
|
177
181
|
|
|
178
182
|
def _fetch_bare_repo(self):
|
|
179
183
|
refspecs = ["+refs/heads/*:refs/heads/*", "+refs/tags/*:refs/tags/*"]
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
+
cm = nullcontext()
|
|
185
|
+
if self.hook and (cmd := self.hook.env.get("GIT_SSH_COMMAND")):
|
|
186
|
+
cm = self.bare_repo.git.custom_environment(GIT_SSH_COMMAND=cmd)
|
|
187
|
+
with cm:
|
|
184
188
|
self.bare_repo.remotes.origin.fetch(refspecs)
|
|
185
189
|
|
|
186
190
|
def refresh(self) -> None:
|
|
@@ -188,7 +192,8 @@ class GitDagBundle(BaseDagBundle):
|
|
|
188
192
|
raise AirflowException("Refreshing a specific version is not supported")
|
|
189
193
|
|
|
190
194
|
with self.lock():
|
|
191
|
-
|
|
195
|
+
cm = self.hook.configure_hook_env() if self.hook else nullcontext()
|
|
196
|
+
with cm:
|
|
192
197
|
self._fetch_bare_repo()
|
|
193
198
|
self.repo.remotes.origin.fetch(
|
|
194
199
|
["+refs/heads/*:refs/remotes/origin/*", "+refs/tags/*:refs/tags/*"]
|
|
@@ -233,6 +238,8 @@ class GitDagBundle(BaseDagBundle):
|
|
|
233
238
|
"gitlab.com": f"{url}/-/tree/{version}",
|
|
234
239
|
"bitbucket.org": f"{url}/src/{version}",
|
|
235
240
|
}
|
|
241
|
+
if self.subdir:
|
|
242
|
+
host_patterns = {k: f"{v}/{self.subdir}" for k, v in host_patterns.items()}
|
|
236
243
|
for allowed_host, template in host_patterns.items():
|
|
237
244
|
if host == allowed_host or host.endswith(f".{allowed_host}"):
|
|
238
245
|
return template
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
|
+
import json
|
|
20
21
|
import os
|
|
21
22
|
import re
|
|
22
23
|
from unittest import mock
|
|
@@ -118,14 +119,14 @@ class TestGitDagBundle:
|
|
|
118
119
|
assert bundle.repo_url == f"https://{ACCESS_TOKEN}@github.com/apache/zzzairflow"
|
|
119
120
|
|
|
120
121
|
def test_falls_back_to_connection_host_when_no_repo_url_provided(self):
|
|
121
|
-
bundle = GitDagBundle(name="test", tracking_ref=GIT_DEFAULT_BRANCH)
|
|
122
|
+
bundle = GitDagBundle(name="test", git_conn_id=CONN_HTTPS, tracking_ref=GIT_DEFAULT_BRANCH)
|
|
122
123
|
assert bundle.repo_url == bundle.hook.repo_url
|
|
123
124
|
|
|
124
125
|
@mock.patch("airflow.providers.git.bundles.git.GitHook")
|
|
125
126
|
def test_get_current_version(self, mock_githook, git_repo):
|
|
126
127
|
repo_path, repo = git_repo
|
|
127
128
|
mock_githook.return_value.repo_url = repo_path
|
|
128
|
-
bundle = GitDagBundle(name="test", tracking_ref=GIT_DEFAULT_BRANCH)
|
|
129
|
+
bundle = GitDagBundle(name="test", git_conn_id=CONN_HTTPS, tracking_ref=GIT_DEFAULT_BRANCH)
|
|
129
130
|
|
|
130
131
|
bundle.initialize()
|
|
131
132
|
|
|
@@ -146,6 +147,7 @@ class TestGitDagBundle:
|
|
|
146
147
|
|
|
147
148
|
bundle = GitDagBundle(
|
|
148
149
|
name="test",
|
|
150
|
+
git_conn_id=CONN_HTTPS,
|
|
149
151
|
version=starting_commit.hexsha,
|
|
150
152
|
tracking_ref=GIT_DEFAULT_BRANCH,
|
|
151
153
|
)
|
|
@@ -174,6 +176,7 @@ class TestGitDagBundle:
|
|
|
174
176
|
|
|
175
177
|
bundle = GitDagBundle(
|
|
176
178
|
name="test",
|
|
179
|
+
git_conn_id=CONN_HTTPS,
|
|
177
180
|
version="test",
|
|
178
181
|
tracking_ref=GIT_DEFAULT_BRANCH,
|
|
179
182
|
)
|
|
@@ -195,7 +198,7 @@ class TestGitDagBundle:
|
|
|
195
198
|
repo.index.add([file_path])
|
|
196
199
|
repo.index.commit("Another commit")
|
|
197
200
|
|
|
198
|
-
bundle = GitDagBundle(name="test", tracking_ref=GIT_DEFAULT_BRANCH)
|
|
201
|
+
bundle = GitDagBundle(name="test", git_conn_id=CONN_HTTPS, tracking_ref=GIT_DEFAULT_BRANCH)
|
|
199
202
|
bundle.initialize()
|
|
200
203
|
|
|
201
204
|
assert bundle.get_current_version() != starting_commit.hexsha
|
|
@@ -221,7 +224,7 @@ class TestGitDagBundle:
|
|
|
221
224
|
writer.set_value("user", "name", "Test User")
|
|
222
225
|
writer.set_value("user", "email", "test@example.com")
|
|
223
226
|
|
|
224
|
-
bundle = GitDagBundle(name="test", tracking_ref=GIT_DEFAULT_BRANCH)
|
|
227
|
+
bundle = GitDagBundle(name="test", git_conn_id=CONN_HTTPS, tracking_ref=GIT_DEFAULT_BRANCH)
|
|
225
228
|
bundle.initialize()
|
|
226
229
|
|
|
227
230
|
assert bundle.get_current_version() == starting_commit.hexsha
|
|
@@ -252,7 +255,7 @@ class TestGitDagBundle:
|
|
|
252
255
|
# add tag
|
|
253
256
|
repo.create_tag("test123")
|
|
254
257
|
|
|
255
|
-
bundle = GitDagBundle(name="test", tracking_ref="test123")
|
|
258
|
+
bundle = GitDagBundle(name="test", git_conn_id=CONN_HTTPS, tracking_ref="test123")
|
|
256
259
|
bundle.initialize()
|
|
257
260
|
assert bundle.get_current_version() == starting_commit.hexsha
|
|
258
261
|
|
|
@@ -279,7 +282,7 @@ class TestGitDagBundle:
|
|
|
279
282
|
mock_githook.return_value.repo_url = repo_path
|
|
280
283
|
|
|
281
284
|
repo.create_head("test")
|
|
282
|
-
bundle = GitDagBundle(name="test", tracking_ref="test")
|
|
285
|
+
bundle = GitDagBundle(name="test", git_conn_id=CONN_HTTPS, tracking_ref="test")
|
|
283
286
|
bundle.initialize()
|
|
284
287
|
assert bundle.repo.head.ref.name == "test"
|
|
285
288
|
|
|
@@ -289,6 +292,7 @@ class TestGitDagBundle:
|
|
|
289
292
|
mock_githook.return_value.repo_url = repo_path
|
|
290
293
|
bundle = GitDagBundle(
|
|
291
294
|
name="test",
|
|
295
|
+
git_conn_id=CONN_HTTPS,
|
|
292
296
|
version="not_found",
|
|
293
297
|
tracking_ref=GIT_DEFAULT_BRANCH,
|
|
294
298
|
)
|
|
@@ -313,6 +317,7 @@ class TestGitDagBundle:
|
|
|
313
317
|
|
|
314
318
|
bundle = GitDagBundle(
|
|
315
319
|
name="test",
|
|
320
|
+
git_conn_id=CONN_HTTPS,
|
|
316
321
|
tracking_ref=GIT_DEFAULT_BRANCH,
|
|
317
322
|
subdir=subdir,
|
|
318
323
|
)
|
|
@@ -406,6 +411,93 @@ class TestGitDagBundle:
|
|
|
406
411
|
)
|
|
407
412
|
@mock.patch("airflow.providers.git.bundles.git.Repo")
|
|
408
413
|
def test_view_url(self, mock_gitrepo, repo_url, extra_conn_kwargs, expected_url, session):
|
|
414
|
+
session.query(Connection).delete()
|
|
415
|
+
conn = Connection(
|
|
416
|
+
conn_id="my_git_connection",
|
|
417
|
+
host=repo_url,
|
|
418
|
+
conn_type="git",
|
|
419
|
+
**(extra_conn_kwargs or {}),
|
|
420
|
+
)
|
|
421
|
+
session.add(conn)
|
|
422
|
+
session.commit()
|
|
423
|
+
bundle = GitDagBundle(
|
|
424
|
+
name="test",
|
|
425
|
+
git_conn_id="my_git_connection",
|
|
426
|
+
tracking_ref="main",
|
|
427
|
+
)
|
|
428
|
+
bundle.initialize = mock.MagicMock()
|
|
429
|
+
view_url = bundle.view_url("0f0f0f")
|
|
430
|
+
assert view_url == expected_url
|
|
431
|
+
bundle.initialize.assert_not_called()
|
|
432
|
+
|
|
433
|
+
@pytest.mark.parametrize(
|
|
434
|
+
"repo_url, extra_conn_kwargs, expected_url",
|
|
435
|
+
[
|
|
436
|
+
(
|
|
437
|
+
"git@github.com:apache/airflow.git",
|
|
438
|
+
None,
|
|
439
|
+
"https://github.com/apache/airflow/tree/0f0f0f/subdir",
|
|
440
|
+
),
|
|
441
|
+
("git@github.com:apache/airflow", None, "https://github.com/apache/airflow/tree/0f0f0f/subdir"),
|
|
442
|
+
(
|
|
443
|
+
"https://github.com/apache/airflow",
|
|
444
|
+
None,
|
|
445
|
+
"https://github.com/apache/airflow/tree/0f0f0f/subdir",
|
|
446
|
+
),
|
|
447
|
+
(
|
|
448
|
+
"https://github.com/apache/airflow.git",
|
|
449
|
+
None,
|
|
450
|
+
"https://github.com/apache/airflow/tree/0f0f0f/subdir",
|
|
451
|
+
),
|
|
452
|
+
(
|
|
453
|
+
"git@gitlab.com:apache/airflow.git",
|
|
454
|
+
None,
|
|
455
|
+
"https://gitlab.com/apache/airflow/-/tree/0f0f0f/subdir",
|
|
456
|
+
),
|
|
457
|
+
(
|
|
458
|
+
"git@bitbucket.org:apache/airflow.git",
|
|
459
|
+
None,
|
|
460
|
+
"https://bitbucket.org/apache/airflow/src/0f0f0f/subdir",
|
|
461
|
+
),
|
|
462
|
+
(
|
|
463
|
+
"git@myorg.github.com:apache/airflow.git",
|
|
464
|
+
None,
|
|
465
|
+
"https://myorg.github.com/apache/airflow/tree/0f0f0f/subdir",
|
|
466
|
+
),
|
|
467
|
+
(
|
|
468
|
+
"https://myorg.github.com/apache/airflow.git",
|
|
469
|
+
None,
|
|
470
|
+
"https://myorg.github.com/apache/airflow/tree/0f0f0f/subdir",
|
|
471
|
+
),
|
|
472
|
+
(
|
|
473
|
+
"https://github.com/apache/airflow",
|
|
474
|
+
{"password": "abc123"},
|
|
475
|
+
"https://github.com/apache/airflow/tree/0f0f0f/subdir",
|
|
476
|
+
),
|
|
477
|
+
(
|
|
478
|
+
"https://github.com/apache/airflow",
|
|
479
|
+
{"login": "abc123"},
|
|
480
|
+
"https://github.com/apache/airflow/tree/0f0f0f/subdir",
|
|
481
|
+
),
|
|
482
|
+
(
|
|
483
|
+
"https://github.com/apache/airflow",
|
|
484
|
+
{"login": "abc123", "password": "def456"},
|
|
485
|
+
"https://github.com/apache/airflow/tree/0f0f0f/subdir",
|
|
486
|
+
),
|
|
487
|
+
(
|
|
488
|
+
"https://github.com:443/apache/airflow",
|
|
489
|
+
None,
|
|
490
|
+
"https://github.com:443/apache/airflow/tree/0f0f0f/subdir",
|
|
491
|
+
),
|
|
492
|
+
(
|
|
493
|
+
"https://github.com:443/apache/airflow",
|
|
494
|
+
{"password": "abc123"},
|
|
495
|
+
"https://github.com:443/apache/airflow/tree/0f0f0f/subdir",
|
|
496
|
+
),
|
|
497
|
+
],
|
|
498
|
+
)
|
|
499
|
+
@mock.patch("airflow.providers.git.bundles.git.Repo")
|
|
500
|
+
def test_view_url_subdir(self, mock_gitrepo, repo_url, extra_conn_kwargs, expected_url, session):
|
|
409
501
|
session.query(Connection).delete()
|
|
410
502
|
conn = Connection(
|
|
411
503
|
conn_id="git_default",
|
|
@@ -418,6 +510,8 @@ class TestGitDagBundle:
|
|
|
418
510
|
bundle = GitDagBundle(
|
|
419
511
|
name="test",
|
|
420
512
|
tracking_ref="main",
|
|
513
|
+
subdir="subdir",
|
|
514
|
+
git_conn_id="git_default",
|
|
421
515
|
)
|
|
422
516
|
bundle.initialize = mock.MagicMock()
|
|
423
517
|
view_url = bundle.view_url("0f0f0f")
|
|
@@ -440,7 +534,7 @@ class TestGitDagBundle:
|
|
|
440
534
|
|
|
441
535
|
with mock.patch("airflow.providers.git.bundles.git.Repo.clone_from") as mock_clone:
|
|
442
536
|
mock_clone.side_effect = GitCommandError("clone", "Simulated error")
|
|
443
|
-
bundle = GitDagBundle(name="test", tracking_ref="main")
|
|
537
|
+
bundle = GitDagBundle(name="test", git_conn_id=CONN_HTTPS, tracking_ref="main")
|
|
444
538
|
with pytest.raises(
|
|
445
539
|
AirflowException,
|
|
446
540
|
match=re.escape("Error cloning repository"),
|
|
@@ -461,8 +555,11 @@ class TestGitDagBundle:
|
|
|
461
555
|
assert "Repository path: %s not found" in str(exc_info.value)
|
|
462
556
|
|
|
463
557
|
@patch.dict(os.environ, {"AIRFLOW_CONN_MY_TEST_GIT": '{"host": "something"}'})
|
|
464
|
-
@pytest.mark.parametrize(
|
|
465
|
-
|
|
558
|
+
@pytest.mark.parametrize(
|
|
559
|
+
"conn_id, expected_hook_type",
|
|
560
|
+
[("my_test_git", GitHook), ("something-else", type(None))],
|
|
561
|
+
)
|
|
562
|
+
def test_repo_url_access_missing_connection_doesnt_error(self, conn_id, expected_hook_type):
|
|
466
563
|
bundle = GitDagBundle(
|
|
467
564
|
name="testa",
|
|
468
565
|
tracking_ref="main",
|
|
@@ -470,16 +567,36 @@ class TestGitDagBundle:
|
|
|
470
567
|
repo_url="some_repo_url",
|
|
471
568
|
)
|
|
472
569
|
assert bundle.repo_url == "some_repo_url"
|
|
473
|
-
|
|
474
|
-
assert isinstance(bundle.hook, GitHook)
|
|
475
|
-
else:
|
|
476
|
-
assert not hasattr(bundle, "hook")
|
|
570
|
+
assert isinstance(bundle.hook, expected_hook_type)
|
|
477
571
|
|
|
478
572
|
@mock.patch("airflow.providers.git.bundles.git.GitHook")
|
|
479
573
|
def test_lock_used(self, mock_githook, git_repo):
|
|
480
574
|
repo_path, repo = git_repo
|
|
481
575
|
mock_githook.return_value.repo_url = repo_path
|
|
482
|
-
bundle = GitDagBundle(name="test", tracking_ref=GIT_DEFAULT_BRANCH)
|
|
576
|
+
bundle = GitDagBundle(name="test", git_conn_id=CONN_HTTPS, tracking_ref=GIT_DEFAULT_BRANCH)
|
|
483
577
|
with mock.patch("airflow.providers.git.bundles.git.GitDagBundle.lock") as mock_lock:
|
|
484
578
|
bundle.initialize()
|
|
485
579
|
assert mock_lock.call_count == 2 # both initialize and refresh
|
|
580
|
+
|
|
581
|
+
@pytest.mark.parametrize(
|
|
582
|
+
"conn_json, repo_url, expected",
|
|
583
|
+
[
|
|
584
|
+
(
|
|
585
|
+
{"host": "git@github.com:apache/airflow.git"},
|
|
586
|
+
"git@github.com:apache/hello.git",
|
|
587
|
+
"git@github.com:apache/hello.git",
|
|
588
|
+
),
|
|
589
|
+
({"host": "git@github.com:apache/airflow.git"}, None, "git@github.com:apache/airflow.git"),
|
|
590
|
+
({}, "git@github.com:apache/hello.git", "git@github.com:apache/hello.git"),
|
|
591
|
+
],
|
|
592
|
+
)
|
|
593
|
+
def test_repo_url_precedence(self, conn_json, repo_url, expected):
|
|
594
|
+
conn_str = json.dumps(conn_json)
|
|
595
|
+
with patch.dict(os.environ, {"AIRFLOW_CONN_MY_TEST_GIT": conn_str}):
|
|
596
|
+
bundle = GitDagBundle(
|
|
597
|
+
name="test",
|
|
598
|
+
tracking_ref="main",
|
|
599
|
+
git_conn_id="my_test_git",
|
|
600
|
+
repo_url=repo_url,
|
|
601
|
+
)
|
|
602
|
+
assert bundle.repo_url == expected
|
{apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/docs/bundles/index.rst
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/docs/security.rst
RENAMED
|
File without changes
|
{apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/src/airflow/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/tests/conftest.py
RENAMED
|
File without changes
|
{apache_airflow_providers_git-0.0.1 → apache_airflow_providers_git-0.0.2rc1}/tests/unit/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|