diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index df28cd54..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: ci -on: - push: - branches: - - master - - development - pull_request: - branches: - - master - - development - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} - cancel-in-progress: true - -jobs: - test: - name: Test - runs-on: ubuntu-22.04 - services: - redis: - image: redis - ports: - - 6379:6379 - steps: - - name: Checkout code - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.7.16' - - - name: Install dependencies - run: | - sudo apt update - sudo apt-get install -y libkrb5-dev - pip install -U setuptools pip wheel - pip install -e .[cpphash,redis,uwsgi] - - - name: Run tests - run: python setup.py test - - - name: Set VERSION env - run: echo "VERSION=$(cat splitio/version.py | grep "__version__" | awk -F\' '{print $2}')" >> $GITHUB_ENV - - - name: SonarQube Scan (Push) - if: github.event_name == 'push' - uses: SonarSource/sonarqube-scan-action@v6 - env: - SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - projectBaseDir: . - args: > - -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} - -Dsonar.projectVersion=${{ env.VERSION }} - - - name: SonarQube Scan (Pull Request) - if: github.event_name == 'pull_request' - uses: SonarSource/sonarqube-scan-action@v6 - env: - SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - projectBaseDir: . - args: > - -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} - -Dsonar.projectVersion=${{ env.VERSION }} - -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} - -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} - -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} diff --git a/.github/workflows/update-license-year.yml b/.github/workflows/update-license-year.yml deleted file mode 100644 index 884edbe9..00000000 --- a/.github/workflows/update-license-year.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Update License Year - -on: - schedule: - - cron: "0 3 1 1 *" # 03:00 AM on January 1 - -permissions: - contents: write - pull-requests: write - -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set Current year - run: "echo CURRENT=$(date +%Y) >> $GITHUB_ENV" - - - name: Set Previous Year - run: "echo PREVIOUS=$(($CURRENT-1)) >> $GITHUB_ENV" - - - name: Update LICENSE - uses: jacobtomlinson/gha-find-replace@v3 - with: - find: ${{ env.PREVIOUS }} - replace: ${{ env.CURRENT }} - include: "LICENSE.txt" - regex: false - - - name: Commit files - run: | - git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' - git commit -m "Updated License Year" -a - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v5 - with: - token: ${{ secrets.GITHUB_TOKEN }} - title: Update License Year - branch: update-license diff --git a/.harness/orgs/PROD/projects/Harness_Split/pipelines/pythonclient.yaml b/.harness/orgs/PROD/projects/Harness_Split/pipelines/pythonclient.yaml new file mode 100644 index 00000000..2be61cb1 --- /dev/null +++ b/.harness/orgs/PROD/projects/Harness_Split/pipelines/pythonclient.yaml @@ -0,0 +1,149 @@ +pipeline: + name: python-client + identifier: pythonclient + projectIdentifier: Harness_Split + orgIdentifier: PROD + tags: + ai_generated: "true" + properties: + ci: + codebase: + connectorRef: <+input> + repoName: <+input> + build: <+input> + variables: + - name: sonarqube_token + type: Secret + value: <+secrets.getValue('sonarqube-token')> + - name: github_token + type: Secret + value: <+secrets.getValue('github-devops-token')> + stages: + - stage: + name: Build and Test + identifier: ci_stage + type: CI + spec: + cloneCodebase: true + runtime: + type: Cloud + spec: + size: medium + nestedVirtualization: true + platform: + os: Linux + arch: Amd64 + execution: + steps: + - step: + timeout: 30m + type: Test + name: Run Python Tests + identifier: run_tests + spec: + connectorRef: account.harnessImage + image: python:3.7.16-alpine + shell: Sh + command: |- + apk update + apk add --no-cache krb5-dev musl-dev libffi-dev build-base + + # Run pytest with JUnit XML report output + cd /harness + pip install --upgrade pip + pip install -U setuptools pip wheel + pip install Cython==3.0.12 + pip install aiohttp==3.8.4 + pip install cryptography==45.0.7 + pip install pycparser==2.21 + + apk add redis + redis-server /etc/redis.conf & + + pip install redis==5.0.8 + python setup.py test + envVariables: + PYTHONPATH: ${PYTHONPATH}:. + PYTEST_ADDOPTS: "--verbose" + - step: + type: Run + name: Install and Run SonarQube Scanner + identifier: install_sonarqube_scanner + spec: + connectorRef: account.harnessImage + image: sonarsource/sonar-scanner-cli + shell: Bash + command: | + cd /harness + if [ "<+codebase.prNumber>" != "" ]; then + echo "Pull Request Analysis" + sonar-scanner -X \ + -Dsonar.host.url=https://sonar.harness.io \ + -Dsonar.token=<+secrets.getValue('sonarqube-token')> \ + -Dsonar.projectKey=python-client \ + -Dsonar.scanner.skipJreProvisioning=true \ + -Dsonar.pullrequest.key=<+codebase.prNumber> \ + -Dsonar.pullrequest.branch=<+codebase.sourceBranch> \ + -Dsonar.pullrequest.base=<+codebase.targetBranch> \ + -Dsonar.scanner.skipSystemTruststore=true + else + echo "Branch Analysis" + sonar-scanner \ + -Dsonar.host.url=https://sonar.harness.io \ + -Dsonar.token=<+secrets.getValue('sonarqube-token')> \ + -Dsonar.projectKey=python-client \ + -Dsonar.scanner.skipJreProvisioning=true \ + -Dsonar.branch.name=<+codebase.branch> \ + -Dsonar.scanner.skipSystemTruststore=true + fi + envVariables: + SONAR_TOKEN: <+pipeline.variables.sonarqube_token> + outputVariables: + - name: SONAR_SCANNER_PATH + timeout: 10m + - step: + type: Run + name: Post Quality Gate to GitHub + identifier: Post_Quality_Gate_to_GitHub + spec: + shell: Sh + command: |- + # Get SonarQube quality gate status + curl -u <+secrets.getValue('sonarqube-token')>: \ + -s "https://sonar.harness.io/api/qualitygates/project_status?projectKey=python-client&pullRequest=${<+codebase.prNumber>}" + + curl -u <+secrets.getValue('sonarqube-token')>: -s 'https://sonar.harness.io/api/qualitygates/project_status?projectKey=python-client&pullRequest=${<+codebase.prNumber>}' | jq -r .projectStatus.status + + QUALITY_GATE_STATUS=$(curl -u <+secrets.getValue('sonarqube-token')>: -s 'https://sonar.harness.io/api/qualitygates/project_status?projectKey=python-client&pullRequest=${<+codebase.prNumber>}' | jq -r .projectStatus.status) + + echo "QUALITY_GATE_STATUS: $QUALITY_GATE_STATUS" + + # Set GitHub status based on quality gate + if [ "$QUALITY_GATE_STATUS" = "OK" ]; then + STATE="success" + DESCRIPTION="SonarQube Quality Gate passed" + else + STATE="failure" + DESCRIPTION="SonarQube Quality Gate failed" + fi + + # Post status to GitHub + curl -X POST \ + -H "Authorization: token ${<+secrets.getValue('github-devops-token')>}" \ + -H "Content-Type: application/json" \ + -d "{ + \"state\": \"${STATE}\", + \"description\": \"${DESCRIPTION}\", + \"context\": \"sonarqube/qualitygate\", + \"target_url\": \"https://sonar.harness.io/dashboard?id=python-client&pullRequest=${<+codebase.prNumber>}\" + }" \ + "https://api.github.com/repos/splitio/python-client/statuses/<+codebase.commitSha>" + rollbackSteps: [] + rollbackSteps: [] + caching: + enabled: false + paths: [] + buildIntelligence: + enabled: false + description: "" + description: This pipeline was updated by Harness AI on 2026-02-04 05:22:48 UTC by Bilal Al-Shahwany. diff --git a/.harness/orgs/PROD/projects/Harness_Split/pipelines/pythonclient/input_sets/entry.yaml b/.harness/orgs/PROD/projects/Harness_Split/pipelines/pythonclient/input_sets/entry.yaml new file mode 100644 index 00000000..ff5a4c23 --- /dev/null +++ b/.harness/orgs/PROD/projects/Harness_Split/pipelines/pythonclient/input_sets/entry.yaml @@ -0,0 +1,16 @@ +inputSet: + pipeline: + identifier: pythonclient + properties: + ci: + codebase: + connectorRef: fmegithubharnessgitops + repoName: python-client + build: + spec: + branch: harness_pipeline + type: branch + name: entry + identifier: entry + orgIdentifier: PROD + projectIdentifier: Harness_Split diff --git a/.harness/orgs/PROD/projects/Harness_Split/pipelines/pythonclient/input_sets/entry2.yaml b/.harness/orgs/PROD/projects/Harness_Split/pipelines/pythonclient/input_sets/entry2.yaml new file mode 100644 index 00000000..d97a24aa --- /dev/null +++ b/.harness/orgs/PROD/projects/Harness_Split/pipelines/pythonclient/input_sets/entry2.yaml @@ -0,0 +1,16 @@ +inputSet: + pipeline: + identifier: pythonclient + properties: + ci: + codebase: + connectorRef: fmegithubharnessgitops + repoName: python-client + build: + type: PR + spec: + number: "626" + name: entry2 + identifier: entry2 + orgIdentifier: PROD + projectIdentifier: Harness_Split diff --git a/.harness/orgs/PROD/projects/Harness_Split/pipelines/pythonclient/input_sets/pythonclient.yaml b/.harness/orgs/PROD/projects/Harness_Split/pipelines/pythonclient/input_sets/pythonclient.yaml new file mode 100644 index 00000000..31ad6fff --- /dev/null +++ b/.harness/orgs/PROD/projects/Harness_Split/pipelines/pythonclient/input_sets/pythonclient.yaml @@ -0,0 +1,16 @@ +inputSet: + name: python-client + identifier: pythonclient + orgIdentifier: PROD + projectIdentifier: Harness_Split + pipeline: + identifier: pythonclient + properties: + ci: + codebase: + connectorRef: fmegithubharnessgitops + repoName: python-client + build: + type: PR + spec: + number: <+trigger.prNumber> diff --git a/setup.py b/setup.py index e2b4c74a..3f7ddc07 100644 --- a/setup.py +++ b/setup.py @@ -15,15 +15,16 @@ 'iniconfig==1.1.1', 'attrs==22.1.0', 'pytest-asyncio==0.21.0', - 'aiohttp>=3.8.4', + 'aiohttp==3.8.4', 'aiofiles>=23.1.0', 'requests-kerberos>=0.15.0', - 'urllib3==2.0.7' + 'urllib3==2.0.7', + 'cryptography<=45.0.7' ] INSTALL_REQUIRES = [ 'requests', - 'pyyaml', + 'pyyaml<=6.0.1', 'docopt>=0.6.2', 'enum34;python_version<"3.4"', 'bloom-filter2>=2.0.0'