vm-tool 1.0.33__tar.gz → 1.0.37__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 (122) hide show
  1. {vm_tool-1.0.33 → vm_tool-1.0.37}/PKG-INFO +1 -1
  2. vm_tool-1.0.37/codePushToGithub.py +208 -0
  3. {vm_tool-1.0.33 → vm_tool-1.0.37}/pyproject.toml +3 -2
  4. vm_tool-1.0.37/runtime.txt +1 -0
  5. {vm_tool-1.0.33 → vm_tool-1.0.37}/setup.py +1 -1
  6. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/cli.py +1 -1
  7. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/runner.py +5 -1
  8. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/vm_setup/main.yml +1 -1
  9. vm_tool-1.0.37/vm_tool/vm_setup/push_code.yml +5 -0
  10. vm_tool-1.0.37/vm_tool/vm_setup/push_code_tasks.yml +38 -0
  11. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool.egg-info/PKG-INFO +1 -1
  12. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool.egg-info/SOURCES.txt +3 -1
  13. vm_tool-1.0.33/codePushToGithub.sh +0 -47
  14. vm_tool-1.0.33/vm_tool/vm_setup/push_code.yml +0 -42
  15. {vm_tool-1.0.33 → vm_tool-1.0.37}/.devcontainer/devcontainer.json +0 -0
  16. {vm_tool-1.0.33 → vm_tool-1.0.37}/.github/dependabot.yml +0 -0
  17. {vm_tool-1.0.33 → vm_tool-1.0.37}/.github/workflows/ci.yml +0 -0
  18. {vm_tool-1.0.33 → vm_tool-1.0.37}/.github/workflows/deploy.yml +0 -0
  19. {vm_tool-1.0.33 → vm_tool-1.0.37}/.github/workflows/publish.yml +0 -0
  20. {vm_tool-1.0.33 → vm_tool-1.0.37}/.gitignore +0 -0
  21. {vm_tool-1.0.33 → vm_tool-1.0.37}/.pre-commit-config.yaml +0 -0
  22. {vm_tool-1.0.33 → vm_tool-1.0.37}/CONTRIBUTING +0 -0
  23. {vm_tool-1.0.33 → vm_tool-1.0.37}/CONTRIBUTING.md +0 -0
  24. {vm_tool-1.0.33 → vm_tool-1.0.37}/LICENSE +0 -0
  25. {vm_tool-1.0.33 → vm_tool-1.0.37}/MANIFEST.in +0 -0
  26. {vm_tool-1.0.33 → vm_tool-1.0.37}/Makefile +0 -0
  27. {vm_tool-1.0.33 → vm_tool-1.0.37}/README.md +0 -0
  28. {vm_tool-1.0.33 → vm_tool-1.0.37}/docs/MODULE_GUIDE.md +0 -0
  29. {vm_tool-1.0.33 → vm_tool-1.0.37}/docs/deployment-approaches.md +0 -0
  30. {vm_tool-1.0.33 → vm_tool-1.0.37}/docs/ec2-github-actions-guide.md +0 -0
  31. {vm_tool-1.0.33 → vm_tool-1.0.37}/docs/features.md +0 -0
  32. {vm_tool-1.0.33 → vm_tool-1.0.37}/docs/generator.md +0 -0
  33. {vm_tool-1.0.33 → vm_tool-1.0.37}/docs/index.md +0 -0
  34. {vm_tool-1.0.33 → vm_tool-1.0.37}/docs/pipeline-generator.md +0 -0
  35. {vm_tool-1.0.33 → vm_tool-1.0.37}/docs/reference/runner.md +0 -0
  36. {vm_tool-1.0.33 → vm_tool-1.0.37}/docs/reference/ssh.md +0 -0
  37. {vm_tool-1.0.33 → vm_tool-1.0.37}/docs/ssh-key-setup.md +0 -0
  38. {vm_tool-1.0.33 → vm_tool-1.0.37}/docs/usage.md +0 -0
  39. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/README.md +0 -0
  40. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/__init__.py +0 -0
  41. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/cloud/README.md +0 -0
  42. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/cloud/__init__.py +0 -0
  43. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/cloud/ssh_identity_file.py +0 -0
  44. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/cloud/ssh_password.py +0 -0
  45. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/cloud/template_cloud_setup.py +0 -0
  46. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/deploy_full_setup.py +0 -0
  47. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/docker-compose.example.yml +0 -0
  48. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/ec2-setup.sh +0 -0
  49. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/github-actions-ec2.yml +0 -0
  50. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/github-actions-full-setup.yml +0 -0
  51. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/local/.keep +0 -0
  52. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/local/README.md +0 -0
  53. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/local/__init__.py +0 -0
  54. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/local/template_local_setup.py +0 -0
  55. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/production-deploy.sh +0 -0
  56. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/rollback.sh +0 -0
  57. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/setup.sh +0 -0
  58. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/ssh_key_management.py +0 -0
  59. {vm_tool-1.0.33 → vm_tool-1.0.37}/examples/version_check.sh +0 -0
  60. {vm_tool-1.0.33 → vm_tool-1.0.37}/mkdocs.yml +0 -0
  61. {vm_tool-1.0.33 → vm_tool-1.0.37}/molecule/default/converge.yml +0 -0
  62. {vm_tool-1.0.33 → vm_tool-1.0.37}/molecule/default/molecule.yml +0 -0
  63. {vm_tool-1.0.33 → vm_tool-1.0.37}/molecule/default/verify.yml +0 -0
  64. {vm_tool-1.0.33 → vm_tool-1.0.37}/requirements-docs.txt +0 -0
  65. {vm_tool-1.0.33 → vm_tool-1.0.37}/requirements.txt +0 -0
  66. {vm_tool-1.0.33 → vm_tool-1.0.37}/setup.cfg +0 -0
  67. {vm_tool-1.0.33 → vm_tool-1.0.37}/tests/conftest.py +0 -0
  68. {vm_tool-1.0.33 → vm_tool-1.0.37}/tests/integration/test_deployment.py +0 -0
  69. {vm_tool-1.0.33 → vm_tool-1.0.37}/tests/test_config.py +0 -0
  70. {vm_tool-1.0.33 → vm_tool-1.0.37}/tests/test_generator.py +0 -0
  71. {vm_tool-1.0.33 → vm_tool-1.0.37}/tests/test_health.py +0 -0
  72. {vm_tool-1.0.33 → vm_tool-1.0.37}/tests/test_history.py +0 -0
  73. {vm_tool-1.0.33 → vm_tool-1.0.37}/tests/test_logging.py +0 -0
  74. {vm_tool-1.0.33 → vm_tool-1.0.37}/tests/test_runner.py +0 -0
  75. {vm_tool-1.0.33 → vm_tool-1.0.37}/tests/test_ssh.py +0 -0
  76. {vm_tool-1.0.33 → vm_tool-1.0.37}/tests/test_state.py +0 -0
  77. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/__init__.py +0 -0
  78. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/alerting.py +0 -0
  79. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/audit.py +0 -0
  80. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/backup.py +0 -0
  81. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/benchmarking.py +0 -0
  82. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/cloud.py +0 -0
  83. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/completion.py +0 -0
  84. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/compliance.py +0 -0
  85. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/config.py +0 -0
  86. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/drift.py +0 -0
  87. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/generator.py +0 -0
  88. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/health.py +0 -0
  89. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/history.py +0 -0
  90. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/kubernetes.py +0 -0
  91. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/metrics.py +0 -0
  92. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/notifications.py +0 -0
  93. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/plugins.py +0 -0
  94. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/policy.py +0 -0
  95. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/rbac.py +0 -0
  96. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/recovery.py +0 -0
  97. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/reporting.py +0 -0
  98. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/secrets.py +0 -0
  99. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/ssh.py +0 -0
  100. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/state.py +0 -0
  101. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/strategies/__init__.py +0 -0
  102. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/strategies/ab_testing.py +0 -0
  103. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/strategies/blue_green.py +0 -0
  104. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/strategies/canary.py +0 -0
  105. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/validation.py +0 -0
  106. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/vm_setup/cleanup.yml +0 -0
  107. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/vm_setup/docker/create_docker_service.yml +0 -0
  108. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/vm_setup/docker/docker_setup.yml +0 -0
  109. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/vm_setup/docker/install_docker_and_compose.yml +0 -0
  110. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/vm_setup/docker/login_to_docker_hub.yml +0 -0
  111. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/vm_setup/github/git_configuration.yml +0 -0
  112. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/vm_setup/inventory.yml +0 -0
  113. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/vm_setup/k8s.yml +0 -0
  114. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/vm_setup/monitoring.yml +0 -0
  115. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/vm_setup/project_service.yml +0 -0
  116. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/vm_setup/setup.yml +0 -0
  117. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/vm_setup/setup_project_env.yml +0 -0
  118. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool/webhooks.py +0 -0
  119. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool.egg-info/dependency_links.txt +0 -0
  120. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool.egg-info/entry_points.txt +0 -0
  121. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool.egg-info/requires.txt +0 -0
  122. {vm_tool-1.0.33 → vm_tool-1.0.37}/vm_tool.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vm_tool
3
- Version: 1.0.33
3
+ Version: 1.0.37
4
4
  Summary: A Comprehensive Tool for Setting Up Virtual Machines.
5
5
  Home-page: https://github.com/thesunnysinha/vm_tool
6
6
  Author: Sunny Sinha
@@ -0,0 +1,208 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Script to automate git commits and pushes with version bumping for main branch.
4
+ Automatically manages virtual environment and dependencies.
5
+ """
6
+ import subprocess
7
+ import sys
8
+ import os
9
+ from pathlib import Path
10
+
11
+
12
+ def run_command(cmd, check=True, shell=True):
13
+ """Run a shell command and return the result."""
14
+ try:
15
+ result = subprocess.run(
16
+ cmd,
17
+ shell=shell,
18
+ check=check,
19
+ capture_output=True,
20
+ text=True
21
+ )
22
+ if result.stdout:
23
+ print(result.stdout)
24
+ return result
25
+ except subprocess.CalledProcessError as e:
26
+ print(f"Error running command: {cmd}")
27
+ if e.stderr:
28
+ print(f"Error: {e.stderr}")
29
+ sys.exit(1)
30
+
31
+
32
+ def get_venv_path():
33
+ """Get the virtual environment path."""
34
+ return Path(__file__).parent / "venv"
35
+
36
+
37
+ def get_python_executable():
38
+ """Get the Python executable path for the virtual environment."""
39
+ venv_path = get_venv_path()
40
+ if os.name == 'nt': # Windows
41
+ return venv_path / "Scripts" / "python.exe"
42
+ else: # Unix/Linux/Mac
43
+ return venv_path / "bin" / "python"
44
+
45
+
46
+ def get_pip_executable():
47
+ """Get the pip executable path for the virtual environment."""
48
+ venv_path = get_venv_path()
49
+ if os.name == 'nt': # Windows
50
+ return venv_path / "Scripts" / "pip.exe"
51
+ else: # Unix/Linux/Mac
52
+ return venv_path / "bin" / "pip"
53
+
54
+
55
+ def create_venv():
56
+ """Create a virtual environment if it doesn't exist."""
57
+ venv_path = get_venv_path()
58
+
59
+ if not venv_path.exists():
60
+ print("📦 Creating virtual environment...")
61
+ run_command(f'"{sys.executable}" -m venv venv')
62
+ print("✅ Virtual environment created!")
63
+ return True
64
+ return False
65
+
66
+
67
+ def install_dependencies():
68
+ """Install required dependencies in the virtual environment."""
69
+ python_exe = get_python_executable()
70
+
71
+ print("📦 Installing/updating dependencies...")
72
+ # Use python -m pip instead of direct pip executable (Windows compatibility)
73
+ run_command(f'"{python_exe}" -m pip install --upgrade pip')
74
+ run_command(f'"{python_exe}" -m pip install bump-my-version')
75
+
76
+ # Install project dependencies if requirements.txt exists
77
+ if Path("requirements.txt").exists():
78
+ run_command(f'"{python_exe}" -m pip install -r requirements.txt')
79
+
80
+ print("✅ Dependencies installed!")
81
+
82
+
83
+ def setup_environment():
84
+ """Setup virtual environment and dependencies."""
85
+ venv_created = create_venv()
86
+
87
+ # Always install/update dependencies if venv was just created
88
+ if venv_created:
89
+ install_dependencies()
90
+ else:
91
+ # Check if bump-my-version is available
92
+ python_exe = get_python_executable()
93
+ result = run_command(f'"{python_exe}" -m pip show bump-my-version', check=False)
94
+ if result.returncode != 0:
95
+ print("⚠️ bump-my-version not found, installing dependencies...")
96
+ install_dependencies()
97
+
98
+
99
+ def run_in_venv(cmd):
100
+ """Run a command using the virtual environment's Python."""
101
+ python_exe = get_python_executable()
102
+
103
+ # For bump-my-version, we need to use the venv's Scripts directory
104
+ venv_path = get_venv_path()
105
+ if os.name == 'nt':
106
+ bump_exe = venv_path / "Scripts" / "bump-my-version.exe"
107
+ else:
108
+ bump_exe = venv_path / "bin" / "bump-my-version"
109
+
110
+ # Replace bump-my-version command with full path
111
+ if cmd.startswith("bump-my-version"):
112
+ cmd = cmd.replace("bump-my-version", f'"{bump_exe}"')
113
+ # Add verbose flag to show what's happening
114
+ if "--verbose" not in cmd and "-v" not in cmd:
115
+ cmd = cmd.replace("bump patch", "bump patch --verbose")
116
+
117
+ return run_command(cmd)
118
+
119
+
120
+ def get_current_version():
121
+ """Read the current version from pyproject.toml."""
122
+ try:
123
+ with open("pyproject.toml", "r") as f:
124
+ for line in f:
125
+ if line.strip().startswith("version ="):
126
+ # Extract version from line like: version = "1.0.34"
127
+ version = line.split("=")[1].strip().strip('"').strip("'")
128
+ return version
129
+ except Exception as e:
130
+ print(f"Warning: Could not read current version: {e}")
131
+ return "unknown"
132
+
133
+
134
+ def main():
135
+ # Setup virtual environment
136
+ print("🔧 Setting up environment...")
137
+ setup_environment()
138
+ print()
139
+
140
+ # Ask for the branch name
141
+ branch_name = input("Enter the branch name: ").strip()
142
+
143
+ if branch_name == "main":
144
+ # Get current version before bump
145
+ current_version = get_current_version()
146
+
147
+ # Bump version for main branch
148
+ print("\n" + "="*60)
149
+ print(f"🔢 Bumping version from {current_version}...")
150
+ print("="*60)
151
+ run_in_venv("bump-my-version bump patch --allow-dirty")
152
+
153
+ # Get new version after bump
154
+ new_version = get_current_version()
155
+ print("\n" + "="*60)
156
+ print(f"✅ Version bumped: {current_version} → {new_version}")
157
+ print("="*60 + "\n")
158
+
159
+ # Add all changes
160
+ print("Adding changes...")
161
+ run_command("git add .")
162
+
163
+ # Ask for commit message
164
+ commit_message = input("Enter the commit message: ").strip()
165
+
166
+ # Commit with the entered message
167
+ print("Committing changes...")
168
+ run_command(f'git commit -m "{commit_message}"')
169
+
170
+ # Push changes directly to the "main" branch
171
+ print("Pushing to main...")
172
+ run_command("git push origin main")
173
+
174
+ # Pull latest changes
175
+ print("Pulling latest changes...")
176
+ run_command("git pull origin main")
177
+
178
+ print("✅ Successfully pushed to main with version bump!")
179
+
180
+ else:
181
+ # Create and switch to the new branch
182
+ print(f"Creating and switching to branch: {branch_name}")
183
+ run_command(f"git checkout -b {branch_name}")
184
+
185
+ # Add all changes
186
+ print("Adding changes...")
187
+ run_command("git add .")
188
+
189
+ # Ask for commit message
190
+ commit_message = input("Enter the commit message: ").strip()
191
+
192
+ # Commit with the entered message
193
+ print("Committing changes...")
194
+ run_command(f'git commit -m "{commit_message}"')
195
+
196
+ # Push changes to the specified branch
197
+ print(f"Pushing to {branch_name}...")
198
+ run_command(f"git push origin {branch_name}")
199
+
200
+ # Switch back to main
201
+ print("Switching back to main...")
202
+ run_command("git checkout main")
203
+
204
+ print(f"✅ Successfully pushed to {branch_name}!")
205
+
206
+
207
+ if __name__ == "__main__":
208
+ main()
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "vm_tool"
7
- version = "1.0.33"
7
+ version = "1.0.37"
8
8
  description = "A Comprehensive Tool for Setting Up Virtual Machines."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -66,6 +66,7 @@ upload_to_pypi = true
66
66
  upload_to_release = true
67
67
  build_command = "python setup.py sdist bdist_wheel"
68
68
 
69
+
69
70
  [tool.black]
70
71
  line-length = 88
71
72
  target-version = ['py39', 'py310', 'py311', 'py312']
@@ -75,7 +76,7 @@ include = '\.pyi?$'
75
76
  profile = "black"
76
77
  multi_line_output = 3
77
78
  [tool.bumpversion]
78
- current_version = "1.0.33"
79
+ current_version = "1.0.37"
79
80
  commit = true
80
81
  tag = true
81
82
 
@@ -0,0 +1 @@
1
+ python-3.9
@@ -12,7 +12,7 @@ else:
12
12
 
13
13
  setup(
14
14
  name="vm_tool",
15
- version="1.0.33", # This will be updated by bump2version
15
+ version="1.0.37", # This will be updated by bump2version
16
16
  packages=find_packages(),
17
17
  description="A Comprehensive Tool for Setting Up Virtual Machines.",
18
18
  long_description=long_description,
@@ -6,7 +6,7 @@ def main():
6
6
  parser = argparse.ArgumentParser(
7
7
  description="VM Tool: Setup, Provision, and Manage VMs"
8
8
  )
9
- parser.add_argument("--version", action="version", version="1.0.33")
9
+ parser.add_argument("--version", action="version", version="1.0.37")
10
10
  parser.add_argument(
11
11
  "--verbose", "-v", action="store_true", help="Enable verbose output"
12
12
  )
@@ -373,7 +373,11 @@ class SetupRunner:
373
373
  with open(generated_inventory_path, "w") as f:
374
374
  yaml.dump(inventory_content, f)
375
375
 
376
- target_inventory = "generated_inventory.yml"
376
+ target_inventory = generated_inventory_path
377
+
378
+ else:
379
+ # If not generating dynamic inventory, ensure the provided inventory path is absolute
380
+ target_inventory = os.path.abspath(inventory_file)
377
381
 
378
382
  logger.info(
379
383
  f"Starting Docker deployment using {compose_file} on {target_inventory}..."
@@ -11,7 +11,7 @@
11
11
  when: DEPLOY_MODE | default('pull') != 'push'
12
12
 
13
13
  - name: Push Code (Zero Touch)
14
- include_tasks: push_code.yml
14
+ include_tasks: push_code_tasks.yml
15
15
  when: DEPLOY_MODE | default('pull') == 'push'
16
16
 
17
17
  - name: Setup Project Environment File
@@ -0,0 +1,5 @@
1
+ - name: Push Code Playbook
2
+ hosts: all
3
+ gather_facts: false
4
+ tasks:
5
+ - include_tasks: push_code_tasks.yml
@@ -0,0 +1,38 @@
1
+ - name: Ensure project directory exists
2
+ file:
3
+ path: "{{ project_dest_dir }}"
4
+ state: directory
5
+ mode: '0755'
6
+
7
+ - name: Copy project files to target
8
+ copy:
9
+ src: "{{ playbook_dir }}/../../"
10
+ dest: "{{ project_dest_dir }}/"
11
+ # Note: In ansible-runner, playbook_dir is inside private_data_dir/project/vm_setup.
12
+ # We need to be careful about the source path.
13
+ # However, ansible_runner isolates execution.
14
+ # Better approach: Pass SOURCE_PATH as extravar.
15
+ when: false # Placeholder, we will use synchronize or better strategy.
16
+
17
+ # Re-thinking: simple 'copy' of just the compose file is safer for now if we don't know build context.
18
+ # But usually context is needed.
19
+ # Let's rely on 'synchronize' (rsync) if available, or just copy the compose file if user only provided that.
20
+
21
+ # For MVP of 'deploy-docker', let's copy the DOCKER_COMPOSE_FILE_PATH and .env if exists.
22
+ - name: Copy Docker Compose file
23
+ copy:
24
+ src: "{{ SOURCE_PATH }}/{{ DOCKER_COMPOSE_FILE_PATH }}"
25
+ dest: "{{ project_dest_dir }}/{{ DOCKER_COMPOSE_FILE_PATH }}"
26
+
27
+ - name: Copy Env file
28
+ copy:
29
+ src: "{{ SOURCE_PATH }}/{{ ENV_FILE_PATH | default('.env') }}"
30
+ dest: "{{ project_dest_dir }}/{{ ENV_FILE_PATH | default('.env') }}"
31
+ failed_when: false
32
+
33
+ - name: Deploy application
34
+ shell: "{{ DEPLOY_COMMAND | default('docker-compose up -d --remove-orphans') }}"
35
+ args:
36
+ chdir: "{{ project_dest_dir }}"
37
+ environment:
38
+ GITHUB_REPOSITORY_OWNER: "{{ GITHUB_REPOSITORY_OWNER | default('') }}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vm_tool
3
- Version: 1.0.33
3
+ Version: 1.0.37
4
4
  Summary: A Comprehensive Tool for Setting Up Virtual Machines.
5
5
  Home-page: https://github.com/thesunnysinha/vm_tool
6
6
  Author: Sunny Sinha
@@ -6,11 +6,12 @@ LICENSE
6
6
  MANIFEST.in
7
7
  Makefile
8
8
  README.md
9
- codePushToGithub.sh
9
+ codePushToGithub.py
10
10
  mkdocs.yml
11
11
  pyproject.toml
12
12
  requirements-docs.txt
13
13
  requirements.txt
14
+ runtime.txt
14
15
  setup.py
15
16
  .devcontainer/devcontainer.json
16
17
  .github/dependabot.yml
@@ -107,6 +108,7 @@ vm_tool/vm_setup/main.yml
107
108
  vm_tool/vm_setup/monitoring.yml
108
109
  vm_tool/vm_setup/project_service.yml
109
110
  vm_tool/vm_setup/push_code.yml
111
+ vm_tool/vm_setup/push_code_tasks.yml
110
112
  vm_tool/vm_setup/setup.yml
111
113
  vm_tool/vm_setup/setup_project_env.yml
112
114
  vm_tool/vm_setup/docker/create_docker_service.yml
@@ -1,47 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Navigate to the directory
4
- script_directory="$(dirname "$0")"
5
-
6
- # Navigate to the script's directory
7
- cd "$script_directory"
8
-
9
- # Ask for the branch name
10
- read -p "Enter the branch name: " branch_name
11
-
12
- # Check if the branch name is "main"
13
- if [ "$branch_name" = "main" ]; then
14
-
15
- bump-my-version bump patch --allow-dirty
16
-
17
- # Add all changes
18
- git add .
19
-
20
- # Ask for the commit message
21
- read -p "Enter the commit message: " commit_message
22
-
23
- # Commit with the entered message
24
- git commit -m "$commit_message"
25
-
26
- # Push changes directly to the "main" branch
27
- git push origin main
28
-
29
- git pull origin main
30
- else
31
- # Create and switch to the new branch
32
- git checkout -b "$branch_name"
33
-
34
- # Add all changes
35
- git add .
36
-
37
- # Ask for the commit message
38
- read -p "Enter the commit message: " commit_message
39
-
40
- # Commit with the entered message
41
- git commit -m "$commit_message"
42
-
43
- # Push changes to the specified branch
44
- git push origin "$branch_name"
45
-
46
- git checkout main
47
- fi
@@ -1,42 +0,0 @@
1
- - name: Push Code Playbook
2
- hosts: all
3
- gather_facts: false
4
- tasks:
5
- - name: Ensure project directory exists
6
- file:
7
- path: "{{ project_dest_dir }}"
8
- state: directory
9
- mode: '0755'
10
-
11
- - name: Copy project files to target
12
- copy:
13
- src: "{{ playbook_dir }}/../../"
14
- dest: "{{ project_dest_dir }}/"
15
- # Note: In ansible-runner, playbook_dir is inside private_data_dir/project/vm_setup.
16
- # We need to be careful about the source path.
17
- # However, ansible_runner isolates execution.
18
- # Better approach: Pass SOURCE_PATH as extravar.
19
- when: false # Placeholder, we will use synchronize or better strategy.
20
-
21
- # Re-thinking: simple 'copy' of just the compose file is safer for now if we don't know build context.
22
- # But usually context is needed.
23
- # Let's rely on 'synchronize' (rsync) if available, or just copy the compose file if user only provided that.
24
-
25
- # For MVP of 'deploy-docker', let's copy the DOCKER_COMPOSE_FILE_PATH and .env if exists.
26
- - name: Copy Docker Compose file
27
- copy:
28
- src: "{{ SOURCE_PATH }}/{{ DOCKER_COMPOSE_FILE_PATH }}"
29
- dest: "{{ project_dest_dir }}/{{ DOCKER_COMPOSE_FILE_PATH }}"
30
-
31
- - name: Copy Env file
32
- copy:
33
- src: "{{ SOURCE_PATH }}/{{ ENV_FILE_PATH | default('.env') }}"
34
- dest: "{{ project_dest_dir }}/{{ ENV_FILE_PATH | default('.env') }}"
35
- failed_when: false
36
-
37
- - name: Deploy application
38
- shell: "{{ DEPLOY_COMMAND | default('docker-compose up -d --remove-orphans') }}"
39
- args:
40
- chdir: "{{ project_dest_dir }}"
41
- environment:
42
- GITHUB_REPOSITORY_OWNER: "{{ GITHUB_REPOSITORY_OWNER | default('') }}"
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
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
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
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
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
File without changes