Henrik/version (#283)

* expose version

* add release description

* Add release from tag functionality

* Testing version->release tagging

* build on tag, release a2

* Stick to manual relase to simplify things

* Tag from release

* bump version just to be sure..

* releases uses tags...

* Make this version 0.1.0
This commit is contained in:
Henrik Brodin
2025-03-27 16:50:03 +01:00
committed by GitHub
parent 2cc3e15671
commit b826cd839e
3 changed files with 56 additions and 6 deletions
+1
View File
@@ -54,6 +54,7 @@ jobs:
tags: |
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
+48 -3
View File
@@ -41,6 +41,53 @@ BUTTERCUP_TASK_SERVER_RELOAD=true
BUTTERCUP_TASK_SERVER_WORKERS=4
```
## Version Management
The project uses hatchling for version management. The version is stored in `pyproject.toml` and is automatically used by the server's status endpoint.
To bump the version:
1. Edit the version in `pyproject.toml`:
```toml
[project]
version = "0.1.0" # Update this line
```
2. The version will be automatically picked up by the server's status endpoint and API version.
## Releasing a New Version
To create a new release:
1. Update the version in `pyproject.toml` as described in the Version Management section above.
2. Create and push a tag matching the version:
```bash
git tag v0.1.0 # Replace with your version
git push origin v0.1.0
```
3. Manually create a new release on GitHub:
- Go to the repository's "Releases" page
- Click "Create a new release"
- Select the tag you just created
- Fill in the release title and description
- Click "Publish release"
Once the release is created, the CI will automatically:
- Build and publish Docker images for all components with the new version
- Tag the images with both the full version and major.minor version
- Push the images to GitHub Container Registry (ghcr.io)
> **Note**: If you encounter a "tag is needed when pushing to registry" error during the Docker build, this indicates an issue with the Docker workflow configuration. The workflow needs to be updated to properly set the image tags using the metadata action's output. This is typically fixed by ensuring the `tags` parameter in the `docker/metadata-action` step includes `type=ref,event=release` in its configuration. The current configuration only includes branch, PR, and semver patterns.
The Docker images will be available at:
```
ghcr.io/<repository-owner>/buttercup-orchestrator:<version>
ghcr.io/<repository-owner>/buttercup-fuzzer:<version>
ghcr.io/<repository-owner>/buttercup-patcher:<version>
ghcr.io/<repository-owner>/buttercup-seed-gen:<version>
ghcr.io/<repository-owner>/buttercup-program-model:<version>
```
### Task Server
Provides the REST API the competition API will contact to submit new tasks for Buttercup to process.
Implemented with FastAPI and based on the automatically generated code from the Swagger definitions.
@@ -80,6 +127,4 @@ To update the apis to a newer version, run the following script:
```shell
make update-apis
```
from the orchestrator directory.
from the orchestrator directory.
@@ -6,6 +6,7 @@ from __future__ import annotations
from typing import Annotated, Optional
from uuid import UUID
import importlib.metadata
from argon2 import PasswordHasher, Type
from argon2.exceptions import VerifyMismatchError
@@ -31,11 +32,15 @@ logger.info("Competition API URL: %s", settings.competition_api_url)
logger.info("Competition API Key ID: %s", settings.competition_api_username)
logger.info("API Key ID: %s", settings.api_key_id)
try:
__version__ = importlib.metadata.version("orchestrator")
except importlib.metadata.PackageNotFoundError:
__version__ = "0.0.0"
app = FastAPI(
title="Buttercup CRS API",
contact={},
version="0.3",
version=__version__,
servers=[{"url": "/"}],
log_config=None,
)
@@ -169,8 +174,7 @@ def get_status_(
waiting=0,
)
state = StatusState(tasks=tasks)
version = "0.3"
return Status(details=details, ready=ready, since=0, state=state, version=version)
return Status(details=details, ready=ready, since=0, state=state, version=__version__)
@app.delete("/status/", response_model=str, tags=["status"])