Skip to content
Open
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
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

7 changes: 0 additions & 7 deletions .github/pull_request_template.md

This file was deleted.

135 changes: 0 additions & 135 deletions .github/workflows/ci-cd.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/update-notice-year.yml

This file was deleted.

186 changes: 186 additions & 0 deletions .harness/orgs/PROD/projects/Harness_Split/pipelines/reactclient.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
pipeline:
name: react-client-repo
identifier: reactclient
projectIdentifier: Harness_Split
orgIdentifier: PROD
tags: {}
properties:
ci:
codebase:
connectorRef: fmegithubharnessgitops
repoName: react-client
build: <+input>
stages:
- stage:
name: Check-Test-Build-Upload
identifier: Check_Test_Build_Upload
description: ""
type: CI
spec:
cloneCodebase: true
caching:
enabled: true
override: true
paths: []
buildIntelligence:
enabled: false
execution:
steps:
- step:
type: Run
name: npm ci
identifier: npm_ci
spec:
connectorRef: dockerhub
image: node:lts
shell: Bash
command: npm ci
- step:
type: Run
name: npm run check
identifier: npm_run_check
spec:
connectorRef: dockerhub
image: node:lts
shell: Bash
command: npm run check
- step:
type: Run
name: npm run test
identifier: npm_run_test
spec:
connectorRef: dockerhub
image: node:lts
shell: Bash
command: npm run test -- --maxWorkers=2
resources:
limits:
memory: 4Gi
cpu: "2"
- step:
type: Run
name: npm run build
identifier: npm_run_build
spec:
connectorRef: dockerhub
image: node:lts
shell: Bash
command: BUILD_BRANCH=<+codebase.branch> npm run build
- step:
type: Run
name: SonarQube Scan
identifier: SonarQube_Scan
spec:
connectorRef: dockerhub
image: sonarsource/sonar-scanner-cli
shell: Bash
command: |
set -euo pipefail

COMMON_ARGS="
-Dsonar.host.url=https://sonar.harness.io
-Dsonar.token=$SONAR_TOKEN
-Dsonar.projectKey=react-client
-Dsonar.sources=src
-Dsonar.tests=src/__tests__
-Dsonar.exclusions=**/node_modules/**,**/umd/**,**/es/**,**/lib/**,src/__tests__/**
-Dsonar.scanner.skipJreProvisioning=true
-Dsonar.scanner.skipSystemTruststore=true
"

if [ "<+codebase.prNumber>" != "" ] && [ "<+codebase.prNumber>" != "null" ]; then
echo "Pull Request Analysis"
sonar-scanner \
$COMMON_ARGS \
-Dsonar.pullrequest.key=<+codebase.prNumber> \
-Dsonar.pullrequest.branch=<+codebase.sourceBranch> \
-Dsonar.pullrequest.base=<+codebase.targetBranch>
else
echo "Branch Analysis"
sonar-scanner \
$COMMON_ARGS \
-Dsonar.branch.name=<+codebase.branch>
fi
envVariables:
SONAR_TOKEN: <+secrets.getValue("sonarqube-token")>
timeout: 10m
- step:
type: Run
name: Post Quality Gate
identifier: Post_Quality_Gate
spec:
connectorRef: dockerhub
image: python:3
shell: Bash
command: |-
#!/bin/bash
set -e

SONAR_TOKEN="<+secrets.getValue("sonarqube-token")>"
SONAR_URL="https://sonar.harness.io"
SONAR_PROJECT_KEY="react-client"
GITHUB_TOKEN="<+secrets.getValue("github-devops-token")>"
GITHUB_REPO="react-client"
COMMIT_SHA="<+codebase.commitSha>"

STATUS_JSON=$(curl -sf \
-H "Authorization: Bearer ${SONAR_TOKEN}" \
"${SONAR_URL}/api/qualitygates/project_status?projectKey=${SONAR_PROJECT_KEY}")

QG_STATUS=$(echo "$STATUS_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['projectStatus']['status'])")

case "$QG_STATUS" in
OK) GH_STATE="success"; DESCRIPTION="Quality gate passed" ;;
ERROR) GH_STATE="failure"; DESCRIPTION="Quality gate failed" ;;
WARN) GH_STATE="success"; DESCRIPTION="Quality gate passed with warnings" ;;
*) GH_STATE="pending"; DESCRIPTION="Quality gate status unknown" ;;
esac

TARGET_URL="${SONAR_URL}/dashboard?id=${SONAR_PROJECT_KEY}"

curl -sf -X POST \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: application/json" \
-d "{\"state\":\"${GH_STATE}\",\"description\":\"${DESCRIPTION}\",\"context\":\"sonarqube/quality-gate\",\"target_url\":\"${TARGET_URL}\"}" \
"https://api.github.com/repos/splitio/${GITHUB_REPO}/statuses/${COMMIT_SHA}"

echo "Posted SonarQube quality gate status: ${GH_STATE}"
- parallel:
- step:
type: Run
name: upload dev assets to CDN
identifier: upload_dev_assets_to_CDN
spec:
connectorRef: dockerhub
image: amazon/aws-cli:2.31.5
shell: Bash
command: aws s3 sync ./umd s3://split-public-stage/sdk --acl public-read --follow-symlinks --cache-control max-age=31536000,public
envVariables:
AWS_DEFAULT_REGION: us-east-1
when:
stageStatus: Success
condition: <+trigger.event> == "PUSH" && <+trigger.branch> == "development"
- step:
type: Run
name: upload prod assets to CDN
identifier: upload_prod_assets_to_CDN
spec:
connectorRef: dockerhub
image: amazon/aws-cli:2.31.5
shell: Bash
command: aws s3 sync ./umd s3://split-public/sdk --acl public-read --follow-symlinks --cache-control max-age=31536000,public
envVariables:
AWS_DEFAULT_REGION: us-east-1
when:
stageStatus: Success
condition: <+trigger.event> == "PUSH" && <+trigger.branch> == "main"
infrastructure:
type: KubernetesDirect
spec:
connectorRef: "<+codebase.branch == \"main\" ? \"use1prod1cd\" : \"use1stage1cd\">"
namespace: harness-delegate
serviceAccountName: "<+codebase.branch == \"main\" ? \"use1-prod-1-public-assets\" : \"use1-stage-1-public-assets\">"
automountServiceAccountToken: false
nodeSelector: {}
os: Linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
inputSet:
name: reactclient_push
identifier: reactclient_push
orgIdentifier: PROD
projectIdentifier: Harness_Split
pipeline:
identifier: reactclient
properties:
ci:
codebase:
build:
type: branch
spec:
branch: <+trigger.branch>
Loading