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

chore: add a renovate rule for handling uds versions from upstream ones #359

Merged
merged 6 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions config/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,22 @@
],
"datasourceTemplate": "npm"
},
// Matches specified datasources where a uds.x package version needs to be updated from an upstream source
{
"fileMatch": [".*\\.ya?ml$"],
"matchStringsStrategy": "recursive",
"matchStrings": [
// Test: https://regex101.com/r/a7CxKB/1
"# renovate-uds: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?( extractVersion=(?<extractVersion>.*?))?( registryUrl=(?<registryUrl>.*?))?\\s.*:\\s*['\"]?[v0-9].*?['\"]?(\\s|$)",
// Test: https://regex101.com/r/TIh2K7/1
":\\s*['\"]?[v0-9].*?['\"]?(\\s|$)",
// Test: https://regex101.com/r/euvVHz/1
"(?<currentValue>[v0-9][^\\n\\\"\\s]*)-uds\\.\\d+"
],
"autoReplaceStringTemplate": "{{{newValue}}}-uds.0",
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver-coerced{{/if}}",
"extractVersionTemplate": "{{#if extractVersion}}{{{extractVersion}}}{{else}}^(?<version>.*)${{/if}}"
},
// Matches specified datasources where a colon separates the version on the following line (i.e. https://github.com/defenseunicorns/zarf/blob/7e91d3b9823b52fe6d0f563d692c8af57faa6005/examples/big-bang/zarf.yaml#L5)
{
"fileMatch": [".*\\.ya?ml$"],
Expand Down
12 changes: 6 additions & 6 deletions releaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

flavors:
- name: upstream
# renovate: datasource=docker depName=nginx versioning=semver-coerced
version: 1.27.3
# renovate-uds: datasource=docker depName=nginx
version: 1.27.3-uds.0
- name: registry1
# renovate: datasource=docker depName=registry1.dso.mil/ironbank/opensource/nginx/nginx versioning=semver-coerced
version: 1.27.3
# renovate-uds: datasource=docker depName=registry1.dso.mil/ironbank/opensource/nginx/nginx
version: 1.27.3-uds.0
- name: unicorn
# renovate: datasource=docker depName=cgr.dev/du-uds-defenseunicorns/nginx versioning=semver-coerced
version: 1.27.3
# renovate-uds: datasource=docker depName=cgr.dev/du-uds-defenseunicorns/nginx
version: 1.27.3-uds.0
2 changes: 0 additions & 2 deletions tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,3 @@ tasks:

- description: Publish the packages
task: publish:package
with:
version: ${VERSION}
2 changes: 1 addition & 1 deletion tasks/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tasks:
default: .
version:
description: The version of the package to publish
required: true
default: ${VERSION}
architecture:
description: The architecture of the package to publish
default: ${UDS_ARCH}
Expand Down
3 changes: 3 additions & 0 deletions tasks/upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ tasks:

# VARIABLES
PACKAGE_NAME=$(cat ${{ .inputs.path }}/zarf.yaml | ./uds zarf tools yq .metadata.name)
LOCAL_VERSION=$(cat ${{ .inputs.path }}/zarf.yaml | ./uds zarf tools yq .metadata.version)
LATEST_VERSION=$(./uds zarf tools registry ls "${TARGET_REPO}/${PACKAGE_NAME}" | grep "${FLAVOR}" | sort -V | tail -1)
BUNDLE_NAME=$(cat ${{ .inputs.bundle_path }}/uds-bundle.yaml | ./uds zarf tools yq .metadata.name)
PREVIOUS_BUNDLE_VERSION=$(cat ${{ .inputs.bundle_path }}/uds-bundle.yaml | ./uds zarf tools yq .metadata.version)
Expand All @@ -82,6 +83,8 @@ tasks:
--no-progress \
-o ${{ .inputs.path }}

mv "${{ .inputs.path }}/zarf-package-${PACKAGE_NAME}-${{ .inputs.architecture }}-${LATEST_VERSION%-*}.tar.zst" "${{ .inputs.path }}/zarf-package-${PACKAGE_NAME}-${{ .inputs.architecture }}-${LOCAL_VERSION}.tar.zst"

# Run any dependency commands (i.e. uds run dependencies:create)
sh -c "${{ .inputs.dep_commands }}"

Expand Down
Loading