Skip to content

plan validation: abort if structures are not concrete - #2302

Merged
aluzzardi merged 1 commit into
dagger:mainfrom
aluzzardi:field-check-structs
Apr 25, 2022
Merged

aluzzardi merged 1 commit into
dagger:mainfrom
aluzzardi:field-check-structs

Conversation

@aluzzardi

@aluzzardi aluzzardi commented Apr 25, 2022 •

Copy link
Copy Markdown
Contributor

Improve error messages when pointing to an invalid structure reference

Before:

failed to load plan: client.filesystem."./bin".write: non-concrete value struct

After:

failed to load plan: "client.filesystem.\"./bin\".write" is not set

@aluzzardi
aluzzardi requested a review from a team as a code owner April 25, 2022 20:16
@aluzzardi
aluzzardi requested review from TomChv and marcosnils April 25, 2022 20:16
@aluzzardi

Copy link
Copy Markdown
Contributor Author

Eh, this causes a regression:

	actions: {
		build: core.#Dockerfile & {
			source: client.filesystem.testdata.read.contents
		}

With #Dockerfile defined as:

	dockerfile: *{
		path: string | *"Dockerfile"
	} | {
		contents: string
	}

Apparently, CUE believes the dockerfile struct is not concrete: failed to load plan: "actions.build.dockerfile" is not set

@jlongtine Any way around this?

@aluzzardi
aluzzardi force-pushed the field-check-structs branch from e1fbe75 to 24ea78c Compare April 25, 2022 20:29
@aluzzardi

Copy link
Copy Markdown
Contributor Author

Trying to check if the struct is concrete AND if it has a default, let's see how it goes

@aluzzardi
aluzzardi merged commit 58e0396 into dagger:main Apr 25, 2022
@aluzzardi
aluzzardi deleted the field-check-structs branch April 25, 2022 22:20
@aluzzardi
aluzzardi restored the field-check-structs branch April 25, 2022 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants