diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index c88d511..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: 2.1 - -orbs: - slack: circleci/slack@4.4.2 - -commands: - export_slack_id: - steps: - - run: - name : Exporting circleci username as slack id. - command: echo 'export SLACK_PARAM_MENTIONS="$CIRCLE_USERNAME"' >> "$BASH_ENV" - - run: - name : CircleCi To Slack user mapping. - command: | - echo $GITHUB_SLACK_USERMAPPING | base64 --decode > github_slack - while read -r line || [[ -n $line ]]; - do - [[ ${line//[[:space:]]/} =~ ^#.* || -z "$line" ]] && continue - echo "$line" | tr "=" "\n" | while read -r key; do - read -r value - if [ "$CIRCLE_USERNAME" = "${key}" ]; then - echo "export SLACK_PARAM_MENTIONS='<@${value}>'" >> $BASH_ENV - fi - done - done < github_slack - rm github_slack - -slack/notify: &slack_notify - branch_pattern: master - event: fail - channel: ci-build-status - template: SLACK_TAG_CI_FAILURE_TEMPLATE - -context: &context - - slack-templates - - slack_Oauth - - Github_Slack_UserMapping - -jobs: - build: - parallelism: 3 # run three instances of this job in parallel - docker: - - image: circleci/ruby:2.4.2-jessie-node - environment: - BUNDLE_JOBS: 3 - BUNDLE_RETRY: 3 - BUNDLE_PATH: vendor/bundle - steps: - - checkout - - export_slack_id - - - run: - name: Which bundler? - command: bundle -v - - - restore_cache: - keys: - - sift-bundle-{{ checksum "sift.gemspec" }} - - sift-bundle- - - - run: - name: Bundle Install - command: bundle check || bundle install - - - save_cache: - key: sift-bundle-{{ checksum "sift.gemspec" }} - paths: - - vendor/bundle - - - run: - name: Run rspec in parallel - command: | - bundle exec rspec --profile 10 \ - --format RspecJunitFormatter \ - --out test_results/rspec.xml \ - --format progress \ - $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) - - - store_test_results: - path: test_results - - slack/notify: - <<: *slack_notify - - run_integration_tests: - docker: - - image: circleci/ruby:2.4.2-jessie-node - steps: - - checkout - - run: - name: Install bundle and run the tests - command: | - bundle check || bundle install - bundle exec ruby test_integration_app/main.rb - -workflows: - ruby-test: - jobs: - - build: - context: *context - ruby-integration-tests: - jobs: - - run_integration_tests: - filters: - branches: - only: master diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile deleted file mode 100644 index 82cfa57..0000000 --- a/.jenkins/Jenkinsfile +++ /dev/null @@ -1,103 +0,0 @@ -// Load Jenkins shared library -jenkinsBranch = 'v0.37.0' -sharedLib = library("shared-lib@${jenkinsBranch}") - -def siftRubyWorkflow = sharedLib.com.sift.ci.SiftRubyWorkflow.new() -def ciUtil = sharedLib.com.sift.ci.CIUtil.new() -def stackdriver = sharedLib.com.sift.ci.StackDriverMetrics.new() - -// Default GitHub status context for automatically triggered builds -def defaultStatusContext = 'Jenkins:auto' - -// Pod template file for Jenkins agent pod -// Pod template yaml file is defined in https://github.com/SiftScience/jenkins/tree/master/resources/jenkins-k8s-pod-templates -def ruby2PodTemplateFile = 'ruby-2-4-2-pod-template.yaml' -def ruby2PodLabel = "ruby2-${BUILD_TAG}" - - -// GitHub repo name -def repoName = 'sift-ruby' - -pipeline { - agent none - options { - timestamps() - skipDefaultCheckout() - disableConcurrentBuilds() - disableRestartFromStage() - parallelsAlwaysFailFast() - buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '') - timeout(time: 1, unit: 'HOURS') - } - environment { - GIT_BRANCH = "${env.CHANGE_BRANCH != null? env.CHANGE_BRANCH : env.BRANCH_NAME}" - } - stages { - stage('Initialize') { - steps { - script { - statusContext = defaultStatusContext - // Get the commit sha for the build - commitSha = ciUtil.commitHashForBuild() - ciUtil.updateGithubCommitStatus(repoName, statusContext, 'Started', 'pending', commitSha) - } - } - } - stage ('Build and Test Workflows') { - steps { - script { - def workflows = [:] - def stage1 = 'Run Integration Tests - ruby' - workflows[stage1] = { - stage(stage1) { - if (env.GIT_BRANCH.equals('master')) { - ciUtil.updateGithubCommitStatus(repoName, stage1, 'Started', 'pending', commitSha) - try { - siftRubyWorkflow.runSiftRubyIntegration(ruby2PodTemplateFile, ruby2PodLabel) - ciUtil.updateGithubCommitStatus(repoName, stage1, 'SUCCESS', 'success', commitSha) - } catch (Exception e) { - ciUtil.updateGithubCommitStatus(repoName, stage1, 'FAILURE', 'failure', commitSha) - print("${stage1} failed") - throw e - } - } - } - } - def stage2 = 'Test - ruby' - workflows[stage2] = { - stage(stage2) { - ciUtil.updateGithubCommitStatus(repoName, stage2, 'Started', 'pending', commitSha) - try { - siftRubyWorkflow.runSiftRubyTest(ruby2PodTemplateFile, ruby2PodLabel) - ciUtil.updateGithubCommitStatus(repoName, stage2, 'SUCCESS', 'success', commitSha) - } catch (Exception e) { - ciUtil.updateGithubCommitStatus(repoName, stage2, 'FAILURE', 'failure', commitSha) - print("${stage2} failed") - throw e - } - } - } - parallel workflows - } - } - } - } - post { - success { - script { - ciUtil.updateGithubCommitStatus(repoName, statusContext, currentBuild.currentResult, 'success', commitSha) - } - } - unsuccessful { - script { - ciUtil.updateGithubCommitStatus(repoName, statusContext, currentBuild.currentResult, 'failure', commitSha) - ciUtil.notifySlack(repoName, commitSha) - } - } - always { - script { - stackdriver.updatePipelineStatistics(this) - } - } - } -}