Skip to content

docs: Resolve Dagger version dynamically - #2369

Merged
slumbering merged 1 commit into
dagger:mainfrom
gerhard:docs-version-auto-update
Jul 25, 2022
Merged

slumbering merged 1 commit into
dagger:mainfrom
gerhard:docs-version-auto-update

Conversation

@gerhard

@gerhard gerhard commented Apr 29, 2022 •

Copy link
Copy Markdown
Contributor

This will fetch the version from https://dl.dagger.io/dagger/latest_version and template it in all doc pages on deploy.

Resolves #1854
Resolves #2205
Resolves #2351

The only thing which remains is to figure out how to template this version in the YAML snippets, e.g. https://github.com/dagger/dagger/pull/2369/files#diff-e309255ddd52101788f3de79596d0b93496c72d4b04059e44154f9e12b63e4d0R134

@gerhard
gerhard requested review from a team and slumbering as code owners April 29, 2022 09:00
@gerhard
gerhard requested a review from jlongtine April 29, 2022 09:00
@gerhard
gerhard marked this pull request as draft April 29, 2022 09:00
@aluzzardi

Copy link
Copy Markdown
Contributor

I still don't understand the reasoning behind putting the dagger binary version inside the docs -- what problem are we solving?

  • This and putting no version at all has the same effect
  • ~Half our users are on macOS and installing through brew without using DAGGER_VERSION
  • Docs do depend on the version of dagger, that is very true
    • For instance, the new output feature doc page can ONLY be followed by users with the next release which is not out yet: feat: Print action outputs to console #2265
    • The output feature will also affect other unrelated docs pages (e.g. if we display snippets of dagger and relying on outputs)
    • That's a problem and I agree with that. But the solution might be to add disclaimer banners (e.g. "requires dagger 0.2.9 or higher") or something. I don't think hardcoding the version helps with any of that

@slumbering

Copy link
Copy Markdown
Contributor
  • This and putting no version at all has the same effect

@aluzzardi do you mean that :
curl -L https://dl.dagger.io/dagger/install.sh | sh would do the same thing as curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.2.9 sh? No need to set DAGGER_VERSION to get the latest version ?
If yes, I agree that we definitely do not need to have this dynamic version mecanism.

@gerhard

gerhard commented May 4, 2022 •

Copy link
Copy Markdown
Contributor Author

I still don't understand the reasoning behind putting the dagger binary version inside the docs -- what problem are we solving?

We are hard-coding the version of the latest dagger CLI release in various places, as initially captured in #1854 (we have added a few more since then). We are doing this so that we have deterministic starting points for code examples, or linking to specific parts of our codebase.

  • This and putting no version at all has the same effect

No version means main, while a specific version means this specific tag.

  • ~Half our users are on macOS and installing through brew without using DAGGER_VERSION

Using curl and a specific version means that bin/dagger will be resolved to that specific version. This can coexist with brew, and is a great solution to brew's inability to install a specific version. It's also great being able to do this: https://github.com/thechangelog/changelog.com/blob/4291f328c53d89b63feb1c3affab580770927933/2022.fly/Makefile#L58-L64

There are situations when we are publishing docs for an unreleased version of Dagger. In that case, we don't use the latest released version which gets dynamically resolved, but a specific version, e.g. >= 0.2.9

  • The output feature will also affect other unrelated docs pages (e.g. if we display snippets of dagger and relying on outputs)

Yes, that is definitely one of the follow-ups. In that case, I am wondering whether we want to keep an outdated version of dagger in the docs (which is what we are doing currently, before this PR), or if we expect readers to notice the discrepancy and submit improvements to the examples. For the past month, they have been submitting bumps to the dagger version, as captured in the PRs linked to the issues referenced in the top comment.

@aluzzardi

Copy link
Copy Markdown
Contributor

No version means main, while a specific version means this specific tag.

I believe this only affects 1200-local-dev.md, when doing git checkout <VERSION>, which could be replaced by a git checkout $(dagger version --short).

No other documentation page would reference main if we were to loose DAGGER_VERSION.

1200-local-dev.md is even a special case since it mixes installing dagger and running an example at once, while it's not true for all the other documentation pages.

Were we following the same structure (local-dev is an example only), dynamically updating git checkout v0.2.X wouldn't help since it's entirely dependent on which version of dagger the user is using.

Using curl and a specific version means that bin/dagger will be resolved to that specific version. This can coexist with brew, and is a great solution to brew's inability to install a specific version. It's also great being able to do this: https://github.com/thechangelog/changelog.com/blob/4291f328c53d89b63feb1c3affab580770927933/2022.fly/Makefile#L58-L64

Just on a single docs page. There's no relationship between DAGGER_VERSION and 1204-secrets.md

Again, I don't understand the problem that's being solved. It would be helpful to see an example of a broken scenario that's fixed by DAGGER_VERSION.

  • Making sure the user installs the latest version?
    • Removing DAGGER_VERSION does just that. With or without: same outcome
  • Making sure the dagger binary is compatible with the docs page the user is viewing?
    • Still broken on all pages except 1200-local-dev.md
    • Would also be broken for 1200-local-dev.md if we were to have a separate 1234-install.md
    • Dynamically checking out based on the user's dagger version would fit that
  • Core Reference API?
    • The documentation is for a SPECIFIC version of Core
    • Pointing to any other tag than the one documented will be a mismatch
    • Whether it's main or the latest tag, it's the same sort of mismatch

@marcosnils marcosnils mentioned this pull request May 5, 2022
@gerhard

gerhard commented May 6, 2022

Copy link
Copy Markdown
Contributor Author

@gerhard

gerhard commented May 10, 2022

Copy link
Copy Markdown
Contributor Author

Talking to @aluzzardi this is what we settled on:

  1. Legit.
  2. Lock to the version they were written for. When we update the core packages, we should update this version in the docs to reflect this. This may require a checklist.
  3. Don't couple installing a specific version with installing the latest version. Replace specific dagger version in the CLI output with a placeholder, same as GIT_SHA
  4. Legit.

Where we use git checkout, use $(dagger version --short) instead of a specific version. This will require implementing the --short flag.

In conclusion, continue as proposed with this.

@github-actions

github-actions Bot commented Jun 8, 2022

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@gerhard

gerhard commented Jul 7, 2022 •

Copy link
Copy Markdown
Contributor Author

I am picking this one up again. Will ask for your review @slumbering as soon as everything is green.

Would be great to get it merged today.


<TabItem value="gitlab">

```yaml

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.

For info @gerhard 👉 This is where I was stuck

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just got to the same issue now. Resolved all conflicts, including issues with my node install & node-fetch.

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@gerhard

gerhard commented Jul 22, 2022

Copy link
Copy Markdown
Contributor Author

This one has been going on for too long 🎡

We are planning to get it merged with @slumbering on July 25th. I'm going to solve the conflicts now and transition it from draft to open so that it's easier to push through come Monday.

@gerhard
gerhard marked this pull request as ready for review July 25, 2022 14:25
This will fetch the version from
https://dl.dagger.io/dagger/latest_version and template it in all doc
pages on deploy.

Resolves #1854
Resolves #2205
Resolves #2351

Signed-off-by: Gerhard Lazu <[email protected]>

docs: fix dagger function call within markdown

Signed-off-by: Jffarge <[email protected]>

docs: fetch latest released version from GitHub

Based on https://github.com/parca-dev/docs/blob/9586ba479acb5f42e29da1845a6d931c6b83c4b0/docusaurus-github-releases-plugin/src/index.js

Signed-off-by: Gerhard Lazu <[email protected]>

Bump DAGGER_VERSION in YAML configs to latest

This is the only value that we couldn't figure out how to template so far.
Defer to follow-up PR.

Signed-off-by: Gerhard Lazu <[email protected]>

Manually bump Dagger version in Dagger CI workflow
This should remain as is.

Signed-off-by: Gerhard Lazu <[email protected]>

docs: Bump BuildKit version in links to the latest one

Signed-off-by: Gerhard Lazu <[email protected]>

Default DaggerVersionLatestReleased value to something obviously wrong

Signed-off-by: Gerhard Lazu <[email protected]>

@slumbering slumbering 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.

Let's merge it and fix the 1201-ci-environment in an other PR

@slumbering
slumbering merged commit 2b0de14 into dagger:main Jul 25, 2022
@gerhard
gerhard deleted the docs-version-auto-update branch July 25, 2022 15:22
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