itw-python-builder 0.1.22__tar.gz → 0.1.23__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.
Files changed (16) hide show
  1. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/PKG-INFO +1 -1
  2. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/itw_python_builder/tasks.py +32 -0
  3. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/itw_python_builder.egg-info/PKG-INFO +1 -1
  4. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/pyproject.toml +1 -1
  5. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/LICENSE +0 -0
  6. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/README.md +0 -0
  7. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/itw_python_builder/.pylintrc +0 -0
  8. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/itw_python_builder/__init__.py +0 -0
  9. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/itw_python_builder/cli.py +0 -0
  10. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/itw_python_builder/version.py +0 -0
  11. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/itw_python_builder.egg-info/SOURCES.txt +0 -0
  12. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/itw_python_builder.egg-info/dependency_links.txt +0 -0
  13. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/itw_python_builder.egg-info/entry_points.txt +0 -0
  14. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/itw_python_builder.egg-info/requires.txt +0 -0
  15. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/itw_python_builder.egg-info/top_level.txt +0 -0
  16. {itw_python_builder-0.1.22 → itw_python_builder-0.1.23}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: itw_python_builder
3
- Version: 0.1.22
3
+ Version: 0.1.23
4
4
  Summary: Standardized Django deployment pipeline with Docker, testing, and SonarQube integration
5
5
  Author-email: IT-Works <contact@it-works.io>
6
6
  License: MIT
@@ -1,5 +1,7 @@
1
1
  from invoke import task, Context
2
2
  from itw_python_builder.version import Version
3
+ import getpass
4
+ import io
3
5
  import os
4
6
  from datetime import datetime
5
7
  from pathlib import Path
@@ -92,6 +94,34 @@ def generate_image_path(ctx: Context, branch: str) -> str:
92
94
  return container_registry_path
93
95
 
94
96
 
97
+ def get_gitlab_username(ctx: Context) -> str:
98
+ """Resolve the GitLab username from git config user.email (local part before '@')."""
99
+ result = ctx.run('git config user.email', hide=True, warn=True)
100
+ email = result.stdout.strip() if result.ok else ''
101
+ if not email or '@' not in email:
102
+ raise RuntimeError(
103
+ 'Could not determine GitLab username from git config user.email. '
104
+ 'Set it with: git config --global user.email "you@email.com" '
105
+ 'or pass --username=... explicitly.'
106
+ )
107
+ return email.split('@')[0]
108
+
109
+
110
+ @task
111
+ def login(ctx: Context, username=None):
112
+ """Log in to the GitLab container registry."""
113
+ if not username:
114
+ username = get_gitlab_username(ctx)
115
+ print(f'Logging in to gitreg.it-works.io:443 as {username}')
116
+ token = getpass.getpass(f'Enter GitLab token (password) for {username}: ')
117
+ if not token:
118
+ raise RuntimeError('No token entered; aborting login.')
119
+ ctx.run(
120
+ f'podman login -u {username} --password-stdin gitreg.it-works.io:443 --tls-verify=false',
121
+ in_stream=io.StringIO(token)
122
+ )
123
+
124
+
95
125
  def commit_version(ctx: Context, version: Version) -> None:
96
126
  ctx.run(f'git add {Version.VERSION_FILE_NAME}')
97
127
  ctx.run('git add CHANGELOG.md')
@@ -146,6 +176,7 @@ def taginit(ctx: Context) -> None:
146
176
  def incrementrc(ctx: Context, skip_pipeline=False, pylintrc=None) -> None:
147
177
  """Increment release candidate version and deploy"""
148
178
  check_branch(ctx)
179
+ login(ctx)
149
180
  version = Version.read_from_file()
150
181
  version.increment_release_candidate()
151
182
  lint(ctx, pylintrc=pylintrc)
@@ -195,6 +226,7 @@ def incrementmajor(ctx: Context, skip_pipeline=False) -> None:
195
226
  def release(ctx: Context, skip_pipeline=False) -> None:
196
227
  """Promote release candidate to stable release and deploy"""
197
228
  _ = check_branch(ctx)
229
+ login(ctx)
198
230
  version = Version.read_from_file()
199
231
  version.reset_release_candidate(release=True)
200
232
  tag_build_push(ctx, version, skip_pipeline)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: itw_python_builder
3
- Version: 0.1.22
3
+ Version: 0.1.23
4
4
  Summary: Standardized Django deployment pipeline with Docker, testing, and SonarQube integration
5
5
  Author-email: IT-Works <contact@it-works.io>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "itw_python_builder"
7
- version = "0.1.22"
7
+ version = "0.1.23"
8
8
  description = "Standardized Django deployment pipeline with Docker, testing, and SonarQube integration"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"