itw-python-builder 0.1.40__tar.gz → 0.1.41__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.
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/PKG-INFO +1 -1
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder/tasks.py +6 -3
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder/utils.py +15 -3
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder.egg-info/PKG-INFO +1 -1
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/pyproject.toml +1 -1
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/LICENSE +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/README.md +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder/.pylintrc +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder/__init__.py +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder/cli.py +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder/notify.py +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder/ssr_tasks.py +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder/templates/new_version_email.html +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder/templates/server.sitemap.snippet.ts +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder/templates/sitemap.routes.ts +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder/version.py +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder.egg-info/SOURCES.txt +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder.egg-info/dependency_links.txt +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder.egg-info/entry_points.txt +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder.egg-info/requires.txt +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder.egg-info/top_level.txt +0 -0
- {itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/setup.cfg +0 -0
|
@@ -66,16 +66,19 @@ def ensure_gitlab_auth(ctx: Context) -> None:
|
|
|
66
66
|
|
|
67
67
|
cached = load_cached_token()
|
|
68
68
|
if cached:
|
|
69
|
-
|
|
69
|
+
project_type = detect_project_type()
|
|
70
|
+
api_host = _gitlab_api_host(ctx)
|
|
71
|
+
username = get_gitlab_username(ctx)
|
|
72
|
+
status = probe_gitlab_token(ctx, project_type, api_host, username, cached)
|
|
70
73
|
if status == 'ok':
|
|
71
74
|
os.environ['GITLAB_TOKEN'] = cached
|
|
72
|
-
os.environ.setdefault('GITLAB_USERNAME',
|
|
75
|
+
os.environ.setdefault('GITLAB_USERNAME', username)
|
|
73
76
|
print('[itw] Using cached GitLab token.')
|
|
74
77
|
return
|
|
75
78
|
if status == 'unreachable':
|
|
76
79
|
print('[itw] Could not reach GitLab to verify cached token; using it anyway.')
|
|
77
80
|
os.environ['GITLAB_TOKEN'] = cached
|
|
78
|
-
os.environ.setdefault('GITLAB_USERNAME',
|
|
81
|
+
os.environ.setdefault('GITLAB_USERNAME', username)
|
|
79
82
|
return
|
|
80
83
|
print('[itw] Cached GitLab token was rejected (401/403). Please log in again.')
|
|
81
84
|
|
|
@@ -314,12 +314,24 @@ def save_token_to_cache(token: str) -> bool:
|
|
|
314
314
|
return False
|
|
315
315
|
|
|
316
316
|
|
|
317
|
-
def probe_gitlab_token(api_host: str, token: str) -> str:
|
|
318
|
-
|
|
317
|
+
def probe_gitlab_token(ctx: Context, project_type: str, api_host: str, username: str, token: str) -> str:
|
|
318
|
+
if project_type == 'backend':
|
|
319
|
+
result = ctx.run(
|
|
320
|
+
f'podman login -u {username} --password-stdin gitreg.it-works.io:443 --tls-verify=false',
|
|
321
|
+
in_stream=io.StringIO(token),
|
|
322
|
+
hide=True,
|
|
323
|
+
warn=True,
|
|
324
|
+
)
|
|
325
|
+
if result.ok:
|
|
326
|
+
return 'ok'
|
|
327
|
+
err = (result.stderr or result.stdout or '').lower()
|
|
328
|
+
if 'unauthorized' in err or '401' in err or 'authentication' in err:
|
|
329
|
+
return 'unauthorized'
|
|
330
|
+
return 'unreachable'
|
|
331
|
+
|
|
319
332
|
import ssl
|
|
320
333
|
import urllib.error
|
|
321
334
|
import urllib.request
|
|
322
|
-
|
|
323
335
|
req = urllib.request.Request(
|
|
324
336
|
f'https://{api_host}/api/v4/user',
|
|
325
337
|
headers={'PRIVATE-TOKEN': token},
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "itw_python_builder"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.41"
|
|
8
8
|
description = "Standardized Django deployment pipeline with Docker, testing, and SonarQube integration"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder.egg-info/requires.txt
RENAMED
|
File without changes
|
{itw_python_builder-0.1.40 → itw_python_builder-0.1.41}/itw_python_builder.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|