Skip to content

Commit

Permalink
use AWX operator tag version in clone script
Browse files Browse the repository at this point in the history
  • Loading branch information
oraNod committed Oct 21, 2024
1 parent e7a2768 commit 994cf1d
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions clone-awx-operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@
import sys
import tempfile

DEFAULT_BRANCH = "devel"

def read_version_from_file(file_path):
try:
with open(file_path, "r") as file:
version = file.read().strip()
return version
except FileNotFoundError:
print(f"Error: '{file_path}' not found.")


awx_version = read_version_from_file(file_path="awx-operator-version.txt")

DEFAULT_BRANCH = awx_version
DEFAULT_AWX_OPERATOR_REPO = "https://github.com/ansible/awx-operator"


Expand Down Expand Up @@ -65,7 +77,13 @@ def main(args: Args) -> None:
]

with tempfile.TemporaryDirectory() as temp_dir:
cmd: list[str] = ["git", "clone", args.repo, "--depth=1"]
cmd: list[str] = [
"git",
"clone",
args.repo,
"--depth=1",
"-c advice.detachedHead=false",
]
if args.branch is not None:
cmd.append(f"--branch={args.branch}")
cmd.append(temp_dir)
Expand All @@ -86,7 +104,7 @@ def main(args: Args) -> None:

for keep_file in keep_files:
src = pathlib.Path(temp_dir, keep_file)
if keep_file == 'Makefile':
if keep_file == "Makefile":
dst = pathlib.Path.cwd() / "Makefile.awx-operator"
else:
dst = pathlib.Path.cwd() / keep_file
Expand Down

0 comments on commit 994cf1d

Please sign in to comment.