Conversation
…teParser Also fix dangling references in TransformAndCommitToGitCommand left by the removed files: drop the stale CommitWorkspaceToGitRepositoryConvention AddRange block and correct pathToPackage -> packageFile so the build is clean. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Connection Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ntions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file has been superseded by inline delegates and is no longer needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…mand Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| public const string Url = "Octopus.Action.Git.TargetRepositoryUrl"; | ||
| public const string Username = "Octopus.Action.Git.TargetRepositoryUsername"; | ||
| public const string Password = "Octopus.Action.Git.TargetRepositoryPassword"; | ||
| public const string Reference = "Octopus.Action.Git.TargetRepositoryBranch"; | ||
| public const string DestinationPath = "Octopus.Action.Git.DestinationPath"; |
There was a problem hiding this comment.
The mix between target and destination confuzzled me...might be just my brain tho.
There was a problem hiding this comment.
yeah, we'' consolidate on the TargetRepository naming convention
| var dependencyNames = new List<string>(); | ||
| // we reverse the order of the array so that we maintain the order that sources at the top take higher precendences (i.e. are adding to the --values list later), | ||
| // however, within a source, the file path order must be maintained (for consistency) so that later file paths take higher precendence | ||
| foreach (var jToken in parsedJsonArray.Select((json, index) => json)) |
There was a problem hiding this comment.
Where is the reversal mentioned in the comment? Am I missing something?
There was a problem hiding this comment.
yup - stolen from another step - this is not true in this context - removed.
| this.configFactory = configFactory; | ||
| } | ||
|
|
||
| public override int Execute(string[] commandLineArguments) |
There was a problem hiding this comment.
💭 This feels like a massive method. Seems like there are 4 pieces perhaps
- The file copy
- the transformation
- the commit and
- The script substitution.
Are they worth separating out?
There was a problem hiding this comment.
yup - broke this up into separate functiuons to represent each phase
| var deployment = new RunningDeployment(pathToPackage, variables); | ||
| var baseWorkingDirectory = deployment.CurrentDirectory; | ||
| var repositoryConfig = configFactory.CreateRepositoryConfig(deployment); | ||
| var repositoryFactory = new RepositoryFactory(log, fileSystem, baseWorkingDirectory, gitVendorPullRequestClientResolver, clock); |
There was a problem hiding this comment.
don't think so - as we don't know the baseWorking directory until after the deployment is created
| var commitParams = repositoryConfig!.CommitParameters; | ||
| var updater = new RepositoryUpdater(commitParams, log, new UserDefinedCommitMessageGenerator(commitParams.Description)); | ||
|
|
||
| //TODO(tmm): This is a smell, shouldn't need the FileUpdateResult here :/ |
There was a problem hiding this comment.
Does this need to be To-Done?
There was a problem hiding this comment.
I've cleaned it up - its not great, but its better.
| var extractAllPackages = new List<IConvention> | ||
| { | ||
| //we only want to include files which are NOT explicitly referenced as dependencies (i.e. we have files which are to be copied into the repo (referenced in variable), and some which should just be used for script dependencies. | ||
| new StageDependenciesConvention(pathToPackage, fileSystem, new CombinedPackageExtractor(log, fileSystem, variables, commandLineRunner), new PackageVariablesFactory()), |
There was a problem hiding this comment.
PackageVariablesFactory() is created here and again below. Is that necessary?
There was a problem hiding this comment.
Its super light - and now that this broken out to function-per-phase, it make the dependency less simple
Jtango18
left a comment
There was a problem hiding this comment.
Mostly questions from me, but nothing too dire blocking here.
The commitToGit step is basically the script step, but is also able to copy some of the steps packages into the target git repository.
Thus, there is a single variable which contains a json blob defining which packages should be used for copying (and thus should only be substituted with non-sensitive variables).
The step executes the following in order:
Phase 1:
Phase 2:
Phase 3:
Phase 4:
Phase 5:
Phase 6: