Skip to content

Commit

Permalink
Fix error in the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
benedictmulongo committed Dec 19, 2024
1 parent f76ec39 commit 21dacd5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .jenkins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ builders:
- docker
docker_name: sunet/argus-frontend
docker_tags:
- "v1.14.1_sunet-104e2c46"
- "v1.14.1_sunet-${GIT_COMMIT}"
docker_no_cache: true
docker_force_tag: true
docker_skip_tag_as_latest: true
docker_build_args: |
BRANCH_NAME="v1.14.1"
REPO_URL="https://github.com/Uninett/Argus-frontend.git"
BRANCH_NAME=v1.14.1
REPO_URL=https://github.com/Uninett/Argus-frontend.git
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ chmod +x bump-tag.py
```

This script simplifies the process by determining the appropriate tag to use and applying the changes to the `.jenkins.yaml` file and commiting the code.
The python code should be used only after a successful commit

## Notes

Expand Down
13 changes: 10 additions & 3 deletions bump-tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,15 @@ def get_template(filename=".jenkins.yaml.jinja"):
for index, tag in enumerate(tags):
print(f"{index+1}. {tag}")

tag_number = input("Choose the tag you want to build:")
tag_number = input("Choose the tag you want to build: ")
tag_number = int(tag_number)
assert (
tag_number >= 1 and tag_number <= len_tags + 1
), "The number should be one in the list above"
print(f"You have choosed: {tag_number}, {tags[tag_number-1]}")
git_commit = get_commit()[:8]
context['branch_name'] = tags[tag_number-1]
context['docker_tag_name'] = f"{tags[tag_number-1]}_sunet-{git_commit}"

context['docker_tag_name'] = f"{tags[tag_number-1]}_sunet-" + "${GIT_COMMIT}"

# Todo. change .jenkins.yaml with the new version
template = Template(get_template(filename="templates/.jenkins.yaml.jinja"))
Expand All @@ -92,6 +91,14 @@ def get_template(filename=".jenkins.yaml.jinja"):
file_to_remplace = ".jenkins.yaml"
with open(file_to_remplace, "w") as output_file:
output_file.write(rendered_yaml)

# Prompt the user for a commit message
commit_message = input("Enter the commit message: ")

print("\tCommitting changes...")
# Commit the changes
subprocess.run('git add .jenkins.yaml', shell=True, check=True)
subprocess.run(f'git commit -m "{commit_message}"', shell=True, check=True)

print("pushing changes to repository...")
subprocess.run("git push -u origin main", shell=True, check=True)
4 changes: 2 additions & 2 deletions templates/.jenkins.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ docker_no_cache: true
docker_force_tag: true
docker_skip_tag_as_latest: true
docker_build_args: |
BRANCH_NAME="{{ branch_name }}"
REPO_URL="{{ repository_url }}"
BRANCH_NAME={{ branch_name }}
REPO_URL={{ repository_url }}

0 comments on commit 21dacd5

Please sign in to comment.