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
2 changes: 2 additions & 0 deletions build-poetry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ runs:
${{ (inputs.sonar-platform != 'none' || inputs.run-shadow-scans == 'true') && 'development/kv/data/sonarcloud url | SQC_EU_URL;' || '' }}
${{ (inputs.sonar-platform != 'none' || inputs.run-shadow-scans == 'true') && 'development/kv/data/sonarcloud token | SQC_EU_TOKEN;' || '' }}
development/artifactory/token/{REPO_OWNER_NAME_DASH}-${{ env.ARTIFACTORY_READER_ROLE }} access_token | ARTIFACTORY_ACCESS_TOKEN;
development/artifactory/token/{REPO_OWNER_NAME_DASH}-${{ env.ARTIFACTORY_READER_ROLE }} username | ARTIFACTORY_USERNAME;
${{ inputs.deploy != 'false' && inputs.run-shadow-scans != 'true' && format('development/artifactory/token/{{REPO_OWNER_NAME_DASH}}-{0} access_token | ARTIFACTORY_DEPLOY_ACCESS_TOKEN;', env.ARTIFACTORY_DEPLOYER_ROLE) || '' }}
# yamllint enable rule:line-length
- name: Build, Analyze and deploy
Expand All @@ -152,6 +153,7 @@ runs:
ARTIFACTORY_DEPLOY_REPO: ${{ inputs.artifactory-deploy-repo != '' && inputs.artifactory-deploy-repo ||
github.event.repository.visibility == 'public' && 'sonarsource-pypi-public-qa' || 'sonarsource-pypi-private-qa' }}
ARTIFACTORY_ACCESS_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_ACCESS_TOKEN }}
ARTIFACTORY_USERNAME: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_USERNAME }}
ARTIFACTORY_DEPLOY_ACCESS_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_DEPLOY_ACCESS_TOKEN }}
POETRY_VIRTUALENVS_PATH: ${{ github.workspace }}/${{ inputs.poetry-virtualenvs-path }}
POETRY_CACHE_DIR: ${{ github.workspace }}/${{ inputs.poetry-cache-dir }}
Expand Down
6 changes: 4 additions & 2 deletions build-poetry/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ set -euo pipefail
# shellcheck source=../shared/common-functions.sh
source "$(dirname "${BASH_SOURCE[0]}")/../shared/common-functions.sh"

: "${ARTIFACTORY_URL:?}" "${ARTIFACTORY_PYPI_REPO:?}" "${ARTIFACTORY_ACCESS_TOKEN:?}" "${RUN_SHADOW_SCANS:?}"
: "${ARTIFACTORY_URL:?}" "${ARTIFACTORY_PYPI_REPO:?}" "${ARTIFACTORY_ACCESS_TOKEN:?}" "${ARTIFACTORY_USERNAME:?}" "${RUN_SHADOW_SCANS:?}"
: "${ARTIFACTORY_DEPLOY_REPO:?}" "${DEPLOY_PULL_REQUEST:=false}"
: "${GITHUB_REF_NAME:?}" "${BUILD_NUMBER:?}" "${GITHUB_REPOSITORY:?}" "${GITHUB_EVENT_NAME:?}" "${GITHUB_EVENT_PATH:?}"
: "${PULL_REQUEST?}" "${DEFAULT_BRANCH:?}" "${GITHUB_ENV:?}" "${GITHUB_OUTPUT:?}" "${GITHUB_SHA:?}" "${GITHUB_RUN_ID:?}"
Expand Down Expand Up @@ -267,7 +267,9 @@ jfrog_poetry_install() {
jf config add repox --url "${ARTIFACTORY_URL%/artifactory*}" --artifactory-url "$ARTIFACTORY_URL" --access-token "$ARTIFACTORY_ACCESS_TOKEN"
jf config use repox
jf poetry-config --server-id-resolve repox --repo-resolve "$ARTIFACTORY_PYPI_REPO"
jf poetry install --build-name="$PROJECT" --build-number="$BUILD_NUMBER"
export POETRY_HTTP_BASIC_REPOX_USERNAME="$ARTIFACTORY_USERNAME"
export POETRY_HTTP_BASIC_REPOX_PASSWORD="$ARTIFACTORY_ACCESS_TOKEN"
poetry install
}

jfrog_poetry_publish() {
Expand Down
7 changes: 4 additions & 3 deletions spec/build-poetry_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export GITHUB_ENV=/dev/null
export ARTIFACTORY_URL="https://dummy.repox"
export ARTIFACTORY_PYPI_REPO="<repox pypi repo>"
export ARTIFACTORY_ACCESS_TOKEN="dummy access token"
export ARTIFACTORY_USERNAME="dummy-user"
export ARTIFACTORY_DEPLOY_REPO="<deploy repo>"
export ARTIFACTORY_DEPLOY_ACCESS_TOKEN="<deploy token>"
export GITHUB_REPOSITORY="my-org/my-repo"
Expand Down Expand Up @@ -100,7 +101,7 @@ Describe 'build-poetry/build.sh'
The line 28 should equal "jf config add repox --url https://dummy.repox --artifactory-url https://dummy.repox --access-token dummy access token"
The line 29 should equal "jf config use repox"
The line 30 should equal "jf poetry-config --server-id-resolve repox --repo-resolve <repox pypi repo>"
The line 31 should equal "jf poetry install --build-name=my-repo --build-number=42"
The line 31 should equal "poetry install"
The line 32 should equal "::endgroup::"
The line 33 should equal "::group::Build project"
The line 35 should equal "poetry build"
Expand Down Expand Up @@ -302,12 +303,12 @@ End

Describe 'jfrog_poetry_install()'
export PROJECT="my-repo"
It 'installs Poetry dependencies using JFrog CLI'
It 'configures JFrog and installs with plain poetry install'
When call jfrog_poetry_install
The line 1 should include "jf config add repox"
The line 2 should include "jf config use repox"
The line 3 should include "jf poetry-config"
The line 4 should include "jf poetry install"
The line 4 should equal "poetry install"
End
End

Expand Down
Loading