bk-job-xethhung12
A command-line tool to back up local files to Azure Blob Storage, using credentials securely fetched from HashiCorp Vault.
Execution
General Help
Run through python interpreter:
python -m bk_job_xethhung12 --help
Run through python project script
bk-job-xethhung12 -h
Demo
Assuming:
- the vault server address is
https://vault.example.com - the role id is
aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee - the secret id is
gggggggg-hhhh-iiii-jjjj-kkkkkkkkkkkk - the mounting point for secret is
system-a - the path for secret is
bk/agent1 - the file to be uploaded
example.log - the remote director for the blob
bk/agent1/logs
valut_address=https://vault.example.com
role_id=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
secret_id=gggggggg-hhhh-iiii-jjjj-kkkkkkkkkkkk
mount_point=system-a
secret_path=bk/agent1
local_file=example.log
remote_dir=bk/agent1/logs
# Dry run
bk-job-xethhung --vault-address $valut_address \
--role-id $role_id \
--secret-id $secret_id \
--mount-point $mount_point \
--secret-path $secret_path \
single --local-file $local_file \
--remote-dir $remote_dir
## Expeced result as
# [BK-JOB-APACHE-LOG] [Dry Run] Would upload single file: /home/ubuntu/example.log to bk/agent1/logs/example.log
# Execute
bk-job-xethhung --vault-address $valut_address \
--role-id $role_id \
--secret-id $secret_id \
--mount-point $mount_point \
--secret-path $secret_path \
single --local-file $local_file \
--remote-dir $remote_dir \
--exec
## Expeced result as
# [BK-JOB-APACHE-LOG] Uploading single file: /home/ubuntu/example.log to bk/agent1/logs/example.log
# .
# .
# .
# [BK-JOB-APACHE-LOG] Successfully uploaded new blob 'bk/agent1/logs/example.log'.
The is antoher multipe command for uploading specified directory files, the files is filtered by regular expression through command argument --regex. For example, if the want to upload all shell script to remote blob, can pass in .*\.sh as filter.
Please be don't append the --exec argument, until you confirm the regular expression filter work perfectly as you expected.
Development
The project requires python (3+ version) installed and pip ready for use on adding manage dependencies
Tools
| Name | Platform | Type | Description |
|---|---|---|---|
| install-dependencies.sh | shell | script | The scripts for installing depencies required |
| build.sh | shell | script | The scripts for build the package |
| build-and-deploy.sh | shell | script | The scripts for build and deploy the package |
- install-dependencies.sh
The script will install dependencies listed in
dev-requirements.txtandrequirements.txt. The first requirement file contains the dependencies for development like build and deploy tools. The second requirement file defined all required dependencies for the making the package works (actual dependencies).
Useful Scripts
Project Versioning
For version update in pyproject.toml.
This project use package xh-py-project-versioning to manipulate the project version.
Simple usage includes:
Base on current version, update the patch number with dev id
python -m xh_py_project_versioning --patch
In case current version is 0.0.1, the updated version will be 0.0.2-dev+000
To prompt the dev version to official version use command.
python -m xh_py_project_versioning -r.
Through the command, version 0.0.2-dev+000 will be prompt to 0.0.2 official versioning.
Base on current version, update the patch number directly
python -m xh_py_project_versioning --patch -d
In case current version is 0.0.1, the updated version will be 0.0.2
Base on current version, update the minor number directly
python -m xh_py_project_versioning --minor -d
In case current version is 0.0.1, the updated version will be 0.1.0
Base on current version, update the minor number directly
python -m xh_py_project_versioning --minor -d
In case current version is 0.0.1, the updated version will be 1.0.0
Metadata
Release files for bk-job-xethhung12 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bk_job_xethhung12-0.0.1.tar.gz | 18.7 kB | Without provenance | Details for bk_job_xethhung12-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bk_job_xethhung12-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for bk_job_xethhung12-0.0.1-py3-none-any.whl |
Total release size: 39.3 kB
Release files / bk_job_xethhung12-0.0.1.tar.gz
| Download URL | bk_job_xethhung12-0.0.1.tar.gz |
|---|---|
| Size | 18.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e9d35d7f9c09482b61e2e1e7eec7ba8da18ceedb0d9d37630880da8c09a4cf6
|
|
BLAKE2b-256 checksum How to use checksums |
83ca7f45fda0a217b981cc90b598190f39ad01564657087b3219c1dea09c7bf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bk_job_xethhung12-0.0.1-py3-none-any.whl
| Download URL | bk_job_xethhung12-0.0.1-py3-none-any.whl |
|---|---|
| Size | 20.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12142918983bdc532ab6cba9fe24487c85b8df4f28f62e6c35f4c924bc687a27
|
|
BLAKE2b-256 checksum How to use checksums |
2408001b6fff7abb1f340c0f5e54d04b39be483ef769024fb90b864a5c06b8f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for bk-job-xethhung12 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.