https://github.com/andersonshatch/redirect-java-agent
Generate redirects to the Java agent on Maven Central
https://github.com/andersonshatch/redirect-java-agent
Last synced: 12 months ago
JSON representation
Generate redirects to the Java agent on Maven Central
- Host: GitHub
- URL: https://github.com/andersonshatch/redirect-java-agent
- Owner: andersonshatch
- Created: 2023-06-08T10:35:26.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-09T15:43:59.000Z (almost 3 years ago)
- Last Synced: 2024-12-29T06:09:22.561Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 32.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Redirect to Contrast Java Agent
Utility script to update Azure Static Web App site redirects to the very latest and latest major versions of `com.contrastsecurity:contrast-agent` on Maven Central.
Files in the `publish` directory are made available on the deployed site.
## Requirements
- Python 3.11 or newer
## Usage
### Inputs
The script reads in an environment variable `NEW_VERSION_URL`.
The value of this environment variable should be the full URL to the download of that version of contrast-agent, e.g. https://repo1.maven.org/maven2/com/contrastsecurity/contrast-agent/5.1.2/contrast-agent-5.1.2.jar
The version is extracted from the first path segment containing a version string; in the above example, from `/5.1.2/`.
This version is checked against existing redirects to versions in `staticwebapp.config.json`.
If a redirect is already present for major version 5, that destination is replaced with the new URL. Else, a new major version redirect will be added to the list.
If the major version to be updated is the current latest major version, or a new major version, the `latest` redirect destination will also be updated to the new URL.
### GitHub Action
The GitHub Action workflow `main.yml` takes in a `new_version_url` input from either manual trigger (via GitHub UI/API), or via repository_dispatch event from another repository.
This version input is used to update the redirects in `staticwebapp.config.json`, and a PR is then opened so the changes can be reviewed. When the PR is merged, the deployment is triggered.
### Local testing / development
1. `pip install -r requirements.txt`
1. `NEW_VERSION_URL=https://new-version-url/111.222.333/contrast-agent-111.222.333.jar python redirect.py`