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

[JUJU-1558] Validate local bundle #14427

Merged
merged 2 commits into from Aug 5, 2022
Merged

Conversation

hmlanigan
Copy link
Member

@hmlanigan hmlanigan commented Aug 4, 2022

Check the response for parsing a local bundle for any UnmarshalErrors. If they exist, print and fail the deploy unless --force is used. Not done for repository bundles, who knows what havoc that might wreak.

Developer friendly structure data is available with --logging-config "juju.charm=TRACE" --show-log

QA steps

Deploy local charms, repository charms and bundles, no changes to be found.

# Deploy the following bundle without force
name: slurm
description: A suite of codified operations to asssemble, install, deploy, and operate Slurm.
website: https://omnivector-solutions.github.io/osd-documentation/master/
docs: https://omnivector-solutions.github.io/osd-documentation/master/
source: https://github.com/omnivector-solutions/slurm-bundles/
issues: https://github.com/omnivector-solutions/slurm-charms/issues

series: focal

applications:
  slurmctld:
    charm: slurmctld
    num_units: 1
    contstraints: instance-type=c5a.large root-disk=20G

$ juju deploy ./bundle-min.yaml --dry-run
ERROR cannot deploy bundle: unmarshal document 0: yaml: unmarshal errors:
  line 1: field name not found in bundle
  line 3: field website not found in bundle
  line 4: field docs not found in bundle
  line 5: field source not found in bundle
  line 6: field issues not found in bundle
  line 14: field contstraints not found in applications
$ juju deploy ./bundle-min.yaml --dry-run --force
Located charm "slurmctld" in charm-hub, channel stable
Changes to deploy bundle:
- upload charm slurmctld from charm-hub for series focal with architecture=amd64
- deploy application slurmctld from charm-hub on focal
- add unit slurmctld/0 to new machine 0

Bug reference

https://bugs.launchpad.net/juju/+bug/1983386

Copy link
Member

@cderici cderici left a comment

Choose a reason for hiding this comment

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

Aside from the CI test failures this LGTM (not sure what's going on with the ci). QA steps worked as expected too.

@hmlanigan hmlanigan marked this pull request as ready for review August 5, 2022 13:47
@hmlanigan
Copy link
Member Author

rebased and updated go.mod/sum with charm v 8.0.2

LP 1983386. Validate local bundles, but allow --force to work as well.
@hmlanigan
Copy link
Member Author

/merge

1 similar comment
@hmlanigan
Copy link
Member Author

/merge

@jujubot jujubot merged commit 34541a8 into juju:2.9 Aug 5, 2022
@hmlanigan hmlanigan deleted the validate-local-bundle branch August 8, 2022 13:33
jujubot added a commit that referenced this pull request Aug 12, 2022
#14452

Pull requests:
- #14424 
- #14428 
- #14430 
- #14431 
- #14433 
- #14434 
- #14437 
- #14439 
- #14440 
- #14442 
- #14444
- #14445 
- #14446 
- #14448
- #14453 
- Updated `github.com/juju/charm/v9` to v9.0.4.

Conflicts:
- apiserver/common/tools_test.go
- cmd/juju/commands/upgradecontroller_test.go
- cmd/juju/commands/upgrademodel_test.go
- go.mod
- go.sum
- scripts/win-installer/setup.iss
- snap/snapcraft.yaml
- version/version.go

Note: ignoring #14427 since this is due to be reverted (see #14449).
jujubot added a commit that referenced this pull request Aug 16, 2022
#14449

Reverts #14427

This change caused a bug to be filed with the opposite issue. Bundles exist with "extra" data well known data now. 
https://bugs.launchpad.net/juju/+bug/1984133

While this change is only for local bundles, there are concerns over using force flag. Though the dry-run flag could be used to get more data before using the force flag.

A new approach is being developed.
@ycliuhw ycliuhw mentioned this pull request Aug 19, 2022
jujubot added a commit that referenced this pull request Aug 20, 2022
#14488

```
Merge branch '2.9' into develop

# Conflicts:
# .github/workflows/smoke.yml
# apiserver/common/tools_test.go
# apiserver/facades/client/application/application_unit_test.go
# apiserver/facades/client/application/mock_test.go
# apiserver/facades/client/application/package_test.go
# apiserver/facades/client/cloud/cloudV2_test.go
# apiserver/facades/client/cloud/cloud_test.go
# caas/kubernetes/provider/application/application.go
# cmd/juju/commands/upgradecontroller_test.go
# cmd/juju/commands/upgrademodel.go
# cmd/juju/commands/upgrademodel_test.go
# cmd/juju/controller/kill.go
# go.mod
# go.sum
# scripts/win-installer/setup.iss
# snap/snapcraft.yaml
# tests/suites/deploy/bundles/lxd-profile-bundle.yaml
# tests/suites/deploy/bundles/telegraf_bundle.yaml
# tests/suites/deploy/bundles/trusted_bundle.yaml
# tests/suites/deploy/deploy_charms.sh
# tests/suites/network/network_health.sh
# tests/suites/ovs_maas/ovs_netplan_config.sh
# tests/suites/spaces_ec2/juju_bind.sh
# tests/suites/spaces_ec2/upgrade_charm_with_bind.sh
# tests/suites/upgrade/streams.sh
# upgrades/operations.go
# upgrades/upgrade_test.go
# version/version.go
```

Includes PRs:
- #14424
- #14428
- #14430
- #14431
- #14427
- #14433
- #14434
- #14437
- #14439
- #14440
- #14442
- #14445
- #14446
- #14444
- #14448
- #14453
- #14436
- #14459
- #14462
- #14458
- #14418
- #14419
- #14463
- #14464
- #14455
- #14449
- #14465
- #14470
- #14473
- #14476
- #14468
- #14383
- #14483
jujubot added a commit that referenced this pull request Aug 30, 2022
#14474

Display bundle unmarshall errors when deploying with --dry-run. A compromise for LP1983386 and LP1984133, a rework of #14427 

## QA steps

Deploy local charms, repository charms and bundles, no changes to be found.

```sh
# Deploy the following bundle without force
name: slurm
description: A suite of codified operations to asssemble, install, deploy, and operate Slurm.
website: https://omnivector-solutions.github.io/osd-documentation/master/
docs: https://omnivector-solutions.github.io/osd-documentation/master/
source: https://github.com/omnivector-solutions/slurm-bundles/
issues: https://github.com/omnivector-solutions/slurm-charms/issues

series: focal

applications:
 slurmctld:
 charm: slurmctld
 num_units: 1
 contstraints: instance-type=c5a.large root-disk=20G

$ juju deploy ./bundle-min.yaml --dry-run
WARNING These fields
 document 0:
 line 1: unrecognized field "name"
 line 3: unrecognized field "website"
 line 4: unrecognized field "docs"
 line 5: unrecognized field "source"
 line 6: unrecognized field "issues"
 line 14: unrecognized field "contstraints"
will be ignored during deployment
```

## Bug reference

https://bugs.launchpad.net/juju/+bug/1984133
https://bugs.launchpad.net/juju/+bug/1983386
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants