1
1
env :
2
2
ARTIFACTORY_URL : VAULT[development/kv/data/repox data.url]
3
- ARTIFACTORY_PRIVATE_USERNAME : vault-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader
4
- ARTIFACTORY_PRIVATE_PASSWORD : VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
5
- ARTIFACTORY_DEPLOY_USERNAME : vault-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer
6
- ARTIFACTORY_DEPLOY_PASSWORD : VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer access_token]
7
- # Possible values for ARTIFACTORY_DEPLOY_REPO: sonarsource-private-qa, sonarsource-public-qa
8
- ARTIFACTORY_DEPLOY_REPO : sonarsource-public-qa
9
- REPOX_URL : VAULT[development/kv/data/repox data.url]
3
+ ARTIFACTORY_PRIVATE_ACCESS_TOKEN : VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
4
+ ARTIFACTORY_DEPLOY_USERNAME : VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer username]
5
+ ARTIFACTORY_DEPLOY_ACCESS_TOKEN : VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer access_token]
6
+ ARTIFACTORY_DEPLOY_REPO : sonarsource-pypi-public-qa
10
7
GITHUB_TOKEN : VAULT[development/github/token/licenses-ro token]
11
8
SONAR_TOKEN : VAULT[development/kv/data/sonarcloud data.token]
12
9
SONAR_HOST_URL : https://sonarcloud.io
10
+ DEPLOY_PULL_REQUEST : ' true'
11
+ POETRY_VIRTUALENVS_PATH : " .cache/poetry/venvs"
12
+ POETRY_CACHE_DIR : " .cache/poetry/pypoetry"
13
13
14
- only_sonarsource_qa : &ONLY_SONARSOURCE_QA
15
- only_if : $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && ($CIRRUS_PR != "" || $CIRRUS_BRANCH == "master" || $CIRRUS_BRANCH =~ "feature/*" || $CIRRUS_BRANCH =~ "dogfood-on-.*")
14
+ only_if : $CIRRUS_USER_COLLABORATOR == "true" && $CIRRUS_TAG == "" && ($CIRRUS_PR != "" || $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_BRANCH =~ "feature/*" || $CIRRUS_BRANCH =~ "dogfood-on-.*")
16
15
17
16
container_definition : &CONTAINER_DEFINITION
18
17
dockerfile : .cirrus/poetry.Dockerfile
19
18
cluster_name : ${CIRRUS_CLUSTER_NAME}
20
19
region : eu-central-1
21
- builder_image_name : POETRY_VM
20
+ namespace : default
21
+ builder_subnet_ids : ${CIRRUS_AWS_SUBNETS}
22
22
builder_role : cirrus-builder
23
23
builder_image : docker-builder-v*
24
24
builder_instance_type : t3.small
25
- builder_subnet_id : ${CIRRUS_AWS_SUBNET}
26
- zone : eu-central-1
27
- namespace : default
28
25
use_in_memory_disk : true
29
26
docker_arguments :
30
27
CIRRUS_AWS_ACCOUNT : ${CIRRUS_AWS_ACCOUNT}
31
- DEPLOY_PULL_REQUEST : true
32
28
cpu : 3
33
29
memory : 8G
34
30
31
+ poetry_cache_template : &POETRY_CACHE
32
+ poetry_cache :
33
+ folder : .cache/poetry/
34
+ fingerprint_script : cat poetry.lock
35
35
36
36
.poetry_template : &POETRY_TEMPLATE
37
- << : *ONLY_SONARSOURCE_QA
38
37
eks_container :
39
38
<< : *CONTAINER_DEFINITION
40
- poetry_script :
41
- - poetry config repositories.repox "${REPOX_URL}/api/pypi/sonarsource-pypi/simple/"
42
- - poetry config http-basic.repox "${ARTIFACTORY_PRIVATE_USERNAME}" "${ARTIFACTORY_PRIVATE_PASSWORD}"
43
- - poetry install
39
+ << : *POETRY_CACHE
40
+ poetry_install_script :
41
+ - source set_poetry_build_version "$CI_BUILD_NUMBER"
42
+ - echo "PROJECT_VERSION=$PROJECT_VERSION" >> $CIRRUS_ENV
43
+ - jfrog config add repox --artifactory-url "$ARTIFACTORY_URL" --access-token "$ARTIFACTORY_PRIVATE_ACCESS_TOKEN"
44
+ - jfrog poetry-config --server-id-resolve repox --repo-resolve sonarsource-pypi
45
+ - jfrog poetry install --build-name="$CIRRUS_REPO_NAME" --build-number="$CI_BUILD_NUMBER"
44
46
45
47
formatting_task :
46
48
<< : *POETRY_TEMPLATE
@@ -60,6 +62,11 @@ analysis_task:
60
62
analysis_script :
61
63
- poetry run pytest --cov-report=xml:coverage.xml --cov-config=pyproject.toml --cov=src --cov-branch tests
62
64
- sonar-scanner -Dsonar.organization=sonarsource -DbuildNumber=${CI_BUILD_NUMBER}
65
+ always :
66
+ pytest_artifacts :
67
+ path : " coverage.xml"
68
+ format : junit
69
+ type : text/xml
63
70
64
71
qa_task :
65
72
alias : qa
@@ -88,17 +95,24 @@ qa_task:
88
95
qa_script :
89
96
- poetry run pytest tests/
90
97
91
- publish_task :
98
+ build_task :
99
+ << : *POETRY_TEMPLATE
100
+ alias : build
101
+ name : " Build"
102
+ build_script : regular_poetry_build_publish
103
+
104
+ promote_task :
92
105
depends_on :
93
106
- formatting
94
107
- analysis
95
108
- qa
109
+ - build
110
+ env :
111
+ ARTIFACTORY_PROMOTE_ACCESS_TOKEN : VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promoter access_token]
112
+ GITHUB_TOKEN : VAULT[development/github/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promotion token]
113
+ BURGR_URL : VAULT[development/kv/data/burgr data.url]
114
+ BURGR_USERNAME : VAULT[development/kv/data/burgr data.cirrus_username]
115
+ BURGR_PASSWORD : VAULT[development/kv/data/burgr data.cirrus_password]
116
+ ARTIFACTS : :pysonar:tar.gz,:pysonar:whl:py3-none-any
96
117
<< : *POETRY_TEMPLATE
97
- name : " Publish (Repox)"
98
- publish_script :
99
- - poetry version patch
100
- - poetry version $(poetry version -s).dev${CI_BUILD_NUMBER}
101
- - poetry build
102
- - poetry config repositories.sonarsource https://repox.jfrog.io/artifactory/api/pypi/sonarsource-pypi-builds
103
- - poetry publish -r sonarsource --username ${ARTIFACTORY_DEPLOY_USERNAME} --password ${ARTIFACTORY_DEPLOY_PASSWORD} --verbose
104
-
118
+ promote_script : cirrus_promote
0 commit comments