Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new DeployFromRepository endpoint for deploy #949

Merged
merged 7 commits into from Sep 22, 2023

Conversation

cderici
Copy link
Member

@cderici cderici commented Sep 12, 2023

Description

This allows pylibjuju to use the new DeployFromRepository endpoint, introduced in the Application facade v19.

PendingUploadResources will be handled in a separate PR.

This also fixes what juju/juju@22e3fc0#diff-cd1b6b10813a1b0ebe7fe9a04f11c401dfeec0574ffb00058bfec98b6bb1d255 seems to be breaking by returning a non-empty error list (Pdb) self.plan.errors ['', '', '', '', '', '', '', '', ''] from GetChangesMapArgs.

QA Steps

There's two parts for QAing this. Making sure deploy still works for everything < 3.3. CI tests will cover most of that part of the QA, as we use deploy in almost every single integration test, and it's being tested against latest/stable (which as of today is 3.1.5). So it is advisable to do the manual QA (see below) against juju 3.2, just to be sure.

Second part is obviously making sure that the deploy works for 3.3 with the new endpoint. To do that, I simply

 $ juju version
3.3-beta2-ubuntu-amd64
 $ juju bootstrap localhost lxd33 && juju add-model test

Then just manually deployed the ubuntu charm using repl.

python -m asyncio
asyncio REPL 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> from juju import model;m=model.Model();await m.connect();await m.deploy('ubuntu')
<Application entity_id="ubuntu">
>>>
exiting asyncio REPL...

All CI tests need to pass.

Notes & Discussion

JUJU-3637

@cderici cderici added the 3.3 label Sep 12, 2023
@cderici cderici added this to the 3.3.0 milestone Sep 12, 2023
The result.errors from `GetChangesMapArgs` has changed in Juju to
return something like `['', '', '', '', '', '', '', '', '']` instead
of `[]` in a non-error return.
to avoid timeout errors simply because it takes longer with complex
charms
@cderici cderici force-pushed the deploy-from-repository-new-endpoint branch from f5bd29f to c8824e7 Compare September 19, 2023 19:57
@cderici cderici changed the title [WIP] Use new DeployFromRepository endpoint for deploy Use new DeployFromRepository endpoint for deploy Sep 19, 2023
@cderici
Copy link
Member Author

cderici commented Sep 21, 2023

/build

@cderici
Copy link
Member Author

cderici commented Sep 22, 2023

The failing tests are unrelated. Docs are failing for an unknown reason, but in a later PR (#952) it's building fine.

Copy link
Member

@anvial anvial left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx, lg2m

@cderici
Copy link
Member Author

cderici commented Sep 22, 2023

/merge

@jujubot jujubot merged commit 48570bb into juju:master Sep 22, 2023
5 of 8 checks passed
jujubot added a commit that referenced this pull request Sep 26, 2023
…deployfromrepository

#953

#### Description

This is the continuation of #949, that implements handling of the local resources that need to be uploaded after a (server-side) deploy.

In particular, this splits out the second part of the `add_local_resources` into a separate `_upload` function to use after the `DeployFromRepository` call which reports the pending file uploads if there's any.

#### QA Steps

Following the #949, this needs the server side deploy support from the controller (i.e. `>= 3.3`). So, 

```sh
 $ juju version
3.3-beta2-ubuntu-amd64
 $ juju bootstrap localhost lxd33 && juju add-model test
```

Now let's make a local resource to use:

```sh
 $ cd python-libjuju
 $ echo "jujurulez" > ./foo.txt
 $ cat ./foo.txt
jujurulez
```

Then just manually deploy the `juju-qa-test` charm with the local resource `foo.txt`.

```python
python -m asyncio
asyncio REPL 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> from juju import model;m=model.Model();await m.connect();await m.deploy('juju-qa-test', application_name='j1', resources={'foo-file':'./foo.txt'}))
<Application entity_id="j1">
>>>
exiting asyncio REPL...
```

Now confirm that the resource is uploaded:

```sh
 $ juju resources j1
Resource Supplied by Revision
foo-file admin 2023-09-19T22:55
```

All CI tests need to pass.

#### Notes & Discussion

JUJU-3638
jujubot added a commit that referenced this pull request Oct 26, 2023
#980

## What's Changed
* Repository Maintenance Improvements by @cderici in #922
* Stale bot to not bother feature requests by @cderici in #926
* Fix linter issues by @cderici in #928
* Fix docstring typo by @DanielArndt in #927
* Fix asyncio on README by @marceloneppel in #930
* Fix integration/test_application.test_action by @cderici in #932
* Update 3.2 facade clients by @cderici in #931
* [JUJU-4488] Add licence headers to source files on 3.x by @cderici in #934
* Update async tests to use builtin python suite by @DanielArndt in #935
* Pass correct charm url to series selector by @cderici in #942
* Green CI cleanup for python-libjuju by @cderici in #939
* Bring forward support for nested assumes expressions on 3x by @cderici in #943
* Release 3.2.2.0 notes by @cderici in #945
* Cleanup release process for 3.x by @cderici in #946
* Use new DeployFromRepository endpoint for deploy by @cderici in #949
* Handle pending upload resources deployfromrepository by @cderici in #953
* Optimize connection teardown by @cderici in #952
* Use `log.warning` instead of the deprecated `warn` by @sed-i in #954
* Find controller name by endpoint on 3.x track by @cderici in #966
* Optimize & fix unit removal by @cderici in #967
* Allow switch kwarg in refresh to switch to local charms by @jack-w-shaw in #971
* Parse charm URLs consistantly for local charms by @jack-w-shaw in #974
* Juju config directory location fix on 3.x by @cderici in #976
* [JUJU-4779] Ensure valid charm origin for local charm switches by @jack-w-shaw in #978
* Application refresh with resources on 3.x by @cderici in #973

#### Notes & Discussion

JUJU-4851

[JUJU-4488]: https://warthogs.atlassian.net/browse/JUJU-4488?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-4779]: https://warthogs.atlassian.net/browse/JUJU-4779?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants