Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version metadata tool #7723

Merged
merged 19 commits into from
Mar 6, 2025
Merged

Add version metadata tool #7723

merged 19 commits into from
Mar 6, 2025

Conversation

dlon
Copy link
Member

@dlon dlon commented Feb 25, 2025


This change is Reviewable

@dlon dlon requested a review from hulthe February 25, 2025 15:17
@dlon dlon force-pushed the upload-installer-metadata branch 2 times, most recently from 65f9a65 to 4e2ed70 Compare February 27, 2025 07:59
@dlon dlon force-pushed the installer-downloader branch 3 times, most recently from db28ddb to 165d53d Compare February 27, 2025 08:21
@dlon dlon force-pushed the upload-installer-metadata branch from 4e2ed70 to bca6010 Compare February 27, 2025 08:25
@dlon dlon marked this pull request as ready for review February 27, 2025 08:26
Copy link
Contributor

@hulthe hulthe left a comment

Choose a reason for hiding this comment

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

Reviewed 7 of 19 files at r1, 1 of 4 files at r2, all commit messages.
Reviewable status: 8 of 19 files reviewed, 3 unresolved discussions


mullvad-update/meta/src/github.rs line 17 at r2 (raw file):

        .text()
        .await
        .context("Failed to retrieve text for changes.txt (tag missing?)")

⛏️ Ideally, all of the contexts should include the URL I think


mullvad-update/meta/src/config.rs line 29 at r2 (raw file):

            }
            Err(err) => Err(err).context(format!("Failed to read {CONFIG_FILENAME}")),
        }

⛏️ This is racey as we're opening the file twice, but probably not an issue irl tbh


mullvad-update/meta/src/config.rs line 36 at r2 (raw file):

        fs::write(CONFIG_FILENAME, toml_str.as_bytes())
            .await
            .context(format!("Failed to save {CONFIG_FILENAME}"))

Hmm. I would use anyhow! instead of format!, but I wonder if there's actually any difference in this case? Probably not.


mullvad-update/meta/src/artifacts.rs line 30 at r2 (raw file):

        .stream_position()
        .await
        .context("Failed to get file size")?;

have you considered using File::metadata instead?

Copy link
Member Author

@dlon dlon left a comment

Choose a reason for hiding this comment

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

Reviewable status: 6 of 19 files reviewed, 2 unresolved discussions (waiting on @hulthe)


mullvad-update/meta/src/artifacts.rs line 30 at r2 (raw file):

Previously, hulthe (Joakim Hulthe) wrote…

have you considered using File::metadata instead?

Done.


mullvad-update/meta/src/config.rs line 36 at r2 (raw file):

Previously, hulthe (Joakim Hulthe) wrote…

Hmm. I would use anyhow! instead of format!, but I wonder if there's actually any difference in this case? Probably not.

Would anyhow! result in two errors? Anyhow, I switched to with_context with format!. That's what anyhow suggests in its docs. 🤷


mullvad-update/meta/src/github.rs line 17 at r2 (raw file):

Previously, hulthe (Joakim Hulthe) wrote…

⛏️ Ideally, all of the contexts should include the URL I think

It is included in the source error:

Error: Failed to retrieve changes.txt (tag missing?)

Caused by:
    0: error sending request for url (https://raw.githubuserconxtent.com/mullvad/mullvadvpn-app/refs/tags/2123.1/desktop/packages/mullvad-vpn/changes.txt)
    1: client error (Connect)
    2: dns error: failed to lookup address information: Name or service not known
    3: failed to lookup address information: Name or service not known

Copy link
Contributor

@hulthe hulthe left a comment

Choose a reason for hiding this comment

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

Reviewed 7 of 19 files at r1, 1 of 4 files at r2.
Reviewable status: 14 of 19 files reviewed, 9 unresolved discussions (waiting on @dlon)


mullvad-update/meta/src/config.rs line 36 at r2 (raw file):

Previously, dlon (David Lönnhager) wrote…

Would anyhow! result in two errors? Anyhow, I switched to with_context with format!. That's what anyhow suggests in its docs. 🤷

Using context always adds an additional error afaik. Using format vs anyhow doesn't matter in that respect


mullvad-update/meta/src/github.rs line 17 at r2 (raw file):

Previously, dlon (David Lönnhager) wrote…

It is included in the source error:

Error: Failed to retrieve changes.txt (tag missing?)

Caused by:
    0: error sending request for url (https://raw.githubuserconxtent.com/mullvad/mullvadvpn-app/refs/tags/2123.1/desktop/packages/mullvad-vpn/changes.txt)
    1: client error (Connect)
    2: dns error: failed to lookup address information: Name or service not known
    3: failed to lookup address information: Name or service not known

Oh. reqwest includes it? Sweet, didn't know that.


mullvad-update/meta/src/main.rs line 107 at r2 (raw file):
⛏️ Imo, a help text directed towards the user shouldn't refer to them in third-person.

Suggestion:

Do not prompt for confirmation when overwriting signed files


mullvad-update/meta/src/platform.rs line 220 at r2 (raw file):

        create_dir_and_write(&signed_path, signed_bytes)
            .await
            .context("Failed to write signed data")?;

Include path in the context?


mullvad-update/meta/src/io_util.rs line 25 at r2 (raw file):

            } else {
                println!(" [y/N]");
            }

⛏️ Ideally, stdin should be drained before rendering the prompt


mullvad-update/meta/src/io_util.rs line 76 at r2 (raw file):

        .context("Failed to create directories")?;

    fs::write(path, contents).await?;

⛏️ .context?

Also, ideally, all of the contexts should include path. I admit it's annoying to add it everywhere though 😅


mullvad-update/meta/src/main.rs line 24 at r2 (raw file):

/// Metadata expiry to use when not specified (months from now)
#[allow(dead_code)]
const DEFAULT_EXPIRY_MONTHS: usize = 6;

dead code?


mullvad-update/meta/src/main.rs line 73 at r2 (raw file):

        platforms: Vec<Platform>,
        /// Rollout percentage (default is 1)
        #[arg(long)]

How come default_value isn't used here?


mullvad-update/meta/src/main.rs line 74 at r2 (raw file):

        /// Rollout percentage (default is 1)
        #[arg(long)]
        rollout: Option<f32>,

Does 1 mean 100% or 1%?


mullvad-update/src/format/mod.rs line 45 at r2 (raw file):

/// Signed JSON response, not including the signature
#[derive(Default, Debug, Deserialize, Serialize)]

Does it make sense for this to impl default? DateTime becomes unix epoch which may not be intuitive.

Copy link
Contributor

@hulthe hulthe left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 4 files at r2.
Reviewable status: 16 of 19 files reviewed, 9 unresolved discussions (waiting on @dlon)

Copy link
Member Author

@dlon dlon left a comment

Choose a reason for hiding this comment

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

Reviewable status: 13 of 19 files reviewed, 5 unresolved discussions (waiting on @hulthe)


mullvad-update/meta/src/io_util.rs line 76 at r2 (raw file):

Previously, hulthe (Joakim Hulthe) wrote…

⛏️ .context?

Also, ideally, all of the contexts should include path. I admit it's annoying to add it everywhere though 😅

Done!


mullvad-update/meta/src/main.rs line 24 at r2 (raw file):

Previously, hulthe (Joakim Hulthe) wrote…

dead code?

Thanks, removed


mullvad-update/meta/src/main.rs line 73 at r2 (raw file):

Previously, hulthe (Joakim Hulthe) wrote…

How come default_value isn't used here?

It should be. Fixed!


mullvad-update/meta/src/main.rs line 74 at r2 (raw file):

Previously, hulthe (Joakim Hulthe) wrote…

Does 1 mean 100% or 1%?

100%. Updated to clarify


mullvad-update/meta/src/main.rs line 107 at r2 (raw file):

Previously, hulthe (Joakim Hulthe) wrote…

⛏️ Imo, a help text directed towards the user shouldn't refer to them in third-person.

Suggestion:

Do not prompt for confirmation when overwriting signed files

Done.


mullvad-update/meta/src/platform.rs line 220 at r2 (raw file):

Previously, hulthe (Joakim Hulthe) wrote…

Include path in the context?

It's already logged above, so it might not be helpful here?


mullvad-update/src/format/mod.rs line 45 at r2 (raw file):

Previously, hulthe (Joakim Hulthe) wrote…

Does it make sense for this to impl default? DateTime becomes unix epoch which may not be intuitive.

That's exactly what I want! Would it be fine to simply document that?

Copy link
Contributor

@hulthe hulthe left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r3, 2 of 3 files at r4, 5 of 5 files at r5.
Reviewable status: 18 of 19 files reviewed, 1 unresolved discussion (waiting on @dlon)


mullvad-update/meta/src/platform.rs line 220 at r2 (raw file):

Previously, dlon (David Lönnhager) wrote…

It's already logged above, so it might not be helpful here?

👍


mullvad-update/src/format/mod.rs line 45 at r2 (raw file):

Previously, dlon (David Lönnhager) wrote…

That's exactly what I want! Would it be fine to simply document that?

You don't have to do anything, I was just sanity-checking :)

Copy link
Contributor

@hulthe hulthe left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 19 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dlon)


desktop/scripts/release/4-make-release line 66 at r5 (raw file):


    echo ">>> Backing up released data"
    cp -r signed/ published_signed/

Is "publish_signed" the backup? Are we publishing the backup?

@dlon dlon force-pushed the installer-downloader branch from 2aa6296 to 8faf46f Compare March 3, 2025 09:15
Copy link
Member Author

@dlon dlon left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @hulthe)


desktop/scripts/release/4-make-release line 66 at r5 (raw file):

Previously, hulthe (Joakim Hulthe) wrote…

Is "publish_signed" the backup? Are we publishing the backup?

It's a backup of the last published data that was just pulled, which is used for showing a diff in a later step. Will think of a better name :)

@dlon dlon force-pushed the upload-installer-metadata branch from d451af6 to f0a1810 Compare March 3, 2025 12:05
@dlon
Copy link
Member Author

dlon commented Mar 3, 2025

I suggest we merge this after the main PR to avoid ballooning that further.

hulthe
hulthe previously approved these changes Mar 3, 2025
Copy link
Contributor

@hulthe hulthe left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dlon)


desktop/scripts/release/4-make-release line 66 at r5 (raw file):

Previously, dlon (David Lönnhager) wrote…

It's a backup of the last published data that was just pulled, which is used for showing a diff in a later step. Will think of a better name :)

👍

@dlon dlon force-pushed the installer-downloader branch 5 times, most recently from 72e5ec9 to 3c6af55 Compare March 5, 2025 22:33
Base automatically changed from installer-downloader to main March 5, 2025 22:40
@dlon dlon dismissed hulthe’s stale review March 5, 2025 22:40

The base branch was changed.

@dlon dlon force-pushed the upload-installer-metadata branch from f0a1810 to cc40743 Compare March 5, 2025 23:05
@dlon dlon force-pushed the upload-installer-metadata branch from cc40743 to df3a550 Compare March 5, 2025 23:09
Copy link
Contributor

@MarkusPettersson98 MarkusPettersson98 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 4 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dlon)

@dlon dlon merged commit 319589b into main Mar 6, 2025
58 of 59 checks passed
@dlon dlon deleted the upload-installer-metadata branch March 6, 2025 08:09
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