Skip to content

Commit

Permalink
Merge pull request #1846 from ogayot/snapcraft-doc
Browse files Browse the repository at this point in the history
Update instructions to test local changes in kvm
  • Loading branch information
ogayot authored Oct 24, 2023
2 parents 41114a0 + ab0d773 commit 288691f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ Tests (and lint checks) are run by github actions using lxd. See
`.github/workflows/build.yaml` and `./scripts/test-in-lxd.sh` and so
on.

For "real" testing, you need to make a snap (`snapcraft snap`), mash
For "real" testing, you need to make a snap (`snapcraft pack`), mash
it into an existing ISO using `./scripts/inject-subiquity-snap.sh`,
and boot the result in a VM. There is an even hackier pair of scripts
(`./scripts/slimy-update-snap.sh` and
Expand Down
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,41 @@ an ISO. Rather than building one from scratch, it's much easier to
install your version of subiquity into the daily image. Here's how to
do this:

1. Build your change into a snap:
## Commit your changes locally

If you are only making a change in Subiquity itself, running `git add <modified-file...>`
and then `git commit` should be enough.

Otherwise, if you made any modification to curtin or probert, you need to ensure that:

* The modification is committed inside the relevant repository (i.e., `git add` + `git commit`).
* The relevant `source` property in snapcraft.yaml points to the local
repository instead of the upstream repository.
* The relevant `source-commit` property in snapcraft.yaml is updated to reflect
your new revision (one must use the full SHA-1 here).
* The above modifications to snapcraft.yaml are committed.

Example:
```
parts:
curtin:
plugin: nil
# Comment out the original source property, pointing to the upstream repository
#source: https://git.launchpad.net/curtin
# Instead, specify the name of the directory where curtin is checked out
source: curtin
source-type: git
# Update the below so it points to the commit ID within the curtin repository
source-commit: 7c18bf6a24297ed465a341a1f53875b61c878d6b
```

## Build and inject your changes into an ISO

1. Build your changes into a snap:

```
$ snapcraft snap --output subiquity_test.snap
$ snapcraft pack --output subiquity_test.snap
```

2. Grab the current version of the installer:
Expand Down
4 changes: 2 additions & 2 deletions scripts/kvm-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,14 @@ def build(ctx):
with snap_manager('subiquity_test.snap') as snap:
if not ctx.args.reuse:
run('snapcraft clean --use-lxd')
run(f'snapcraft snap --use-lxd --output {snap} {snapargs}')
run(f'snapcraft pack --use-lxd --output {snap} {snapargs}')
assert_exists(snap)
livefs_edit(ctx, '--add-snap-from-store', 'core20', 'stable',
'--inject-snap', snap)
elif project == 'ubuntu-desktop-installer':
with snap_manager('udi_test.snap') as snap:
run('snapcraft clean --use-lxd')
run(f'snapcraft snap --use-lxd --output {snap} {snapargs}')
run(f'snapcraft pack --use-lxd --output {snap} {snapargs}')
assert_exists(snap)
run(f'sudo ./scripts/inject-snap {ctx.baseiso} {ctx.iso} {snap}')
else:
Expand Down
2 changes: 1 addition & 1 deletion scripts/test-this-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cd $(dirname $(dirname $(readlink -f $0)))

sudo apt install -y zsync xorriso isolinux

snapcraft snap --output subiquity_test.snap
snapcraft pack --output subiquity_test.snap
urlbase=http://cdimage.ubuntu.com/ubuntu-server/daily-live/current
distroname=$(distro-info -d)
isoname="${distroname}"-live-server-$(dpkg --print-architecture).iso
Expand Down

0 comments on commit 288691f

Please sign in to comment.