Add force_overwrite parameter

This commit is contained in:
Benjamin Renard 2023-07-19 19:25:29 +02:00
parent e7b4cfda7a
commit 5aa1664636
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC
2 changed files with 9 additions and 1 deletions

View file

@ -42,6 +42,7 @@ pipeline:
path: dist
source_name: myproject
max_retries: 2
force_overwrite: true
```
__Parameters:__
@ -54,6 +55,7 @@ __Parameters:__
- __path:__ Path to the directory where files to publish are stored (optional, default: `dist`)
- __source_name:__ Name of the source package to publish (optional, default: all `changes` files are will be publish)
- __max_retries:__ The number of retry in case of error calling the Aptly API (optional, default: no retry)
- __force_overwrite:__ When publishing, overwrite files in `pool/` directory without notice (optional, default: false)
## With Gitlab CI
@ -89,6 +91,7 @@ publish:
APTLY_PATH: "dist"
APTLY_SOURCE_NAME: "myproject"
APTLY_MAX_RETRIES: 2
APTLY_FORCE_OVERWRITE: true
script:
- echo "Publish Bullseye debian packages on APT repository..."
- aptly-publish

View file

@ -47,6 +47,10 @@ PREFIX = from_env('PREFIX', '.')
REPO_COMPONENT = from_env('REPO_COMPONENT', 'main')
INPUT_PATH = from_env('PATH', 'dist')
SOURCE_NAME = from_env('SOURCE_PACKAGE_NAME', None)
FORCE_OVERWRITE = (
from_env('FORCE_OVERWRITE', "false").lower()
in ["1", "true", "yes"]
)
# List changes files
changes_files_regex = (
@ -288,7 +292,8 @@ for changes_file in changes_files:
'Component': REPO_COMPONENT,
'Name': snap_name
}
]
],
'ForceOverwrite': FORCE_OVERWRITE,
}
result = session.put(url, json=payload)
if (