Skip to content

Commit

Permalink
Merge pull request #25 from 6G-SANDBOX/dev
Browse files Browse the repository at this point in the history
New release 0.2.1
  • Loading branch information
CarlosAndreo authored Jul 22, 2024
2 parents a554617 + 18b3b14 commit 8a89f4a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [v0.2.1] - 2024-07-22

### Changed

- Docker version to 27.0.3.

### Fixed

- Launch a trial network when there are no builds of the job yet in Jenkins.
- Destroy a trial network when there are no builds of the job yet in Jenkins.

## [v0.2.0] - 2024-07-18

### Added
Expand Down Expand Up @@ -72,5 +83,6 @@

- Frontend implementation.

[v0.2.1]: https://github.com/6G-SANDBOX/TNLCM/compare/v0.2.0...v0.2.1
[v0.2.0]: https://github.com/6G-SANDBOX/TNLCM/compare/v0.1.0...v0.2.0
[v0.1.0]: https://github.com/6G-SANDBOX/TNLCM/releases/tag/v0.1.0
2 changes: 1 addition & 1 deletion conf/tnlcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TnlcmSettings:
raise UndefinedEnvVariableError(missing_variables)

TITLE = "Trial Network Life Cycle Manager - TNLCM"
VERSION = "0.2.0"
VERSION = "0.2.1"
DESCRIPTION = ("""
Welcome to the Trial Network Life Cycle Manager (TNLCM) API! This powerful tool facilitates the management and orchestration of network life cycles, designed specifically for the cutting-edge 6G Sandbox project.
Expand Down
3 changes: 1 addition & 2 deletions core/callback/callback_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,4 @@ def exists_path_entity_trial_network(self, entity_name):
Return true if exists entity file with information received by Jenkins
"""
log_handler.info(f"Check whether the file of the '{entity_name}' entity has been created")
path_entity_trial_network = os.path.join(REPORT_DIRECTORY, f"{self.trial_network.tn_id}-{entity_name}.json")
return os.path.exists(path_entity_trial_network)
return os.path.exists(os.path.join(REPORT_DIRECTORY, f"{self.trial_network.tn_id}-{entity_name}.json"))
25 changes: 12 additions & 13 deletions core/jenkins/jenkins_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def trial_network_deployment(self):
self.trial_network.save()
raise JenkinsResponseError(f"Error in the response received by Jenkins when trying to deploy the '{entity_name}' entity", response.status_code)
last_build_number = self.jenkins_client.get_job_info(name=self.deployment_job_name)["nextBuildNumber"]
while self.jenkins_client.get_job_info(name=self.deployment_job_name)["lastCompletedBuild"]["number"] is None:
while not self.jenkins_client.get_job_info(name=self.deployment_job_name)["lastCompletedBuild"]:
sleep(15)
while last_build_number != self.jenkins_client.get_job_info(name=self.deployment_job_name)["lastCompletedBuild"]["number"]:
sleep(15)
Expand Down Expand Up @@ -136,7 +136,7 @@ def _jenkins_destroy_parameters(self):
"""
Return a dictionary with the parameters for each component to be passed to the destroy pipeline
"""
parameters = {
return {
# MANDATORY
"TN_ID": self.trial_network.tn_id,
"DEPLOYMENT_SITE": self.trial_network.deployment_site,
Expand All @@ -148,22 +148,21 @@ def _jenkins_destroy_parameters(self):
"SITES_BRANCH": self.trial_network.github_6g_sandbox_sites_commit_id,
# "DEBUG": true
}
return parameters

def trial_network_destroy(self):
"""
Trial network destroy starts
"""
jenkins_build_job_url = self.jenkins_client.build_job_url(name=self.destroy_job_name, parameters=self._jenkins_destroy_parameters())
response = post(jenkins_build_job_url, auth=(self.jenkins_username, self.jenkins_token))
if response.status_code == 201:
log_handler.info(f"Start the destroyed of the '{self.trial_network.tn_id}' trial network")
last_build_number = self.jenkins_client.get_job_info(name=self.destroy_job_name)["nextBuildNumber"]
while last_build_number != self.jenkins_client.get_job_info(name=self.destroy_job_name)["lastCompletedBuild"]["number"]:
sleep(15)
if self.jenkins_client.get_job_info(name=self.destroy_job_name)["lastSuccessfulBuild"]["number"] != last_build_number:
raise JenkinsComponentPipelineError(f"Pipeline for destroy '{self.trial_network.tn_id}' trial network has failed", 500)
log_handler.info(f"Trial network '{self.trial_network.tn_id}' successfully destroyed")
self.jenkins_client.build_job(name=self.destroy_job_name, parameters=self._jenkins_destroy_parameters(), token=self.jenkins_token)
log_handler.info(f"Start the destroyed of the '{self.trial_network.tn_id}' trial network")
last_build_number = self.jenkins_client.get_job_info(name=self.destroy_job_name)["nextBuildNumber"]
while not self.jenkins_client.get_job_info(name=self.destroy_job_name)["lastCompletedBuild"]:
sleep(15)
while last_build_number != self.jenkins_client.get_job_info(name=self.destroy_job_name)["lastCompletedBuild"]["number"]:
sleep(15)
if self.jenkins_client.get_job_info(name=self.destroy_job_name)["lastSuccessfulBuild"]["number"] != last_build_number:
raise JenkinsComponentPipelineError(f"Pipeline for destroy '{self.trial_network.tn_id}' trial network has failed", 500)
log_handler.info(f"Trial network '{self.trial_network.tn_id}' successfully destroyed")

def get_all_jobs(self):
"""
Expand Down
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,15 +368,15 @@ In the [marketplace-community](https://github.com/6G-SANDBOX/marketplace-communi
<p align="right"><a href="#readme-top">Back to top&#x1F53C;</a></p>

<!-- Urls, Shields and Badges -->
[tnlcm-badge]: https://img.shields.io/badge/TNLCM-v0.2.0-blue
[tnlcm-url]: https://github.com/6G-SANDBOX/TNLCM/releases/tag/v0.2.0
[tnlcm-badge]: https://img.shields.io/badge/TNLCM-v0.2.1-blue
[tnlcm-url]: https://github.com/6G-SANDBOX/TNLCM/releases/tag/v0.2.1
[python-badge]: https://img.shields.io/badge/Python-3.12.4-blue?style=for-the-badge&logo=python&logoColor=white&labelColor=3776AB
[python-url]: https://www.python.org/downloads/release/python-3124/
[flask-badge]: https://img.shields.io/badge/Flask-3.0.3-brightgreen?style=for-the-badge&logo=flask&logoColor=white&labelColor=000000
[flask-url]: https://flask.palletsprojects.com/en/3.0.x/
[mongodb-badge]: https://img.shields.io/badge/MongoDB-7.0.12-green?style=for-the-badge&logo=mongodb&logoColor=white&labelColor=47A248
[mongodb-url]: https://www.mongodb.com/
[docker-badge]: https://img.shields.io/badge/Docker-25.0.4-6AB7FF?style=for-the-badge&logo=docker&logoColor=white&labelColor=2496ED
[docker-badge]: https://img.shields.io/badge/Docker-27.0.3-6AB7FF?style=for-the-badge&logo=docker&logoColor=white&labelColor=2496ED
[docker-url]: https://www.docker.com/
[contributors-shield]: https://img.shields.io/github/contributors/6G-SANDBOX/TNLCM.svg?style=for-the-badge
[contributors-url]: https://github.com/6G-SANDBOX/TNLCM/graphs/contributors
Expand Down

0 comments on commit 8a89f4a

Please sign in to comment.