#feat(engine): support expanding variable...
1 messages ยท Page 1 of 1 (latest)
Maybe you can start by regenerating the PHP sdk btw:
dagger -m .dagger call sdk php generate -o . in your PR, just to see if that fixes the problem
Seems it's related to #php message
I'll have a look
If I'm understanding correctly, the issue is the engine being outdated for PhpSdk and PhpSdkDev.
Short term fix is probably to simply update the versions of the engine it relies on.
Long term fix is sorting out the PhpSdkDev to do the "spin up" itself
I will confirm this first once it finishes the generate command you mentioned.
If it does I will put in a small PR to simply update the engine versions if that's the issue.
I had been updating the engine versions in my other PRs but they are waiting on reviews before they can be merged:
https://github.com/dagger/dagger/pulls/charjr
I'll review them
I think the issue is that we are adding a new field to a few API's. I did generated (https://github.com/dagger/dagger/pull/8427/files#diff-9e6343b4537134ad5b18b0b418fc231ea281168718d98b633d2e539b7fe61797) the PHP SDK, but during the tests it always use engine version from main, so that engine version does not know about the new field? some of this was discussed here (#php message) by @sterile stratus
Yup, this is what I understand so far, that means we need to do some changes in our workflows I guess to use the dev engine
@safe moon I reviewed 2 of the Pr you did with some suggestions ๐ I let the 3rd one to Helder since he already reviewed multiple times, he got full context on that
Ah, thank you! It's always nice to finally get the PRs in!
Silly question, how do I perform codegen again?
I haven't used the command in so long. Or was that what the dagger call sdk php generate -o command should be doing?
dagger -m .dagger call sdk php generate -o .
the -m .dagger part doesn't seem to work for me
I was trying to work off of rajat's pr
I think we now need to use -m . (instead of -m .dagger)
Hmm .dagger shoudl work
Ohhh
dagger.json has move to the root again
Then yeah, . should be better
Ah thank you @late ruin @wraith sparrow It's running now
I have rebased the PR. I'm waiting for the tests to pass before I actually merge it
Amazing!
That's strange though cause I can do:
dagger -m .dagger functions
โ connect 20.1s
โ initialize 1m35.1s
Name Description
check Check that everything works. Use this as CI entrypoint.
cli Develop the Dagger CLI
dev Creates a dev container that has a running CLI connected to a dagger engine
dev-export Creates an static dev build
docs Develop the Dagger documentation
engine Develop the Dagger engine container
git-dir -
go Dagger's Go toolchain
helm Develop the Dagger helm chart
mod-codegen When set, module codegen is automatically applied when retrieving the Dagger source code
mod-codegen-targets -
ref -
scripts Run Dagger scripts
sdk Develop Dagger SDKs
source Return the Dagger source code
tag -
test Run all tests
version -
with-mod-codegen Enable module auto-codegen when retrieving the dagger source code
Ah I can as well. I'm honestly not sure then.. maybe I entered it wrong but I thought I copy pasted it XD
maybe the error is because the source dir context changes between running from root vs .dagger dir?
the issue here is that we need to pass the "installed" cli+engine to the php test function
we do this for python today
@late ruin are you able to add something similar to the php dev module?
you can't do it with a constructor yet, since constructors are supported, but you could add a withBase, or even just add it as an arg to Test
I might be able to sort the constructor out, @placid radish approved a PR for adding constructors just now
yes, but even with the constructors merged, they're not releases
Ah.
and we need this to work on v0.13.3, which is part of the problem ๐
are you able to add something similar to the php dev module?
let me timebox this for a couple of hours and try out. Will reach out if I run into issues ๐
thanks thanks โค๏ธ
i'd use the python module for inspiration, it should just be passing throught the "base" container similar to how it's done there
If it's a new PR targeting 13.4, why does it need to work on 13.3?
I think I have it working with this commit: https://github.com/dagger/dagger/pull/8427/commits/9dd119c963ef46155219fea2abacb6360ebd55fd
my understanding is that in case of PHP, its using the engine from main branch. but when we added a new field in engine, its not available yet in engine from main branch (as expected), so its failing.
the fix is to use dev engine for running CI tests
this works yes, but can we not take the approach of python like i suggested above? we should still call the phps dev module for testing if possible
because when our ci runs we are using dagger-0.13.3 and also dagger-main for all our sdk jobs
the php dev module is imported into our ci
therefore it has to work on both of these versions
sure, we can do that. i may have to add more functions to php sdk, that should be ok right?
yup, it's just to the dev module
no worries!
Hi @safe moon, re: constructors in PHP, is the constructor suppose to return a Container: https://github.com/dagger/dagger/blob/03a3249f91c8967d2e99c7d5a11bc7bef1da9244/sdk/php/runtime/template/README.md?plain=1#L214
@late ruin Hi that is a mistake! I will fix that!
the constructor should not have a return type
Should look like this:
#[DaggerFunction]
public function __construct(
// whatever arguments you have here
) {
// ...
}
I've fixed this in #8411 since I was already tweaking the README in that PR
I've been trying to debug a failure for php sdk changes (to use dev engine), and found that using option ExperimentalPrivilegedNesting: true somehow results in using old engine. but with it to be false, it works as expected
@sterile stratus @safe moon - any pointers why that might be the case and is it ok to turn off the flag in SDK for tests?
I'll have a look. I suspect I might fix this by solving https://github.com/dagger/dagger/issues/8125
yeah, some help to move the PR would be great: https://github.com/dagger/dagger/pull/8427. It seems now PHP tests are passing, but some test is failing in PHP-dev. (and some flakes in Rust and other CI jobs ๐ฆ )
I think @sterile stratus's advice is going to be the right approach, I'm just trying to follow how it works.
yeah, now the changes are following Justin's advice. I have the container with the custom installer, and it seems it is the right container. (btw, PHP, PHP-dev and Rust are green now in CI after retrying runs , just one last run left. ๐ค )
It looks mostly good, but we can't use a constructor here - that constructor is going to be ignored for the php job right?
Since our ci is using v0.13.3, which doesn't have constructor support (in php)
since it seems to be passing though, i'm very confused as to why this works
I'm not entirely sure. A lot of dagger is currently a black box for me. I know the PR for constructors is now merged.
Is it something to do with where the "sdk" points in dagger.json?
Since the PHP one is actually just an alias if I recall
oh
i see, right php is pulling directly off of main and isn't pinned to anything ๐ค
i suppose that's fine, but we should probably pin it to a specific commit, instead of relying on always using main
I agree, I will be shortening it to the php alias in https://github.com/dagger/dagger/pull/8411
But I believe that alias is literally identical to github.com/dagger/dagger/sdk/php
My only concern is, what happens when I add a new feature to the PHP SDK?
If I'm not pointing at main, how do I test it?
php as an alias is not perfectly identical
https://github.com/dagger/dagger/blob/7cba95531a426dbf9dc6f24b41fc6357e8b3f9b7/core/schema/sdk.go#L132-L135
specifically, just php will default to the v0.13.3 tag
we should update it to be php@<current main commit>.
when you add a new php feature, you can use it in the dev module by bumping the commit in the version there
i don't think there are plans to introduce breaking changes to the php sdk right now, but if we ever do it, then the pins here will be useful
will this change impact the current PR?
i would really love to have this PR merged once the CI is green. pretty please.
๐
Right, so the basic idea would be:
1 - Add new feature to PHP SDK, commit hash of new feature is a1b2c3
2 - Point PhpSdkDev to php@a1b2c3
no, this can be done separately
exactly this, yes
the CI is green on the PR now. if nothing else is blocking, could we pls merge that PR?
i have some comments, would you rather do them in this pr, or as a follow-up
otherwise, lgtm
Hi Justin, I think i have addressed those comments and also added some additional testcases,
thank you for catching them.
Hi @safe moon with the constructor changes in PHP Dev, I am getting following error:
Stdout:
[ERROR] DaggerFunction "__construct" cannot be supported without a return type ```
did something changed recently regarding this? it was working for me earlier.
It should not have changed.
Looking at that error, it looks like it's not recognising it as the constructor. This is exactly what would happen before constructors were supported.
What version of dagger is it trying to use? To me it looks as though the PhpSdkDev is actually working off of 0.13.3? cc @sterile stratus
You could try testing it by changing the sdk in sdk/php/dev/dagger.json to "sdk": "php@05cab0d6502599671a9da7d338011edd3a76129c",. This is the commit hash when constructor support got merged.
ok. let me try that. but what is surprising is that this was working yesterday. so maybe something else changed somewhere else. let me verify with the commit you suggested
yeah, that seems to have fixed it.
๐ thank you
let me cross check what might have triggered this changed behavior
ah this line changed the behavior: https://github.com/dagger/dagger/pull/8411/files#diff-e354edd4f37c35bae9c9aed3f9b6c0280b4c1bacf5a875c2447858f66f8f9181L3
if SDK == "github.com/dagger/dagger/sdk/php" -> it uses main
if SDK == "php" -> it uses engine version
let me double check something else as well.
yeah, that seems like it. ๐ฆ
Yeah this is unexpected, but I think the right behavior
Ah! That makes sense now.
Yes I hadn't updated to use the alias yet on dev. I apologise for that.
For now, the best solution is to depend on that commit hash: "sdk": "php@05cab0d6502599671a9da7d338011edd3a76129c"
I would rather not go back to using the direct link because that was clearly the root of the problem (and I might forget to update it next time as well!)
I will update it to remove the specific hash when 0.14 is released
We don't want to inject tags into a full GitHub URL, we should only do magic things for the top level aliases/names
Yeah, clearly that was the issue. I hadn't fully understood how clever that alias was.
I'm sorry you had to track it down @late ruin
no worries @safe moon . i am actually glad that we found the root cause. ๐ .
i pushed a commit to use "php@main" - is that acceptable, if not how do we handle that (for current scenario as well as future updates).
having the SDK use released version is not going to work well if there are changes in SDK which are not released yet
can't remember where i said this, but we shouldn't have it pointed to main
this means that if we make backwards incompat changes, old versions of the dev module won't build
In this instance, should we point to "sdk": "php@05cab0d6502599671a9da7d338011edd3a76129c" The exact hash where PHP SDK constructors were merged?
Then, when 0.14 comes out, we can remove the tag and work in the same fashion as the other SDKs?
sounds good!
cc @late ruin