-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to validate versions.json and test deprecated tags (#8)
* Add workflow to test deprecated tags * Run workflow when it changes * Try fixing * Debugging jq issues * Fix workflow * Add versions.schema.json * Validate json against schema * Add dependency * Fix schema * Change to draft-04 schema
- Loading branch information
Showing
2 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Test versions.json | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
paths: | ||
- versions.json | ||
- versions.schema.json | ||
- .github/workflows/test-deprecated-tags.yml | ||
|
||
jobs: | ||
validate_json: | ||
name: Validate json against schema | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.13' | ||
- run: pip install json-spec | ||
- run: json validate --schema-file=versions.schema.json --document-file=versions.json | ||
|
||
get_deprecated_tags: | ||
name: Get deprecated version latest tags | ||
runs-on: ubuntu-latest | ||
needs: validate_json | ||
outputs: | ||
deprecatedVersionLatestTags: ${{ steps.tags.outputs.latestTags }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: parse versions.json | ||
id: tags | ||
run: | | ||
deprecatedLatestTags=$(jq -c "[.deprecations | to_entries | .[].value.latestTag]" versions.json) | ||
echo "latestTags=$deprecatedLatestTags" >> $GITHUB_OUTPUT | ||
echo "latestTags=$deprecatedLatestTags" | ||
test_docker_pull: | ||
name: Test via docker pull | ||
runs-on: ubuntu-latest | ||
needs: get_deprecated_tags | ||
strategy: | ||
matrix: | ||
latestTag: ${{ fromJSON(needs.get_deprecated_tags.outputs.deprecatedVersionLatestTags) }} | ||
|
||
steps: | ||
- name: Log Inputs | ||
run: | | ||
echo "Deprecated Version Latest Tag: ${{ matrix.latestTag }}" | ||
- name: Attempt Docker Pull | ||
run: | | ||
docker pull octopusdeploy/kubernetes-agent-tools-base:${{matrix.latestTag}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"description": "kubernetes-agent-tools-base versions", | ||
"type": "object", | ||
"properties": { | ||
"tools": { | ||
"type": "object", | ||
"properties": { | ||
"kubectl": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"helm": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"powershell": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"kubectl", | ||
"helm", | ||
"powershell" | ||
] | ||
}, | ||
"latest": { | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 4 | ||
}, | ||
"revisionHash": { | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 6 | ||
}, | ||
"deprecations": { | ||
"type": "object", | ||
"pattenProperties": { | ||
".*": { | ||
"type": "object", | ||
"properties": { | ||
"latestTag": { | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
}, | ||
"required": [ | ||
"latestTag" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"tools", | ||
"latest", | ||
"revisionHash", | ||
"deprecations" | ||
] | ||
} |