1
0
Fork 0

Clean up the OBS updater and make sure the commit messages are labeled

To distinguish this from regular humans.
This commit is contained in:
Luca Beltrame 2021-08-29 16:47:30 +02:00
parent 432a5614dd
commit 5e95b7409f
Signed by: einar
GPG key ID: 4707F46E9EC72DEC

View file

@ -10,7 +10,6 @@ from urllib.parse import quote
import git import git
import requests import requests
import sarge
API_URL = "https://invent.kde.org/api/v4/projects/" API_URL = "https://invent.kde.org/api/v4/projects/"
OBS_URL = "https://api.opensuse.org/trigger/runservice" OBS_URL = "https://api.opensuse.org/trigger/runservice"
@ -86,8 +85,9 @@ def trigger_update(repository, package_name, token):
result = requests.post(OBS_URL, params=parameters, headers=header) result = requests.post(OBS_URL, params=parameters, headers=header)
if not result: if not result:
logging.error("Error during service run, package %s, error code %s, url %s", logging.error(
package_name, result.status_code, result.url) "Error during service run, package %s, error code %s, url %s",
package_name, result.status_code, result.url)
return False return False
logging.debug("Package %s complete", package_name) logging.debug("Package %s complete", package_name)
@ -105,7 +105,6 @@ def update_package(hash_data, package_name,
return return
remote_hash = get_remote_hash(repo_name, branch) remote_hash = get_remote_hash(repo_name, branch)
repo_hashes = hash_data.get(obs_repository)
if hash_data.get(obs_repository) is None: if hash_data.get(obs_repository) is None:
logging.debug("No prior data - initializing empty") logging.debug("No prior data - initializing empty")
@ -155,7 +154,7 @@ def commit_changes(cache_file, repo_home):
repo = git.Repo(repo_home) repo = git.Repo(repo_home)
repo.index.add([cache_file]) repo.index.add([cache_file])
repo.index.commit("Update caches") repo.index.commit("[OBS unstable update bot] Update caches")
origin = repo.remotes["origin"] origin = repo.remotes["origin"]
origin.pull(rebase=True) origin.pull(rebase=True)
origin.push() origin.push()