From ddb0541b5f5e041e279ccadbcbad9d16fb09c4dc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 12:06:50 +0200 Subject: [PATCH 01/12] chore(deps): update dependency jsonschema to v4.22.0 (#151) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6ec63a11..647e5c1a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ cosl==0.0.11 jenkinsapi==0.3.13 -jsonschema==4.21.1 +jsonschema==4.22.0 ops==2.12.0 pydantic==1.10.15 requests==2.31.0 From 08a48ce02585436ae0c66a559d146b61b1c8ba88 Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Sat, 4 May 2024 03:13:12 +1200 Subject: [PATCH 02/12] Tell type checkers that the config options are strings. (#141) Co-authored-by: Phan Trung Thanh Co-authored-by: Yanks Yoon <37652070+yanksyoon@users.noreply.github.com> --- src/state.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/state.py b/src/state.py index de731656..2e3cad23 100644 --- a/src/state.py +++ b/src/state.py @@ -270,7 +270,7 @@ def from_charm(cls, charm: ops.CharmBase) -> "State": CharmIllegalNumUnitsError: if more than 1 unit of Jenkins charm is deployed. """ try: - time_range_str = charm.config.get("restart-time-range") + time_range_str = typing.cast(str, charm.config.get("restart-time-range")) if time_range_str: restart_time_range = Range.from_str(time_range_str) else: @@ -301,7 +301,7 @@ def from_charm(cls, charm: ops.CharmBase) -> "State": logger.error("Invalid juju model proxy configuration, %s", exc) raise CharmConfigInvalidError("Invalid model proxy configuration.") from exc - plugins_str = charm.config.get("allowed-plugins") + plugins_str = typing.cast(str, charm.config.get("allowed-plugins")) plugins = (plugin.strip() for plugin in plugins_str.split(",")) if plugins_str else None if charm.app.planned_units() > 1: From 20acfa288368516db4472f65edbac90d20affab2 Mon Sep 17 00:00:00 2001 From: Phan Trung Thanh Date: Fri, 3 May 2024 17:56:16 +0200 Subject: [PATCH 03/12] add external access docs (#154) * add external access docs * fix typo --- docs/reference/external-access.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docs/reference/external-access.md diff --git a/docs/reference/external-access.md b/docs/reference/external-access.md new file mode 100644 index 00000000..1ad3c1a0 --- /dev/null +++ b/docs/reference/external-access.md @@ -0,0 +1,19 @@ +# External access +The Jenkins charm requires access to the following domains to install Jenkins and its plugins: + +* `jenkins-ci.org` +* `updates.jenkins-ci.org` +* `jenkins.io` +* `updates.jenkins.io` +* `.mirrors.jenkins-ci.org` +* `fallback.get.jenkins.io` +* `get.jenkins.io` +* `pkg.jenkins.io` +* `archives.jenkins.io` +* `pkg.origin.jenkins.io` +* `.mirrors.jenkins.io` +* `www.jenkins.io` + +Depending on the localisation, some region-specific external mirrors might also be used. You can find more information on the [list of mirrors for Jenkins](https://get.jenkins.io/war/2.456/jenkins.war?mirrorstats). + +Some plugins can also require external access, such as `github.com` for the [Github branch source plugin](https://plugins.jenkins.io/github-branch-source/). Or an external Kubernetes cluster if you are using the [Kubernetes plugin](https://plugins.jenkins.io/kubernetes/). Refer to the documentation of the plugin for more details. \ No newline at end of file From 1f7ad84e17edd9be801d6fd490e5b5632291861a Mon Sep 17 00:00:00 2001 From: Phan Trung Thanh Date: Fri, 3 May 2024 17:57:12 +0200 Subject: [PATCH 04/12] ISD-1723 Add redeploy docs (#150) Co-authored-by: Tom Haddon --- docs/how-to/backup-and-restore-jenkins.md | 61 +++++++++++++++++++ docs/how-to/redeploy.md | 17 ++++++ docs/how-to/resize-jenkins-storage.md | 72 ++++------------------- 3 files changed, 88 insertions(+), 62 deletions(-) create mode 100644 docs/how-to/backup-and-restore-jenkins.md create mode 100644 docs/how-to/redeploy.md diff --git a/docs/how-to/backup-and-restore-jenkins.md b/docs/how-to/backup-and-restore-jenkins.md new file mode 100644 index 00000000..7020c9d4 --- /dev/null +++ b/docs/how-to/backup-and-restore-jenkins.md @@ -0,0 +1,61 @@ +# Backup and restore Jenkins +A backup is a snapshot of the Jenkins data (jobs, configurations, secrets, plugins, etc.) at a given point in time. This backup can be used to: +* Restore Jenkins to a previous stable state (during disaster recovery). +* Migrate data to a new Jenkins charm instance. + +## Create a backup +1. Create the backup script +From [Backing-up/Restoring Jenkins](https://www.jenkins.io/doc/book/system-administration/backing-up/), This script backs up the most essential files as mentioned in the article: +* The `master.key` file. +* Job-related files in the `./jobs`, `./builds` and `./workspace` folders. +* Plugins (`.hpi` and `.jpi` files) in the `./plugins` folder + +```bash +cat < backup.sh +#!/bin/bash +export JENKINS_HOME=/var/lib/jenkins +export JENKINS_BACKUP=/mnt/backup + +echo "running backup as \$(whoami) in \$(pwd)" +mkdir -p \$JENKINS_BACKUP +cp \$JENKINS_HOME/secrets/master.key \$JENKINS_BACKUP +cp -r \$JENKINS_HOME/jobs \$JENKINS_BACKUP +cp -r \$JENKINS_HOME/builds \$JENKINS_BACKUP +cp -r \$JENKINS_HOME/workspace \$JENKINS_BACKUP +mkdir -p \$JENKINS_BACKUP/plugins +cp -r \$JENKINS_HOME/plugins/*.hpi \$JENKINS_BACKUP/plugins +cp -r \$JENKINS_HOME/plugins/*.jpi \$JENKINS_BACKUP/plugins + +chown -R 2000:2000 \$JENKINS_BACKUP +tar zcvf jenkins_backup.tar.gz --directory=/mnt backup +EOF + +chmod +x backup.sh +``` +2. Transfer the backup script above to the running unit of the Jenkins-k8s charm and run it +```bash +JENKINS_UNIT=jenkins-k8s/0 +juju scp --container jenkins ./backup.sh $JENKINS_UNIT:/backup.sh +juju ssh --container jenkins $JENKINS_UNIT /backup.sh +``` +3. Retrieve the compressed backup file +```bash +JENKINS_UNIT=jenkins-k8s/0 +juju scp --container jenkins $JENKINS_UNIT:/jenkins_backup.tar.gz jenkins_backup.tar.gz +``` +You now have the compressed Jenkins data on your host system. + +## Restore the backup on a new (or existing) charm instance +1. Restore the backup on the Jenkins charm unit. +```bash +JENKINS_UNIT=jenkins-k8s/0 +juju scp --container jenkins ./jenkins_backup.tar.gz $JENKINS_UNIT:/jenkins_backup.tar.gz +juju ssh --container jenkins $JENKINS_UNIT tar zxvf jenkins_backup.tar.gz +juju ssh --container jenkins $JENKINS_UNIT chown -R 2000:2000 /backup +juju ssh --container jenkins $JENKINS_UNIT cp -aR /backup/* /var/lib/jenkins +juju ssh --container jenkins $JENKINS_UNIT rm -rf /backup /jenkins_backup.tar.gz +``` +2. Restart pebble for the changes to take effect +```bash +juju ssh --container jenkins $JENKINS_UNIT pebble restart jenkins +``` diff --git a/docs/how-to/redeploy.md b/docs/how-to/redeploy.md new file mode 100644 index 00000000..1908878e --- /dev/null +++ b/docs/how-to/redeploy.md @@ -0,0 +1,17 @@ +# How to redeploy Jenkins + +Redeployment is a process where the old charm instance is removed and data is migrated to a new charm instance. Redeploying the Jenkins charm consists of 3 steps: + +1. Create the new Jenkins charm instance +```bash +juju deploy jenkins-k8s jenkins-k8s-new +``` +2. Migrate Jenkins data +See the `Migrate Jenkins data` section below. +3. Remove the old Jenkins charm instance +```bash +juju remove-application jenkins-k8s +``` + +### Migrate Jenkins data +Follow the instructions in [the charm's documentation for backup and restore](https://charmhub.io/jenkins-k8s/docs/backup-and-restore-jenkins) to migrate the data to the new Jenkins charm instance. \ No newline at end of file diff --git a/docs/how-to/resize-jenkins-storage.md b/docs/how-to/resize-jenkins-storage.md index 05baeb89..55a20478 100644 --- a/docs/how-to/resize-jenkins-storage.md +++ b/docs/how-to/resize-jenkins-storage.md @@ -1,69 +1,17 @@ # How to resize the jenkins-home storage volume -The default size of the jenkins-home storage volume for a fresh installation is 1GB. While this works for most scenarios, operators might need to have more storage for installing plugins, storing artifacts, and runninng builds/checking out SCMs on the built-in node. +The default size of the jenkins-home storage volume for a fresh installation is 1GB. While this works for most scenarios, operators might need to have more storage for installing plugins, storing artifacts, and running builds/checking out SCMs on the built-in node. -A low disk-space on the built-in node will cause the node to go offline, blocking jenkins from running jobs. +A low disk-space on the built-in node will cause the node to go offline, blocking Jenkins from running jobs. -## Create a backup -From [Backing-up/Restoring Jenkins](https://www.jenkins.io/doc/book/system-administration/backing-up/), This script backs up the most essential files as mentioned in the article: -* The `master.key` file. -* Job-related files in the `./jobs`, `./builds` and `./workspace` folders. -* Plugins (`.hpi` and `.jpi` files) in the `./plugins` folder +### Create a backup of the current Jenkins charm instance +Follow the `Create a backup` section of [the charm's backup and restore documentation](https://charmhub.io/jenkins-k8s/docs/backup-and-restore-jenkins) to create an archive of the Jenkins data on your host system +### Deploy the new Jenkins charm instance, specifying the size of the storage volume +Create a new application with the `--storage` flag. In this example we'll deploy the charm with a storage of 10GB ```bash -echo cat < backup.sh -#!/bin/bash -export JENKINS_HOME=/var/lib/jenkins -export JENKINS_BACKUP=/mnt/backup - -echo "running backup as \$(whoami) in \$(pwd)" -mkdir -p \$JENKINS_BACKUP -cp \$JENKINS_HOME/secrets/master.key \$JENKINS_BACKUP -cp -r \$JENKINS_HOME/*.xml \$JENKINS_BACKUP -cp -r \$JENKINS_HOME/jobs \$JENKINS_BACKUP -cp -r \$JENKINS_HOME/builds \$JENKINS_BACKUP -cp -r \$JENKINS_HOME/workspace \$JENKINS_BACKUP -mkdir -p \$JENKINS_BACKUP/plugins -cp -r \$JENKINS_HOME/plugins/*.hpi \$JENKINS_BACKUP/plugins -cp -r \$JENKINS_HOME/plugins/*.jpi \$JENKINS_BACKUP/plugins - -chown -R 2000:2000 $JENKINS_BACKUP -tar zcvf jenkins_backup.tar.gz --directory=/mnt backup -EOF - -chmod +x backup.sh -``` -1. Transfer the backup script above to the running unit of the Jenkins-k8s charm and run it -```bash -JENKINS_UNIT=jenkins-k8s/0 -juju scp --container jenkins ./backup.sh $JENKINS_UNIT:/backup.sh -juju ssh --container jenkins $JENKINS_UNIT /backup.sh -``` -2. Retrieve the compressed backup file -```bash -JENKINS_UNIT=jenkins-k8s/0 -juju scp --container jenkins $JENKINS_UNIT:/jenkins_backup.tar.gz jenkins_backup.tar.gz -``` -3. With the data backed-up, we can remove the jenkins-k8s application. -```bash -JENKINS_APP=jenkins-k8s -juju remove-application $JENKINS_APP +juju deploy jenkins-k8s-new --storage jenkins-home=10GB ``` -## Restore the backup on a new charm instance -1. When the application has been deleted, create a new application with the `--storage` flag. In this example we'll deploy the charm with a storage of 10GB -```bash -juju deploy jenkins-k8s --storage jenkins-home=10GB -``` -2. Wait for the charm to be ready, then restore the backup on the new unit. -```bash -JENKINS_UNIT=jenkins-k8s/0 -juju scp --container jenkins ./jenkins_backup.tar.gz $JENKINS_UNIT:/jenkins_backup.tar.gz -juju ssh --container jenkins $JENKINS_UNIT tar zxvf jenkins_backup.tar.gz -juju ssh --container jenkins $JENKINS_UNIT chown -R 2000:2000 /backup -juju ssh --container jenkins $JENKINS_UNIT cp -R /backup/* /var/lib/jenkins -juju ssh --container jenkins $JENKINS_UNIT rm -rf /backup /jenkins_backup.tar.gz -``` -3. Finally restart pebble -```bash -juju ssh --container jenkins $JENKINS_UNIT pebble restart jenkins -``` +### Restore the created backup onto the newly created Jenkins charm instance +Follow the `Restore the backup on a new (or existing) charm instance` section of [the charm's backup and restore documentation](https://charmhub.io/jenkins-k8s/docs/backup-and-restore-jenkins) to create an archive of the Jenkins data on your host system. Remember to update the `JENKINS_UNIT` environment variable. For our example we have `JENKINS_UNIT=jenkins-k8s-new/0` + From ee5769a1fadaac334b186322ade593df44562312 Mon Sep 17 00:00:00 2001 From: Phan Trung Thanh Date: Mon, 6 May 2024 22:58:48 +0200 Subject: [PATCH 05/12] ISD-1846 Refresh agent relation on charm upgrade (#155) * reconfigure agent discovery during charm upgrades * update src-docs --- src-docs/charm.py.md | 2 +- src/charm.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src-docs/charm.py.md b/src-docs/charm.py.md index a7d3c7b5..696f5ce7 100644 --- a/src-docs/charm.py.md +++ b/src-docs/charm.py.md @@ -97,7 +97,7 @@ Return a dictionary for Jenkins Pebble layer. --- - + ### function `jenkins_set_storage_config` diff --git a/src/charm.py b/src/charm.py index fe6b547b..5e2d4f8b 100755 --- a/src/charm.py +++ b/src/charm.py @@ -171,6 +171,9 @@ def _upgrade_charm(self, event: ops.UpgradeCharmEvent) -> None: container = self.unit.get_container(JENKINS_SERVICE_NAME) if not jenkins.is_storage_ready(container): self.jenkins_set_storage_config(event) + # Update the agent discovery address. + # Updating the secret is not required since it's calculated using the agent's node name. + self.agent_observer.reconfigure_agent_discovery(event) def jenkins_set_storage_config(self, event: ops.framework.EventBase) -> None: """Correctly set permissions when storage is attached. From ca6edf8b16e761484b32afde70bccd40fb05169e Mon Sep 17 00:00:00 2001 From: Yanks Yoon <37652070+yanksyoon@users.noreply.github.com> Date: Wed, 8 May 2024 19:42:40 +0900 Subject: [PATCH 06/12] update to latest workflow (#156) --- .github/workflows/integration_test.yaml | 2 +- tests/conftest.py | 2 +- tests/integration/conftest.py | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integration_test.yaml b/.github/workflows/integration_test.yaml index e8ed68d1..1865afe3 100644 --- a/.github/workflows/integration_test.yaml +++ b/.github/workflows/integration_test.yaml @@ -10,7 +10,7 @@ jobs: with: channel: 1.28-strict/stable extra-arguments: | - --kube-config ${GITHUB_WORKSPACE}/kube-config + --kube-config=${GITHUB_WORKSPACE}/kube-config modules: '["test_auth_proxy.py", "test_cos.py", "test_ingress.py", "test_jenkins.py", "test_k8s_agent.py", "test_machine_agent.py", "test_plugins.py", "test_proxy.py", "test_upgrade.py", "test_external_agent.py"]' pre-run-script: | -c "sudo microk8s config > ${GITHUB_WORKSPACE}/kube-config diff --git a/tests/conftest.py b/tests/conftest.py index 899d026b..db61e17a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -13,7 +13,7 @@ def pytest_addoption(parser: pytest.Parser): parser: pytest command line parser. """ # The prebuilt charm file. - parser.addoption("--charm-file", action="store", default="") + parser.addoption("--charm-file", action="append", default=[]) # The Jenkins image name:tag. parser.addoption("--jenkins-image", action="store", default="") # The path to kubernetes config. diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 131b4ae4..87315714 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -7,6 +7,7 @@ import random import secrets import string +from pathlib import Path from typing import AsyncGenerator, Generator, Iterable, Optional import jenkinsapi.jenkins @@ -78,14 +79,14 @@ def num_units_fixture(request: FixtureRequest) -> int: @pytest_asyncio.fixture(scope="module", name="charm") -async def charm_fixture(request: FixtureRequest, ops_test: OpsTest) -> str: +async def charm_fixture(request: FixtureRequest, ops_test: OpsTest) -> str | Path: """The path to charm.""" - charm = request.config.getoption("--charm-file") - if not charm: + charms = request.config.getoption("--charm-file") + if not charms: charm = await ops_test.build_charm(".") - else: - charm = f"./{charm}" - return charm + assert charm, "Charm not built" + return charm + return charms[0] @pytest_asyncio.fixture(scope="module", name="application") From 056c0496703951dd8b39aa051d44546620677673 Mon Sep 17 00:00:00 2001 From: Yanks Yoon <37652070+yanksyoon@users.noreply.github.com> Date: Thu, 9 May 2024 14:40:04 +0900 Subject: [PATCH 07/12] chore: remove outdated cves (#144) * chore: remove outdated cves * update cvs list * update cve list --------- Co-authored-by: arturo-seijas <102022572+arturo-seijas@users.noreply.github.com> Co-authored-by: Arturo Seijas --- .trivyignore | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.trivyignore b/.trivyignore index 08882e70..34abc352 100644 --- a/.trivyignore +++ b/.trivyignore @@ -1,17 +1,11 @@ -# Jenkins CVEs -CVE-2016-1000027 -CVE-2024-22259 -CVE-2024-22257 -# Jenkins Plugin Manager CVEs -CVE-2023-5072 -GHSA-4jq9-2xhw-jpx7 -CVE-2024-23898 -CVE-2024-25710 -CVE-2024-26308 -CVE-2024-22201 -CVE-2024-22243 # Fixed in 5.3.33 CVE-2024-22259 # Fixed in 5.7.12 CVE-2024-22257 CVE-2024-22262 +# Jenkins Plugin Manager CVEs +CVE-2016-1000027 +CVE-2023-5072 +CVE-2024-23898 +# Other +CVE-2023-45288 \ No newline at end of file From d6d6ea59008ba1da55e0e88c90b1281f32763796 Mon Sep 17 00:00:00 2001 From: Yanks Yoon <37652070+yanksyoon@users.noreply.github.com> Date: Fri, 10 May 2024 02:16:37 +0900 Subject: [PATCH 08/12] fix: change jenkins user home (#158) * fix: change jenkins user home * ignore CVE-2023-45288 * use local registry --- .github/workflows/integration_test.yaml | 2 +- .trivyignore | 2 +- jenkins_rock/rockcraft.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration_test.yaml b/.github/workflows/integration_test.yaml index 1865afe3..96c2a500 100644 --- a/.github/workflows/integration_test.yaml +++ b/.github/workflows/integration_test.yaml @@ -19,4 +19,4 @@ jobs: juju-channel: 3.1/stable self-hosted-runner: true self-hosted-runner-label: "xlarge" - microk8s-addons: "dns ingress rbac storage metallb:10.15.119.2-10.15.119.4" + microk8s-addons: "dns ingress rbac storage metallb:10.15.119.2-10.15.119.4 registry" diff --git a/.trivyignore b/.trivyignore index 34abc352..76ac5495 100644 --- a/.trivyignore +++ b/.trivyignore @@ -8,4 +8,4 @@ CVE-2016-1000027 CVE-2023-5072 CVE-2024-23898 # Other -CVE-2023-45288 \ No newline at end of file +CVE-2023-45288 diff --git a/jenkins_rock/rockcraft.yaml b/jenkins_rock/rockcraft.yaml index 2712c8c1..c8e681a0 100644 --- a/jenkins_rock/rockcraft.yaml +++ b/jenkins_rock/rockcraft.yaml @@ -28,7 +28,7 @@ parts: mkdir -p $CRAFT_OVERLAY/var chmod 755 $CRAFT_OVERLAY/var groupadd -R $CRAFT_OVERLAY --gid 2000 jenkins - useradd -R $CRAFT_OVERLAY --system --gid 2000 --uid 2000 --home /srv/jenkins jenkins + useradd -R $CRAFT_OVERLAY --system --gid 2000 --uid 2000 --home /var/lib/jenkins jenkins jenkins: plugin: nil build-packages: From 16b4d116138ed01e1be3a199853bb753e2606689 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 22 May 2024 08:33:47 +0200 Subject: [PATCH 09/12] chore(deps): update dependency requests to v2.32.1 (#162) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 647e5c1a..924d7390 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ jenkinsapi==0.3.13 jsonschema==4.22.0 ops==2.12.0 pydantic==1.10.15 -requests==2.31.0 +requests==2.32.1 From fd3d4bcae6d419b319d96add753480d564f8844c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 23 May 2024 10:57:30 +0200 Subject: [PATCH 10/12] chore(deps): update dependency requests to v2.32.2 (#163) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 924d7390..58e117b4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ jenkinsapi==0.3.13 jsonschema==4.22.0 ops==2.12.0 pydantic==1.10.15 -requests==2.32.1 +requests==2.32.2 From 3487aad6c89acd045da2315c1547df0d4d708693 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 24 May 2024 09:17:03 +0200 Subject: [PATCH 11/12] chore(deps): update dependency ops to v2.13.0 (#152) * chore(deps): update dependency ops to v2.13.0 * fix linting * fix linting --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: arturo-seijas <102022572+arturo-seijas@users.noreply.github.com> Co-authored-by: Arturo Seijas Co-authored-by: Yanks Yoon <37652070+yanksyoon@users.noreply.github.com> --- requirements.txt | 2 +- src-docs/agent.py.md | 20 ++------------------ src/agent.py | 16 +--------------- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/requirements.txt b/requirements.txt index 58e117b4..4c95ff02 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ cosl==0.0.11 jenkinsapi==0.3.13 jsonschema==4.22.0 -ops==2.12.0 +ops==2.13.0 pydantic==1.10.15 requests==2.32.2 diff --git a/src-docs/agent.py.md b/src-docs/agent.py.md index f745235b..d74ba33c 100644 --- a/src-docs/agent.py.md +++ b/src-docs/agent.py.md @@ -12,22 +12,6 @@ The Jenkins agent relation observer. - **JENKINS_SERVICE_NAME** ---- - -## class `AgentRelationData` -Relation data required for adding the Jenkins agent. - - - -**Attributes:** - - - `url`: The Jenkins server url. - - `secret`: The secret for agent node. - - - - - --- ## class `Observer` @@ -39,7 +23,7 @@ The Jenkins agent relation observer. - `agent_discovery_url`: external hostname to be passed to agents for discovery. - + ### function `__init__` @@ -87,7 +71,7 @@ Shortcut for more simple access the model. --- - + ### function `reconfigure_agent_discovery` diff --git a/src/agent.py b/src/agent.py index 764d9c30..3d9c27bd 100644 --- a/src/agent.py +++ b/src/agent.py @@ -17,18 +17,6 @@ logger = logging.getLogger(__name__) -class AgentRelationData(typing.TypedDict): - """Relation data required for adding the Jenkins agent. - - Attributes: - url: The Jenkins server url. - secret: The secret for agent node. - """ - - url: str - secret: str - - class Observer(ops.Object): """The Jenkins agent relation observer. @@ -146,9 +134,7 @@ def _on_deprecated_agent_relation_joined(self, event: ops.RelationJoinedEvent) - return jenkins_url = self.agent_discovery_url - event.relation.data[self.model.unit].update( - AgentRelationData(url=jenkins_url, secret=secret) - ) + event.relation.data[self.model.unit].update({"url": jenkins_url, "secret": secret}) self.charm.unit.status = ops.ActiveStatus() def _on_agent_relation_joined(self, event: ops.RelationJoinedEvent) -> None: From ae4353d35538e63672fc15bc88d9f35f5ce220ff Mon Sep 17 00:00:00 2001 From: arturo-seijas <102022572+arturo-seijas@users.noreply.github.com> Date: Mon, 27 May 2024 10:36:31 +0200 Subject: [PATCH 12/12] Fix typo in docstrings (#164) --- src-docs/ingress.py.md | 2 +- src/ingress.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src-docs/ingress.py.md b/src-docs/ingress.py.md index 279f6352..da717356 100644 --- a/src-docs/ingress.py.md +++ b/src-docs/ingress.py.md @@ -49,7 +49,7 @@ Shortcut for more simple access the model. get_path() → str ``` -Return the path in whick Jenkins is expected to be listening. +Return the path in which Jenkins is expected to be listening. diff --git a/src/ingress.py b/src/ingress.py index b538d946..3dbf21f0 100644 --- a/src/ingress.py +++ b/src/ingress.py @@ -31,7 +31,7 @@ def __init__(self, charm: ops.CharmBase, key: str, relation_name: str): ) def get_path(self) -> str: - """Return the path in whick Jenkins is expected to be listening. + """Return the path in which Jenkins is expected to be listening. Returns: the path for the ingress URL.