-
Notifications
You must be signed in to change notification settings - Fork 5
[CBP-9884] - add jenkinsfile and unit tests stage #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f186e00
[CBP-9884] - add jenkinsfile and unit tests stage
CristianCurteanu 2b1483e
[wip] - move back to sh shell
CristianCurteanu 110d45c
wip
CristianCurteanu c298db3
fix: add e2e tests
CristianCurteanu da211b2
fix: add condition for end-to-end tests to run on PR merge to master
CristianCurteanu 1e54e7e
fix: cleanup jenkinsfile
CristianCurteanu 0672eeb
fix: remove GHA workflows
CristianCurteanu 4247ea6
fix: cleanup
CristianCurteanu fc61b47
fix: cleanup PATH env variable for all stages
CristianCurteanu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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;' | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
CristianCurteanu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| resources: | ||
| requests: | ||
| memory: "1Gi" | ||
| cpu: "1000m" | ||
| limits: | ||
| memory: "1Gi" | ||
| cpu: "1000m" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.