Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add svn source credential support #4692

Merged
merged 13 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ def parse(data, config, path=None):
"svn_url": str,
"svn_rev": None,
"svn_ignore_externals": None,
"svn_username": None,
"svn_password": None,
"folder": None,
"no_hoist": None,
"patches": list,
Expand Down
16 changes: 13 additions & 3 deletions conda_build/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,20 @@ def parse_bool(s):
os.makedirs(svn_cache)
svn_dn = svn_url.split(":", 1)[-1].replace("/", "_").replace(":", "_")
cache_repo = join(svn_cache, svn_dn)
extra_args = []
if svn_ignore_externals:
extra_args = ["--ignore-externals"]
else:
extra_args = []
extra_args.append("--ignore-externals")
if "svn_username" in source_dict and "svn_password" in source_dict:
extra_args.extend(
[
"--non-interactive",
"--no-auth-cache",
"--username",
source_dict.get("svn_username"),
"--password",
source_dict.get("svn_password"),
]
)
if isdir(cache_repo):
check_call_env(
["svn", "up", "-r", svn_revision] + extra_args,
Expand Down
15 changes: 14 additions & 1 deletion docs/source/resources/define-metadata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,22 @@ Source from svn

source:
svn_url: https://github.com/ilanschnell/bsdiff
svn_rev: 1.1.4
svn_rev: 1.1.4 # (defaults to head)
svn_ignore_externals: True # (defaults to False)
svn_username: username # Optional, if set must also have svn_password
svn_password: password # Optional, if set must also have svn_username

To access a restricted SVN repository, specify both ``svn_username`` and ``svn_password``.

.. caution::
Storing credentials in plaintext carries risks. Alternatively, consider
using environment variables:

.. code-block:: yaml

source:
svn_username: {{ environ["SVN_USERNAME"] }}
svn_password: {{ environ["SVN_PASSWORD"] }}

Source from a local path
-------------------------
Expand Down
19 changes: 19 additions & 0 deletions news/4692-add-svn-source-credential-support
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* Add support for svn source credential (`svn_username` and `svn_password`). (#4692)

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>