NASA-PDS / roundup-action

Do a "roundup", a/k/a PDS-style continuous integration and delivery
Apache License 2.0
1 stars 4 forks source link

Roundup handles Git operations differently between Maven and Python repositories #92

Open nutjob4life opened 1 year ago

nutjob4life commented 1 year ago

🐛 Describe the bug

While implementing #90, I discovered that the git operations performed by the Roundup Action in Maven and Python repositories have drifted apart.

For example, the "version bump" step for Python does

git push origin HEAD:main --force

while the Maven "version bump" step does

git push origin HEAD:main

The "GitHub release" step similarly differs in its handling, as does the "repo cleanup" step.

The Roundup Action uses the abstract factory design pattern to create Step objects appropriate to the Roundup. But it should also use the template method design pattern so that the git steps are identical between repository instances. For example, it could look like this (demonstrating two of the steps):

classDiagram
Step <|-- VersionBumpingStep
Step <|-- GitHubReleaseStep
GitHubReleaseStep <|-- PythonGitHubReleaseStep
GitHubReleaseStep <|-- MavenGitHubReleaseStep
VersionBumpingStep <|-- PythonVersionBumpingStep
VersionBumpingStep <|-- MavenVersionBumpingStep
Step: +execute()
VersionBumpingStep: +execute()
GitHubReleaseStep: +execute()
VersionBumpingStep: #write_version_files
MavenVersionBumpingStep: #write_version_iles
PythonVersionBumpingStep: #write_version_files
GitHubReleaseStep: #get_snapshot_tag_pattern
PythonGitHubReleaseStep: #get_snapshot_tag_pattern
MavenGitHubReleaseStep: #get_snapshot_tag_pattern
GitHubReleaseStep: #execute_pds_github_util
PythonGitHubReleaseStep: #execute_pds_github_util
MavenGitHubReleaseStep: #execute_pds_github_util

🕵️ Expected behavior

git operations should identical between Maven and Python repositories.

📚 Version of Software Used

Current stable.

🩺 Test Data / Additional context


🦄 Related requirements

⚙️ Engineering Details

jordanpadams commented 1 year ago

@nutjob4life how would you propose we fix this? should we update the commit commands for python?

nutjob4life commented 1 year ago

@jordanpadams as mentioned in the bug report, I'd use the template method design pattern. (I should've used it in the first place.)

"Template method" lets a superclass dictate the structure of an algorithm while subclasses can provide context-specific needs. The git commands would be in the superclass while the Maven-specific or Python-specific parts would be in each subclass.

jordanpadams commented 1 year ago

@nutjob4life copy. will add this to the icebox for now. I think this is a good idea, but as you mentioned elsewhere, if we use Harness for some of this, it may all change.