Merge pull request #1770 from talentedmrjones/dagger-do-suggets-update

errors on missing packages suggests project update
This commit is contained in:
Andrea Luzzardi 2022-03-10 16:58:23 -08:00 committed by GitHub
commit a7d5b366ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 2 deletions

View File

@ -49,8 +49,12 @@ func Load(ctx context.Context, cfg Config) (*Plan, error) {
if err != nil { if err != nil {
errstring := err.Error() errstring := err.Error()
if strings.Contains(errstring, "cannot find package") && strings.Contains(errstring, "alpha.dagger.io") { if strings.Contains(errstring, "cannot find package") {
return nil, ErrIncompatiblePlan if strings.Contains(errstring, "alpha.dagger.io") {
return nil, ErrIncompatiblePlan
} else if strings.Contains(errstring, pkg.DaggerModule) || strings.Contains(errstring, pkg.UniverseModule) {
return nil, fmt.Errorf("%w: running `dagger project update` may resolve this", err)
}
} }
return nil, err return nil, err

View File

@ -46,6 +46,11 @@ setup() {
assert_output --partial "attempting to load a dagger 0.1.0 project." assert_output --partial "attempting to load a dagger 0.1.0 project."
} }
@test "plan/do: missing packages suggests project update" {
run "$DAGGER" "do" -p ./plan/do/missing_dependencies.cue test
assert_output --partial ": running \`dagger project update\` may resolve this"
}
@test "plan/hello" { @test "plan/hello" {
# Europa loader handles the cwd differently, therefore we need to CD into the tree at or below the parent of cue.mod # Europa loader handles the cwd differently, therefore we need to CD into the tree at or below the parent of cue.mod
cd "$TESTDIR" cd "$TESTDIR"

View File

@ -0,0 +1,7 @@
package main
import (
"dagger.io/daggggger" // intentionally misspelled to force error message
)
dagger.#Plan