Skip to content

Run find package & register and download & register as single command#1919

Open
david-staniec-octopus wants to merge 4 commits into
mainfrom
ds/registrationChanges
Open

Run find package & register and download & register as single command#1919
david-staniec-octopus wants to merge 4 commits into
mainfrom
ds/registrationChanges

Conversation

@david-staniec-octopus
Copy link
Copy Markdown
Contributor

@david-staniec-octopus david-staniec-octopus commented May 8, 2026

The find package and download package commands do not register the package; this is done via a separate register command.

It is possible for other deployments to remove the packages via package retention prior to them being registered. Therefore, this PR introduces Find and Register Package and Download and Register package commands. There has been some refactoring to make the code common between the original commands and the new command, in order to address risk of divergence.

Server changes are required to use the new commands, but the existing commands will continue working without corresponding Server changes.

⚠️ Does this change require a corresponding Server Change?
⚠️ If so - please add a "Requires Server Change" label to this PR!

@david-staniec-octopus david-staniec-octopus force-pushed the ds/registrationChanges branch 9 times, most recently from edea829 to 7d77313 Compare May 15, 2026 05:54
@david-staniec-octopus david-staniec-octopus changed the title Spike test to run find / register and download / register as single c… Tun find package & register and download & register as single command May 18, 2026
@david-staniec-octopus david-staniec-octopus changed the title Tun find package & register and download & register as single command Run find package & register and download & register as single command May 18, 2026
@david-staniec-octopus david-staniec-octopus marked this pull request as ready for review May 19, 2026 05:38
Copy link
Copy Markdown
Contributor

@Jtango18 Jtango18 left a comment

Choose a reason for hiding this comment

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

Nothing particular scary or problematic in here to my 👀

Comment on lines +18 to +19
readonly static string tentacleHome = TestEnvironment.GetTestPath("temp", "FindAndRegisterPackage");
readonly static string downloadPath = Path.Combine(tentacleHome, "Files");
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.

I have a visceral reaction to statics in tests

[OneTimeSetUp]
public void TestFixtureSetUp()
{
Environment.SetEnvironmentVariable("TentacleHome", tentacleHome);
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.

OMG, 😢

well I guess this is how it is.

result.AssertFoundPackageServiceMessage();

// Verify package was registered with the journal
result.AssertOutput("Registered package use/lock for {0} v{1} and task ServerTasks-12345", packageId, packageVersion);
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.

Is it possible to instead assert that the package is indeed locked?

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.

See latest commit, I had some issues with reading from the repository (we don't seem to have similar tests for the existing register package command). I've fallen back on reading the JSON from the package cache I can see being written to the file system - thoughts?

[SetUp]
public void SetUp()
{
if (!Directory.Exists(TentacleHome))
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.

Should we clear this in the setup so it is cleared on every test run?

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.

Sure, not a bad idea. It's in the latest commit.

@LukeButters
Copy link
Copy Markdown
Contributor

It looks like the race condition remains between download/find and the following registration. What this PR does is significantly reduce the time between those two operations reducing the changes of someone cleaning up the package we just got.

If we had more time we would also ensure that the cleanup operation never deletes files downloaded within the last few seconds.

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