-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update enershare tsg client from develop See merge request cpes/european-projects/enershare/tsg-client!85
- Loading branch information
Showing
7 changed files
with
403 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,61 @@ | ||
# You can override the included template(s) by including variable overrides | ||
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings | ||
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/pipeline/#customization | ||
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings | ||
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings | ||
# Note that environment variables can be set in several places | ||
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence | ||
stages: | ||
- lint | ||
- test | ||
- deploy | ||
|
||
- lint | ||
- test | ||
- deploy | ||
ruff: | ||
image: | ||
name: python:3.9-slim-bookworm | ||
entrypoint: [ "/usr/bin/env" ] | ||
entrypoint: | ||
- "/usr/bin/env" | ||
stage: lint | ||
before_script: | ||
- pip install poetry | ||
- poetry install | ||
- source "$(poetry env info --path)/bin/activate" || exit 1 | ||
script: | ||
- ruff check . | ||
|
||
- ruff check . | ||
unit_tests: | ||
image: | ||
name: python:3.9-slim-bookworm | ||
entrypoint: [ "/usr/bin/env" ] | ||
entrypoint: | ||
- "/usr/bin/env" | ||
stage: test | ||
before_script: | ||
- pip install poetry | ||
- poetry install | ||
- pip install poetry | ||
- poetry install | ||
script: | ||
- poetry run pytest unittests/ | ||
|
||
- poetry run pytest unittests/ | ||
mirror_to_github: | ||
stage: deploy | ||
image: docker | ||
variables: | ||
GIT_STRATEGY: clone | ||
only: | ||
- main | ||
- main | ||
script: | ||
- apk add --no-cache git | ||
- cd $CI_PROJECT_DIR # Navigate to the project directory | ||
- git checkout main | ||
- LAST_COMMIT_MSG=$(git log --format=%B -n 1) | ||
- LAST_COMMIT_NAME=$(git log -1 --pretty=format:'%an') | ||
- LAST_COMMIT_EMAIL=$(git log -1 --pretty=format:'%ae') | ||
|
||
- git clone https://oauth2:${GITHUB_TOKEN}@github.com/CPES-Power-and-Energy-Systems/tsg-client.git github | ||
- rm -rf .git | ||
- mv github/.git .git | ||
- rm -rf github | ||
- git add -A | ||
- git config user.email "$LAST_COMMIT_EMAIL" | ||
- git config user.name "$LAST_COMMIT_NAME" | ||
- git commit -m "$LAST_COMMIT_MSG" | ||
- git push | ||
- apk add --no-cache git | ||
- cd $CI_PROJECT_DIR | ||
- git checkout main | ||
- LAST_COMMIT_MSG=$(git log --format=%B -n 1) | ||
- LAST_COMMIT_NAME=$(git log -1 --pretty=format:'%an') | ||
- LAST_COMMIT_EMAIL=$(git log -1 --pretty=format:'%ae') | ||
- git clone https://oauth2:${GITHUB_TOKEN}@github.com/CPES-Power-and-Energy-Systems/tsg-client.git | ||
github | ||
- rm -rf .git | ||
- mv github/.git .git | ||
- rm -rf github | ||
- git add -A | ||
- git config user.email "$LAST_COMMIT_EMAIL" | ||
- git config user.name "$LAST_COMMIT_NAME" | ||
- git commit -m "$LAST_COMMIT_MSG" | ||
- git push | ||
include: | ||
- template: Security/Dependency-Scanning.gitlab-ci.yml | ||
- template: Security/Secret-Detection.gitlab-ci.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
Example - Generate a contract that can be used to post artifacts | ||
Last update: 2024-05-25 | ||
The following operations are demonstrated: | ||
1. Generate the contract | ||
Ensure that the required parameters are specified before executing the request: | ||
- id: The id of the user (username). | ||
- new_password: The new secret and secure password. | ||
- new_roles: The new list of roles this user should have. (optional) | ||
""" | ||
|
||
|
||
if __name__ == "__main__": | ||
import uuid | ||
from tsg_client.utils.contracts import update_and_save_contract | ||
|
||
contract_id = str(uuid.uuid4()) | ||
contract_start = "2024-01-01T00:00:00.000+00:00" | ||
contract_end = "2024-12-31T00:00:00.000+00:00" | ||
|
||
update_and_save_contract( | ||
contract_id, | ||
contract_start, | ||
contract_end | ||
) |
Oops, something went wrong.