diff --git a/.github/workflows/e2e_tests.yaml b/.github/workflows/e2e_tests.yaml deleted file mode 100644 index 453642f..0000000 --- a/.github/workflows/e2e_tests.yaml +++ /dev/null @@ -1,50 +0,0 @@ -name: E2E tests - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - - runs-on: macos-12 - - steps: - - uses: actions/checkout@v2 - with: - path: rox-go - - name: Checkout e2e tests - uses: actions/checkout@v2 - with: - repository: rollout/sdk-end-2-end-tests - ref: master - ssh-key: ${{ secrets.SDK_E2E_TESTS_DEPLOY_KEY }} - path: sdk-end-2-end-tests - - name: link driver - working-directory: ./sdk-end-2-end-tests/drivers - run: ln -s $GITHUB_WORKSPACE/rox-go/v5/driver go - - name: build e2e node driver - working-directory: ./sdk-end-2-end-tests/drivers/nodejs - run: | - yarn install --frozen-lockfile - - name: build and run e2e - working-directory: ./sdk-end-2-end-tests - run: | - yarn install --frozen-lockfile - QA_E2E_BEARER=$QA_E2E_BEARER API_HOST=https://api.test.rollout.io CD_API_ENDPOINT=https://api.test.rollout.io/device/get_configuration CD_S3_ENDPOINT=https://rox-conf.test.rollout.io/ SS_API_ENDPOINT=https://api.test.rollout.io/device/update_state_store/ SS_S3_ENDPOINT=https://rox-state.test.rollout.io/ CLIENT_DATA_CACHE_KEY=client_data ANALYTICS_ENDPOINT=https://analytic.test.rollout.io/ NOTIFICATIONS_ENDPOINT=https://push.test.rollout.io/sse SDK_LANG=go NODE_ENV=container yarn test:env - env: - QA_E2E_BEARER: ${{ secrets.QA_E2E_BEARER }} -# TODO: implement EU hosting support -# - name: build and run e2e eu hosting -# working-directory: ./sdk-end-2-end-tests -# run: | -# QA_E2E_BEARER=$QA_EU_E2E_BEARER SDK_LANG=go NODE_ENV=qa HOSTING=eu yarn test:env -# env: -# QA_EU_E2E_BEARER: ${{ secrets.QA_EU_E2E_BEARER }} - - name: Show e2e server driver logs - if: ${{ always() }} - run: cat ./sdk-end-2-end-tests/drivers/go/log_1234.out || echo "no log file" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 1a46513..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: Release - -on: - push: - tags: - - "v*.*.*" - -jobs: - release: - runs-on: macos-12 - - steps: - - name: Set version - id: vars - uses: battila7/get-version-action@v2 - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.vars.outputs.version }} - release_name: ${{ steps.vars.outputs.version }} - body: Release ${{ steps.vars.outputs.version }} - draft: false - prerelease: false diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml deleted file mode 100644 index a50b4b1..0000000 --- a/.github/workflows/run_tests.yaml +++ /dev/null @@ -1,13 +0,0 @@ -name: Unit Tests - -on: [push] - -jobs: - unit_tests: - runs-on: macos-12 - - steps: - - uses: actions/checkout@v2 - - name: Run tests - run: go test ./core/... - working-directory: ./v5 diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..c7df7ee --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,108 @@ +pipeline { + agent any + + libraries { + lib('fm-shared-library@main') + }//end libraries. Github Repo: https://github.com/rollout/fm-cbci-shared-library + + options { + timeout(time: 45, unit: 'MINUTES') + }//end options + + environment { + PATH = "/usr/local/go/bin:${env.PATH}" + } + + stages { + stage('Checkout') { + steps { + checkout scm + } + } + + stage("Run Unit tests"){ + agent { + kubernetes { + inheritFrom 'golang' + yamlFile './cbci-templates/fmforci.yaml' + } + } + + steps { + container(name: "server", shell: "sh") { + withCredentials([ + sshUserPrivateKey(credentialsId: 'SDK_E2E_SSH_KEY', keyFileVariable: 'SDK_E2E_SSH_KEY', passphraseVariable: '', usernameVariable: 'cloudbees.eslint@cloudbees.com'), + ]) { + echo "Executing Run tests" + sh script: 'cd ./v6 && go test ./core/...', + label: "Running unit tests" + } + } + } + post{ + success{ + echo 'Unit Tests OK; posting results' + } + failure{ + echo 'Unit Tests Failed;' + } + } + } + + stage("Run E2E tests"){ + agent { + kubernetes { + inheritFrom 'default' + yamlFile './cbci-templates/fmforci.yaml' + } + } + + when { + branch 'master' + } + + steps { + container("rox-proxy") { + waitForRoxProxy() + } + + container(name: "server", shell: 'sh') { + withCredentials([ + string(credentialsId: 'TEST_E2E_BEARER', variable: 'TEST_E2E_BEARER'), + sshUserPrivateKey(credentialsId: 'SDK_E2E_SSH_KEY', keyFileVariable: 'SDK_E2E_SSH_KEY', passphraseVariable: '', usernameVariable: 'cloudbees.eslint@cloudbees.com'), + sshUserPrivateKey(credentialsId: 'SDK_E2E_TESTS_DEPLOY_KEY', keyFileVariable: 'SDK_E2E_TESTS_DEPLOY_KEY', passphraseVariable: '', usernameVariable: 'cloudbees.eslint@cloudbees.com'), + ]) { + script { + addGitHubFingerprint() + TESTENVPARAMS = "QA_E2E_BEARER=$TEST_E2E_BEARER API_HOST=https://api.test.rollout.io CD_API_ENDPOINT=https://api.test.rollout.io/device/get_configuration CD_S3_ENDPOINT=https://rox-conf.test.rollout.io/ SS_API_ENDPOINT=https://api.test.rollout.io/device/update_state_store/ SS_S3_ENDPOINT=https://rox-state.test.rollout.io/ CLIENT_DATA_CACHE_KEY=client_data ANALYTICS_ENDPOINT=https://analytic.test.rollout.io/ NOTIFICATIONS_ENDPOINT=https://push.test.rollout.io/sse" + + withEnv(["GIT_SSH_COMMAND=ssh -i ${SDK_E2E_SSH_KEY}"]) { + echo "Executing E2E tests" + sh script: """ + apt-get update && apt-get install -y curl gnupg + curl -sL https://deb.nodesource.com/setup_lts.x | bash - + apt-get install -y nodejs && npm install -g yarn + + git clone git@github.com:rollout/sdk-end-2-end-tests.git + ln -s ${pwd()}/v6/driver/ ${pwd()}/sdk-end-2-end-tests/drivers/go + cd sdk-end-2-end-tests + yarn install --frozen-lockfile + SDK_LANG=go ${TESTENVPARAMS} NODE_ENV=container yarn test:env + """, label: "Pull SDK end2 tests repository" + }// end withEnv + } + } + } + } + post{ + success{ + echo 'E2E Tests OK; posting results' + } + failure{ + echo 'E2E Tests Failed;' + } + + } + } + } +} diff --git a/cbci-templates/fmforci.yaml b/cbci-templates/fmforci.yaml new file mode 100644 index 0000000..aaceb6a --- /dev/null +++ b/cbci-templates/fmforci.yaml @@ -0,0 +1,29 @@ +apiVersion: v1 +kind: Pod +metadata: + name: fm-rox-go-sdk +spec: + serviceAccountName: ops-gcr-rw + containers: + - name: server + image: golang:1.18 + tty: true + resources: + requests: + memory: "4Gi" + cpu: "2000m" + limits: + memory: "4Gi" + cpu: "2000m" + - name: rox-proxy + image: rollout/simple-proxy + tty: true + ports: + - containerPort: 8080 + resources: + requests: + memory: "1Gi" + cpu: "1000m" + limits: + memory: "1Gi" + cpu: "1000m"