Skip to content

Add Galaxy overwrite check and use gh for release#357

Merged
lowlydba merged 4 commits into
mainfrom
356-chore-automate-more-release-process
Apr 12, 2026
Merged

Add Galaxy overwrite check and use gh for release#357
lowlydba merged 4 commits into
mainfrom
356-chore-automate-more-release-process

Conversation

@lowlydba
Copy link
Copy Markdown
Owner

@lowlydba lowlydba commented Apr 12, 2026

Description

  • Added a new overwrite_existing boolean input to the release workflow, allowing users to overwrite an existing Galaxy release if needed. The workflow now checks if the specified version already exists and aborts unless overwriting is explicitly enabled.

  • Added a validation step to ensure the input version matches the version specified in galaxy.yml, preventing accidental mismatches during release.

  • Improved artifact handling by uploading the built collection as a workflow artifact after publishing to Galaxy.

  • Replaced the use of the softprops/action-gh-release action with a direct gh release create command for creating GitHub releases, simplifying the release step and reducing dependencies.

  • Updated the local_pwsh.py test connection plugin to dynamically locate the pwsh executable using shutil.which, with platform-specific fallbacks, making the test setup more robust across different environments.

    • This fixes the broken dlevel tests - apparently the pwsh install directory is more of a moving target these days than when it first came out, so using dynamic resolution is needed as of 2.21+

How Has This Been Tested?

Types of changes

Checklist:

Add a new boolean workflow input overwrite_existing (default false) and expose it as OVERWRITE_EXISTING. Add a step that checks whether the specified VERSION tarball already exists on Ansible Galaxy (sets step output exists) and a conditional step that aborts the run unless overwrite_existing=true. Replace the softprops/action-gh-release step with a gh CLI release create invocation that uses VERSION and RELEASE_DESCRIPTION. These changes prevent accidental duplicate Galaxy publishes and allow explicit overwriting while simplifying release creation.
@lowlydba lowlydba linked an issue Apr 12, 2026 that may be closed by this pull request
Use shutil.which('pwsh') to locate the pwsh executable dynamically, falling back to platform-specific defaults (/usr/local/bin/pwsh on macOS, /usr/bin/pwsh otherwise) if not found. This improves portability across different environments and CI runners where pwsh may be installed in non-standard locations.
@lowlydba lowlydba marked this pull request as ready for review April 12, 2026 16:17
Copilot AI review requested due to automatic review settings April 12, 2026 16:17
@lowlydba lowlydba merged commit 8d5706b into main Apr 12, 2026
22 checks passed
@lowlydba lowlydba deleted the 356-chore-automate-more-release-process branch April 12, 2026 16:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the project’s release automation and integration test tooling by enhancing the GitHub Actions release workflow (Galaxy prechecks, artifact upload, gh-based GitHub release creation) and making the local_pwsh connection plugin more robust by dynamically locating the pwsh executable.

Changes:

  • Add release workflow preflight checks (Galaxy version existence + galaxy.yml version match) and an overwrite_existing input gate.
  • Upload the built collection tarball as a workflow artifact after publishing.
  • Replace softprops/action-gh-release with gh release create for GitHub release creation.
  • Update the local_pwsh test connection plugin to resolve pwsh via shutil.which() with platform fallbacks.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/integration/targets/setup_sqlserver_test_plugins/connection_plugins/local_pwsh.py Resolve pwsh dynamically to avoid hard-coded install paths breaking tests on newer environments.
.github/workflows/release.yml Add Galaxy/version validation logic, optional overwrite gate, artifact upload, and switch to gh for GitHub releases.

Comment on lines +62 to +67
if curl --head -s -f -o /dev/null "https://galaxy.ansible.com/download/lowlydba-sqlserver-${VERSION}.tar.gz"; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "Version ${VERSION} already exists on Galaxy"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
echo "Version ${VERSION} does not yet exist on Galaxy"
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

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

The Galaxy existence check treats any curl failure (network/DNS/timeout/5xx) the same as “version does not exist” and proceeds, which can lead to attempting a publish/release under uncertain Galaxy availability. Consider capturing the HTTP status explicitly and only treating 404 as “does not exist”; for other non-success statuses or curl transport errors, fail the job so the release isn’t created based on a false negative.

Suggested change
if curl --head -s -f -o /dev/null "https://galaxy.ansible.com/download/lowlydba-sqlserver-${VERSION}.tar.gz"; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "Version ${VERSION} already exists on Galaxy"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
echo "Version ${VERSION} does not yet exist on Galaxy"
GALAXY_URL="https://galaxy.ansible.com/download/lowlydba-sqlserver-${VERSION}.tar.gz"
if HTTP_STATUS=$(curl --head -s -o /dev/null -w "%{http_code}" "${GALAXY_URL}"); then
case "${HTTP_STATUS}" in
200)
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "Version ${VERSION} already exists on Galaxy"
;;
404)
echo "exists=false" >> "$GITHUB_OUTPUT"
echo "Version ${VERSION} does not yet exist on Galaxy"
;;
*)
echo "::error::Unexpected HTTP status ${HTTP_STATUS} while checking whether version ${VERSION} exists on Galaxy."
exit 1
;;
esac
else
echo "::error::Failed to query Galaxy for version ${VERSION}."
exit 1

Copilot uses AI. Check for mistakes.
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.

[Chore] Automate more release process [Chore] Fix broken behavior on dlevel

2 participants