Skip to content
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
6 changes: 0 additions & 6 deletions .env.sample

This file was deleted.

1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @softwareone-platform/sirius
39 changes: 39 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: 2
updates:
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "08:00"
timezone: "UTC"
versioning-strategy: "auto"
groups:
python-production:
dependency-type: "production"
python-development:
dependency-type: "development"
commit-message:
prefix: "deps"
include: "scope"
open-pull-requests-limit: 5
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
time: "08:00"
timezone: "UTC"
commit-message:
prefix: "deps"
include: "scope"
open-pull-requests-limit: 5
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
time: "08:00"
timezone: "UTC"
commit-message:
prefix: "deps"
include: "scope"
open-pull-requests-limit: 5
2 changes: 1 addition & 1 deletion .github/workflows/danger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
danger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-build-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0

Expand All @@ -30,7 +30,7 @@ jobs:
run: docker compose build app_test

- name: "Run validation & test"
run: docker compose run --service-ports app_test
run: docker compose run app_test

- name: "Run SonarCloud Scan"
uses: SonarSource/sonarqube-scan-action@master
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ jobs:
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> "$GITHUB_OUTPUT"

- name: "Build and push image"
uses: azure/docker-login@v1
uses: azure/docker-login@v2
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
docker build -f prod.Dockerfile -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/swo-extensions-playground:${{ steps.get_version.outputs.VERSION }} .
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/swo-extensions-playground:${{ steps.get_version.outputs.VERSION }}
docker build -f prod.Dockerfile -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/mpt-tool:${{ steps.get_version.outputs.VERSION }} .
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/mpt-tool:${{ steps.get_version.outputs.VERSION }}

dtrack:
uses: softwareone-platform/ops-template/.github/workflows/dependency-track-python-uv.yml@v1
uses: softwareone-platform/ops-template/.github/workflows/dependency-track-python-uv.yml@v2
with:
projectName: 'swo-extension-playground'
projectName: 'mpt-tool'
secrets:
DEPENDENCYTRACK_APIKEY: ${{ secrets.DEPENDENCYTRACK_APIKEY }}
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.11
rev: v0.14.10
hooks:
- id: ruff-check
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-merge-conflict
- id: check-yaml
Expand All @@ -18,7 +18,7 @@ repos:
- id: detect-private-key

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.7.21
rev: 0.9.20
hooks:
- id: uv-lock

Expand All @@ -29,7 +29,7 @@ repos:
additional_dependencies: [Flake8-pyproject, Flake8-AAA, wemake-python-styleguide==1.3.*]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.17.0
rev: v1.19.1
hooks:
- id: mypy
args: ["--config-file=pyproject.toml", "."]
Expand Down
95 changes: 5 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,9 @@
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=softwareone-platform_swo-extension-playground&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=softwareone-platform_swo-extension-playground)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=softwareone-platform_swo-extension-playground&metric=coverage)](https://sonarcloud.io/summary/new_code?id=softwareone-platform_swo-extension-playground)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=softwareone-platform_mpt-tool&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=softwareone-platform_mpt-tool)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=softwareone-platform_mpt-tool&metric=coverage)](https://sonarcloud.io/summary/new_code?id=softwareone-platform_mpt-tool)

[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

# SoftwareONE Extension playground
# SoftwareONE MPT Tool

Playground Extension with the SoftwareONE Marketplace

# Run tests

```
$ docker-compose build app_test
$ docker-compose run --service-ports app_test
```

# Local run using SoftwareONE Marketplace API

## Create configuration files

1. Create environment file

```
$ cp .env.sample .env
```

1. Setup parameters for `.env` file

```
MPT_PRODUCTS_IDS=PRD-1111-1111
MPT_PORTAL_BASE_URL=http://devmock:8000
MPT_API_BASE_URL=http://devmock:8000
MPT_API_TOKEN=<vendor-api-token>
MPT_ORDERS_API_POLLING_INTERVAL_SECS=120
EXT_WEBHOOKS_SECRETS={"PRD-1111-1111": "<super-jwt-secret>"}
MPT_INITIALIZER="swo_playground.initializer.initialize"
MPT_KEY_VAULT_NAME=""
MPT_NOTIFY_CATEGORIES={"ORDERS": "NTC-0000-0006"}
```

`MPT_PRODUCTS_IDS` should be a comma-separated list of the SWO Marketplace Product identifiers
For each of the defined product id in the `MPT_PRODUCTS_IDS` list define `WEBHOOKS_SECRETS` json variables using product
ID as key.

```
EXT_WEBHOOKS_SECRETS={"PRD-1111-1111": "<webhook-secret-for-product>"}
```

Example of `.env` file

```
MPT_PRODUCTS_IDS=PRD-1111-1111
MPT_PORTAL_BASE_URL=http://devmock:8000
MPT_API_BASE_URL=http://devmock:8000
MPT_API_TOKEN=<vendor-api-token>
MPT_ORDERS_API_POLLING_INTERVAL_SECS=120
EXT_WEBHOOKS_SECRETS={"PRD-1111-1111": "<super-jwt-secret>"}
MPT_INITIALIZER="swo_playground.initializer.initialize"
MPT_KEY_VAULT_NAME=""
MPT_NOTIFY_CATEGORIES={"ORDERS": "NTC-0000-0006"}
```

```


## Build and run extension

1. Build and run the extension
```

$ docker-compose build app
$ docker-compose run --service-ports app

```

# Configuration

## Application
| Environment Variable | Default | Example | Description |
|---------------------------------|-----------------------|----------------------------------------|-------------------------------------------------------------------------------------------|
| `EXT_WEBHOOKS_SECRETS` | - | {"PRD-1111-1111": "123qweasd3432234"} | Webhook secret of the Draft validation Webhook in SoftwareONE Marketplace for the product |
| `MPT_PRODUCTS_IDS` | PRD-1111-1111 | PRD-1234-1234,PRD-4321-4321 | Comma-separated list of SoftwareONE Marketplace Product ID |
| `MPT_API_BASE_URL` | http://localhost:8000 | https://portal.softwareone.com | SoftwareONE Marketplace API URL |
| `MPT_API_TOKEN` | - | eyJhbGciOiJSUzI1N... | SoftwareONE Marketplace API Token |
| `MPT_INITIALIZER` | - | swo_playground.initializer.initialize | Initializer function |
| `MPT_NOTIFY_CATEGORIES` | - | {"ORDERS": "NTC-0000-0006"} | Notify categories for the orders |
| `MPT_KEY_VAULT_NAME` | - | swo-playground-kv | Key Vault name |
| `MPT_PORTAL_BASE_URL` | http://localhost:8000 | https://portal.softwareone.com | SoftwareONE Marketplace Portal URL |


## Other
| Environment Variable | Default | Example | Description |
|----------------------------------------|---------|---------|----------------------------------------------------------------------|
| `MPT_ORDERS_API_POLLING_INTERVAL_SECS` | 120 | 60 | Orders polling interval from the Software Marketplace API in seconds |
A Python-based migration tool for extensions that standardizes migration execution. It provides a CLI-based interface
to manage both schema and data migrations across multiple backends, ensuring consistent behavior in all environments.
6 changes: 3 additions & 3 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim

COPY . /extension
WORKDIR /extension
COPY . /mpt_tool
WORKDIR /mpt_tool

RUN uv venv /opt/venv

Expand All @@ -10,4 +10,4 @@ ENV PATH=/opt/venv/bin:$PATH

RUN uv sync --frozen --no-cache --all-groups --active

CMD ["swoext", "run", "--no-color"]
CMD ["bash"]
46 changes: 10 additions & 36 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,30 @@
services:
app:
container_name: ext_playground
container_name: mpt_tool
build:
context: .
dockerfile: prod.Dockerfile
working_dir: /extension
command: swoext run --no-color
working_dir: /mpt_tool
volumes:
- .:/extension
env_file:
- .env
ports:
- "8080:8080"
expose:
- "8080"

bash:
container_name: ext_playground_bash
build:
context: .
dockerfile: dev.Dockerfile
working_dir: /extension
command: bash
stdin_open: true
tty: true
volumes:
- .:/extension
env_file:
- .env
- .:/mpt_tool

app_test:
container_name: ext_playground_test
container_name: mpt_tool_test
build:
context: .
dockerfile: dev.Dockerfile
working_dir: /extension
working_dir: /mpt_tool
command: bash -c "ruff format --check . && ruff check . && flake8 . && mypy . && uv lock --check && pytest"
volumes:
- .:/extension
environment:
- PROCESS_CHECK_INTERVAL_SECS=0
env_file:
- .env
- .:/mpt_tool


format:
container_name: ext_playground_format
container_name: mpt_tool_format
build:
context: .
dockerfile: dev.Dockerfile
working_dir: /extension
working_dir: /mpt_tool
command: bash -c "ruff check --select I --fix . && ruff format ."
volumes:
- .:/extension
env_file:
- .env
- .:/mpt_tool
File renamed without changes.
6 changes: 3 additions & 3 deletions prod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim

COPY . /extension
WORKDIR /extension
COPY . /mpt_tool
WORKDIR /mpt_tool

RUN uv venv /opt/venv

Expand All @@ -10,4 +10,4 @@ ENV PATH=/opt/venv/bin:$PATH

RUN uv sync --frozen --no-cache --all-groups --active

CMD ["swoext", "run", "--no-color"]
CMD ["bash"]
Loading