Skip to content

Guard against wrong dagger binary in TypeScript SDK - #3285

Merged
sipsma merged 1 commit into
dagger:cloakfrom
gerhard:guard-against-wrong-dagger-in-typescript-sdk
Oct 11, 2022
Merged

sipsma merged 1 commit into
dagger:cloakfrom
gerhard:guard-against-wrong-dagger-in-typescript-sdk

Conversation

@gerhard

@gerhard gerhard commented Oct 7, 2022 •

Copy link
Copy Markdown
Contributor

We want to fail if the "wrong" dagger is used. Versions prior to 0.3.x will not have commands that these SDKs depend on.

Follow-up to #3261
Part of #3176

@netlify

netlify Bot commented Oct 7, 2022 •

Copy link
Copy Markdown

👷 Deploy request for cloak-docs accepted.

Name Link
🔨 Latest commit 98be613
🔍 Latest deploy log https://app.netlify.com/sites/cloak-docs/deploys/63444482f9e5680009368cda

@gerhard gerhard self-assigned this Oct 7, 2022
@gerhard

This comment was marked as outdated.

@gerhard gerhard changed the title Guard against wrong "dagger" in TypeScript SDK Guard against wrong dagger binary in TypeScript SDK Oct 7, 2022
@sipsma
sipsma self-requested a review October 7, 2022 21:04
@gerhard

gerhard commented Oct 7, 2022

Copy link
Copy Markdown
Contributor Author

The integration test that I imagine for this is not easy. Do you think it's worth adding it @sipsma?

@sipsma

sipsma commented Oct 7, 2022

Copy link
Copy Markdown
Contributor

The integration test that I imagine for this is not easy. Do you think it's worth adding it

No I agree it's not worth it; manual test is fine for this given it's not straightforward to automate and is just handling a one-off event more or less, not like a feature we need to keep caring about indefinitely.

@gerhard
gerhard marked this pull request as ready for review October 7, 2022 21:56
@gerhard

This comment was marked as outdated.

@gerhard

gerhard commented Oct 7, 2022 •

Copy link
Copy Markdown
Contributor Author

While we have this context, I am fairly certain that there is nothing to do for the Go SDK - it doesn't invoke the binary.

From my POV, it's just the Python one left:

def _spawn(self):
args = [
'dagger', 'dev',
'--workdir', self._config['workdir'],
'--port', str(self._config['port']),
'-p', self._config['configPath'],
]
self._process = subprocess.Popen(args)

Would you agree @sipsma?

Comment thread sdk/nodejs/dagger/dist/engine.js Resolved
@sipsma

sipsma commented Oct 7, 2022

Copy link
Copy Markdown
Contributor

Would you agree?

Agreed, also given the python SDK is in such an early state and not used much yet outside our team I'm not sure if it's really necessary to update it (cc @helderco @samalba in case you disagree)

@gerhard
gerhard marked this pull request as draft October 7, 2022 23:14
@gerhard

gerhard commented Oct 10, 2022

Copy link
Copy Markdown
Contributor Author

Given the python SDK is in such an early state and not used much yet outside our team I'm not sure if it's really necessary to update it

I bounced a few ideas of @helderco this morning, we have a simple solution that will work for both SDKs. Will be changing this PR shortly, and then following up with the Python one.

Comment thread sdk/nodejs/dagger/engine.ts Resolved
@gerhard

gerhard commented Oct 10, 2022

Copy link
Copy Markdown
Contributor Author

This is now ready for another review round:

Screenshot 2022-10-10 at 17 10 50

This is meant to guard against running the "wrong" dagger. Versions
prior to 0.3.x will not have commands that these SDKs depend on.

This is the simplest & most straightforward check. Both happy & unhappy
path work as expected now. Log output behaves as expected too.

Why exit 127 instead of 1?
https://tldp.org/LDP/abs/html/exitcodes.html

Signed-off-by: Gerhard Lazu <[email protected]>
@gerhard
gerhard marked this pull request as ready for review October 10, 2022 16:12
@gerhard
gerhard requested review from sipsma and slumbering October 10, 2022 16:13

@sipsma sipsma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@sipsma
sipsma merged commit 86a2295 into dagger:cloak Oct 11, 2022
@gerhard
gerhard deleted the guard-against-wrong-dagger-in-typescript-sdk branch October 11, 2022 17:54
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.

3 participants