Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
cli: update parts cache in the container #1546
Conversation
kalikiana
referenced this pull request
Sep 12, 2017
Merged
lxd: snapcraft refresh in containers #1412
kalikiana
self-assigned this
Sep 12, 2017
kalikiana
added some commits
Sep 12, 2017
sergiusens
reviewed
Oct 5, 2017
Looks good, a question related to a test and how this would affect the behavior of define and search when the environment variable is set where it would potentially never be updated locally.
| + fake_lxd.name = 'local:snapcraft-snap-test' | ||
| + fake_lxd.status = 'Running' | ||
| + fake_logger = fixtures.FakeLogger(level=logging.INFO) | ||
| + self.useFixture(fake_logger) |
sergiusens
Oct 5, 2017
Collaborator
I don't think you need this fake logger setup here; or what is it intended for as there are no checks for it. self.run_command would return an object with an output and exit_code attribute.
kalikiana
Oct 5, 2017
Collaborator
You're right! Thanks for pointing it out! I'd copied it because it's used in other tests, but actually the output is the same - we could probably simplify a few other tests this way at some point.
I dropped the logger and added a check for exit code (not sure if it's really necessary here, but can't hurt to have it).
kalikiana
added some commits
Oct 5, 2017
kyrofa
reviewed
Oct 11, 2017
•
This looks fine, although in the proposal you say:
Proposal
- Run snapcraft update in the container
- Run apt-get update, apt-get upgrade and snap refresh as part of update - this would be similar to how the clean command without arguments deletes the container
- Stop running apt-get update with all other commands
I proposed a PR implementing the proposal.
All I see here is the first in that list, no?
| + summary: test snapping | ||
| + description: if snap is succesful a snap package will be available | ||
| + architectures: ['amd64'] | ||
| + type: {} |
kyrofa
Oct 11, 2017
Member
When using an external template like this, named parameters are far more clear and scalable than positional ones.
kalikiana
Oct 12, 2017
Collaborator
I just copied it from the snap test :-D but yeah, I changed it to {snap_type}
| def setUp(self): | ||
| super().setUp() | ||
| self.parts_dir = os.path.join(BaseDirectory.xdg_data_home, 'snapcraft') | ||
| self.parts_yaml = os.path.join(self.parts_dir, 'parts.yaml') | ||
| self.headers_yaml = os.path.join(self.parts_dir, 'headers.yaml') | ||
| + def make_snapcraft_yaml(self, n=1, snap_type='app', snapcraft_yaml=None): |
sergiusens
Oct 12, 2017
Collaborator
There is a make_snapcraft_yaml in the parent class for tests which you can just use, right?
kalikiana
Oct 12, 2017
Collaborator
I basically went with the style used in other tests there, which have their own customized version of the method for repeated use. But you're right, in this case I can keep it really simple. So, done.
|
Tests are green again! |
| + container_config = env.get_container_config() | ||
| + if container_config.use_container: | ||
| + project_options = get_project_options(**kwargs) | ||
| + lifecycle.containerbuild('update', project_options, container_config) |
elopio
Oct 24, 2017
Member
This looks good to me, but I'm wondering why do we have to update the parts in the host?
kalikiana
Oct 24, 2017
Collaborator
Because snapcraft define and snapcraft search operate on the host. There's little reason to start a container for those... or do you think we should?
|
On mar, oct 24, 2017 at 2:29 AM, Leo Arias ***@***.***> wrote:
@elopio commented on this pull request.
In snapcraft/cli/parts.py:
> """Updates the parts listing from the cloud."""
+ container_config = env.get_container_config()
+ if container_config.use_container:
+ project_options = get_project_options(**kwargs)
+ lifecycle.containerbuild('update', project_options,
container_config)
This looks good to me, but I'm wondering why do we have to update the
parts in the host?
If you are outside of a project directory these commands should still
work, and as such define and search should probably always run from the
context of the host while update needs to happen in both places.
A note of that ^ should be made in the code so it doesn't fall through
the cracks in the future.
…
|
kalikiana
added some commits
Oct 25, 2017
sergiusens
added this to the 2.35 milestone
Oct 26, 2017
elopio
approved these changes
Oct 26, 2017
Thanks for the comment, it makes my doubts go away.
kyrofa
approved these changes
Oct 27, 2017
This has my vote of approval, thanks @kalikiana.
kalikiana commentedSep 12, 2017
•
Edited 1 time
-
kalikiana
Sep 12, 2017
./runtests.sh static?./runtests.sh unit?See the forum proposal.
Note: The other part is implemented in #1412.