diff --git a/docs/how-to/resize-jenkins-storage.md b/docs/how-to/resize-jenkins-storage.md index f7e85a1c..05baeb89 100644 --- a/docs/how-to/resize-jenkins-storage.md +++ b/docs/how-to/resize-jenkins-storage.md @@ -66,4 +66,4 @@ 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 -``` \ No newline at end of file +``` diff --git a/jenkins_rock/rockcraft.yaml b/jenkins_rock/rockcraft.yaml index f1fb2080..2712c8c1 100644 --- a/jenkins_rock/rockcraft.yaml +++ b/jenkins_rock/rockcraft.yaml @@ -45,7 +45,7 @@ parts: - default-jre-headless - git build-environment: - - JENKINS_VERSION: 2.440.2 + - JENKINS_VERSION: 2.440.3 - JENKINS_PLUGIN_MANAGER_VERSION: 2.12.13 override-build: | mkdir -p ${CRAFT_PART_INSTALL}/{srv/jenkins/,etc/default/jenkins/} diff --git a/src-docs/agent.py.md b/src-docs/agent.py.md index cbc79c2d..f745235b 100644 --- a/src-docs/agent.py.md +++ b/src-docs/agent.py.md @@ -87,7 +87,7 @@ Shortcut for more simple access the model. --- - + ### function `reconfigure_agent_discovery` diff --git a/src-docs/auth_proxy.py.md b/src-docs/auth_proxy.py.md index b3f0d1f6..f000cb71 100644 --- a/src-docs/auth_proxy.py.md +++ b/src-docs/auth_proxy.py.md @@ -18,7 +18,7 @@ Observer module for Jenkins to auth_proxy integration. ## class `Observer` The Jenkins Auth Proxy integration observer. - + ### function `__init__` diff --git a/src-docs/jenkins.py.md b/src-docs/jenkins.py.md index a7ea1fc4..403ff2ae 100644 --- a/src-docs/jenkins.py.md +++ b/src-docs/jenkins.py.md @@ -30,7 +30,7 @@ Functions to operate Jenkins. --- - + ## function `get_admin_credentials` @@ -54,7 +54,7 @@ Retrieve admin credentials. --- - + ## function `is_storage_ready` @@ -84,7 +84,7 @@ Return whether the Jenkins home directory is mounted and owned by jenkins. --- - + ## function `install_default_config` @@ -103,7 +103,7 @@ Install default jenkins-config.xml. --- - + ## function `install_auth_proxy_config` @@ -122,7 +122,7 @@ Install jenkins-config.xml for auth_proxy. --- - + ## function `get_agent_name` @@ -183,7 +183,7 @@ Wrapper for Jenkins functionality. Attrs: environment: the Jenkins environment configuration. web_url: the Jenkins web URL. login_url: the Jenkins login URL. version: the Jenkins version. - + ### function `__init__` @@ -237,7 +237,7 @@ Returns: the web URL. --- - + ### function `add_agent_node` @@ -262,7 +262,7 @@ Add a Jenkins agent node. --- - + ### function `bootstrap` @@ -292,7 +292,7 @@ Initialize and install Jenkins. --- - + ### function `get_node_secret` @@ -322,7 +322,7 @@ Get node secret from jenkins. --- - + ### function `remove_agent_node` @@ -347,7 +347,7 @@ Remove a Jenkins agent node. --- - + ### function `remove_unlisted_plugins` @@ -377,7 +377,7 @@ Remove plugins that are not in the list of desired plugins. --- - + ### function `rotate_credentials` @@ -406,7 +406,7 @@ Invalidate all Jenkins sessions and create new password for admin account. --- - + ### function `safe_restart` @@ -430,7 +430,25 @@ Safely restart Jenkins server after all jobs are done executing. --- - + + +### function `update_prefix` + +```python +update_prefix(prefix: str) → None +``` + +Update jenkins prefix. + + + +**Args:** + + - `prefix`: the new prefix. + +--- + + ### function `wait_ready` @@ -492,7 +510,7 @@ Represents an error probing for Jenkins storage mount. - `msg`: Explanation of the error. - + ### function `__init__` diff --git a/src-docs/pebble.py.md b/src-docs/pebble.py.md index c43e1c56..8f951aee 100644 --- a/src-docs/pebble.py.md +++ b/src-docs/pebble.py.md @@ -19,7 +19,8 @@ Pebble functionality. replan_jenkins( container: Container, jenkins_instance: Jenkins, - state: State + state: State, + disable_security: bool = False ) → None ``` @@ -32,6 +33,7 @@ Replan the jenkins services. - `container`: the container for with to replan the services. - `jenkins_instance`: the Jenkins instance. - `state`: the charm state. + - `disable_security`: whether to replan with security disabled. diff --git a/tests/integration/test_plugins.py b/tests/integration/test_plugins.py index 4d7b5155..461dccd0 100644 --- a/tests/integration/test_plugins.py +++ b/tests/integration/test_plugins.py @@ -330,30 +330,48 @@ async def test_thinbackup_plugin(ops_test: OpsTest, unit_web_client: UnitWebClie """ await install_plugins(unit_web_client, ("thinBackup",)) backup_path = "/srv/jenkins/backup/" - res = unit_web_client.client.requester.post_url( - f"{unit_web_client.web}/manage/thinBackup/saveSettings", - data={ + payload = { + "jenkins-model-MasterBuildConfiguration": { + "numExecutors": "0", + }, + "jenkins-model-GlobalQuietPeriodConfiguration": {"quietPeriod": "5"}, + "jenkins-model-GlobalSCMRetryCountConfiguration": {"scmCheckoutRetryCount": "0"}, + "org-jvnet-hudson-plugins-thinbackup-ThinBackupPluginImpl": { "backupPath": backup_path, - "fullBackupSchedule": "", - "diffBackupSchedule": "", - "nrMaxStoredFull": -1, - "excludedFilesRegex": "", - "forceQuietModeTimeout": 120, - "failFast": "on", - "Submit": "", }, + } + res = unit_web_client.client.requester.post_url( + f"{unit_web_client.web}/configSubmit", + data=[ + ( + "json", + json.dumps(payload), + ), + ], ) res.raise_for_status() - res = unit_web_client.client.requester.get_url( + res = unit_web_client.client.requester.post_url( f"{unit_web_client.web}/manage/thinBackup/backupManual" ) res.raise_for_status() - ret, stdout, stderr = await ops_test.juju( - "ssh", "--container", "jenkins", unit_web_client.unit.name, "ls", backup_path - ) - assert ret == 0, f"Failed to ls backup path, {stderr}" - assert "FULL" in stdout, "The backup folder of format FULL- not found." + async def has_backup() -> bool: + """Get whether the backup is created. + + The backup folder of format FULL- should be created. + + Returns: + Whether the backup file has successfully been created. + """ + ret, stdout, stderr = await ops_test.juju( + "ssh", "--container", "jenkins", unit_web_client.unit.name, "ls", backup_path + ) + logger.info( + "Run backup path ls result: code: %s stdout: %s, stderr: %s", ret, stdout, stderr + ) + return ret == 0 and "FULL" in stdout + + await wait_for(has_backup) async def test_bzr_plugin(unit_web_client: UnitWebClient):