knapsack_pro 0.28.1 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +66 -2
- data/lib/knapsack_pro/version.rb +1 -1
- data/lib/tasks/install.rake +14 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90b70ad7eb455a9d71943d0d263d3521cfa3b9b2
|
4
|
+
data.tar.gz: 5fff38d0c65bdff7c8ec10006c2365ce8a441076
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81287d9a98148dcb902a64ae4448adeb0459c8c84f9e77aee5dbfb101a49fecc6a58841472909de16cf4aa9565146fecff8ac3bab2973b565f60896ead9be810
|
7
|
+
data.tar.gz: b4c7ca6dacc16ff8c0c98ccf6ab1698a89fd69e9ef6eab5a39a9744ef8ec9d36f3b7d3bce178abbb8fd8cfe5eae65ef57fb19a182508448ed36f1794f40d2084
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
* TODO
|
4
4
|
|
5
|
+
### 0.29.0
|
6
|
+
|
7
|
+
* Add info about Jenkins to installer.
|
8
|
+
* Extend info about final step in installer about verification if first test suite run was recorded correctly.
|
9
|
+
|
10
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.28.1...v0.29.0
|
11
|
+
|
5
12
|
### 0.28.1
|
6
13
|
|
7
14
|
* Add support for test files in directory with spaces.
|
data/README.md
CHANGED
@@ -94,6 +94,7 @@ The knapsack_pro has also [queue mode](#queue-mode) to get most optimal test sui
|
|
94
94
|
- [Info for semaphoreapp.com users](#info-for-semaphoreappcom-users)
|
95
95
|
- [Info for buildkite.com users](#info-for-buildkitecom-users)
|
96
96
|
- [Info for snap-ci.com users](#info-for-snap-cicom-users)
|
97
|
+
- [Info for Jenkins users](#info-for-jenkins-users)
|
97
98
|
- [FAQ](#faq)
|
98
99
|
- [How to run tests for particular CI node in your development environment](#how-to-run-tests-for-particular-ci-node-in-your-development-environment)
|
99
100
|
- [for knapack_pro regular mode](#for-knapack_pro-regular-mode)
|
@@ -679,6 +680,69 @@ Knapsack Pro supports snap-ci.com ENVs `SNAP_WORKER_TOTAL` and `SNAP_WORKER_INDE
|
|
679
680
|
|
680
681
|
Please remember to set up token like `KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC` as global environment.
|
681
682
|
|
683
|
+
#### Info for Jenkins users
|
684
|
+
|
685
|
+
In order to run parallel jobs with Jenkins you should use Jenkins Pipeline.
|
686
|
+
You can learn basics about it in the article [Parallelism and Distributed Builds with Jenkins](https://www.cloudbees.com/blog/parallelism-and-distributed-builds-jenkins).
|
687
|
+
|
688
|
+
Here is example `Jenkinsfile` working with Jenkins Pipeline.
|
689
|
+
|
690
|
+
```
|
691
|
+
timeout(time: 60, unit: 'MINUTES') {
|
692
|
+
node() {
|
693
|
+
stage('Checkout') {
|
694
|
+
checkout([/* checkout code from git */])
|
695
|
+
|
696
|
+
// determine git commit hash because we need to pass it to knapsack_pro
|
697
|
+
COMMIT_HASH = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
|
698
|
+
|
699
|
+
stash 'source'
|
700
|
+
}
|
701
|
+
}
|
702
|
+
|
703
|
+
def num_nodes = 4; // define your total number of CI nodes (how many parallel jobs will be executed)
|
704
|
+
def nodes = [:]
|
705
|
+
|
706
|
+
for (int i = 0; i < num_nodes; i++) {
|
707
|
+
def index = i;
|
708
|
+
nodes["ci_node_${i}"] = {
|
709
|
+
node() {
|
710
|
+
stage('Setup') {
|
711
|
+
unstash 'source'
|
712
|
+
// other setup steps
|
713
|
+
}
|
714
|
+
|
715
|
+
def knapsack_options = """\
|
716
|
+
KNAPSACK_PRO_CI_NODE_TOTAL=${num_nodes}\
|
717
|
+
KNAPSACK_PRO_CI_NODE_INDEX=${index}\
|
718
|
+
KNAPSACK_PRO_COMMIT_HASH=${COMMIT_HASH}\
|
719
|
+
KNAPSACK_PRO_BRANCH=${env.BRANCH_NAME}\
|
720
|
+
"""
|
721
|
+
|
722
|
+
// example how to run cucumber tests in Knapsack Pro Regular Mode
|
723
|
+
stage('Run cucumber') {
|
724
|
+
sh """${knapsack_options} bundle exec rake knapsack_pro:cucumber"""
|
725
|
+
}
|
726
|
+
|
727
|
+
// example how to run rspec tests in Knapsack Pro Queue Mode
|
728
|
+
// Queue Mode should be as a last stage so it can autobalance build if tests in regular mode were not perfectly distributed
|
729
|
+
stage('Run rspec') {
|
730
|
+
sh """KNAPSACK_PRO_CI_NODE_BUILD_ID=${env.BUILD_TAG} ${knapsack_options} bundle exec rake knapsack_pro:queue:rspec"""
|
731
|
+
}
|
732
|
+
}
|
733
|
+
}
|
734
|
+
}
|
735
|
+
|
736
|
+
parallel nodes // run CI nodes in parallel
|
737
|
+
}
|
738
|
+
```
|
739
|
+
|
740
|
+
Remember to set environment variables in Jenkins configuration with your API tokens like `KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC` and `KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER`.
|
741
|
+
Here is [list of environment variables per test runner](#set-api-key-token).
|
742
|
+
|
743
|
+
Above example shows how to run cucumber tests in regular mode and later the rspec tests in queue mode to autobalance build.
|
744
|
+
If you are going to relay on rspec to autobalance build when cucumber tests were not perfectly distributed you should be aware about [possible edge case if your rspec test suite is very short](#why-my-tests-are-executed-twice-in-queue-mode-why-ci-node-runs-whole-test-suite-again).
|
745
|
+
|
682
746
|
## FAQ
|
683
747
|
|
684
748
|
### How to run tests for particular CI node in your development environment
|
@@ -940,8 +1004,8 @@ Thanks to that when for some reason the tests executed for cucumber in regular m
|
|
940
1004
|
|
941
1005
|
### Why my tests are executed twice in queue mode? Why CI node runs whole test suite again?
|
942
1006
|
|
943
|
-
This may happen when one of your CI node started work when all other CI nodes already executed whole test suite.
|
944
|
-
|
1007
|
+
This may happen when one of your CI node started work later when all other CI nodes already executed whole test suite.
|
1008
|
+
The slow CI node will initialize a new queue hence the tests executed twice. To solve this problem you should set `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true`.
|
945
1009
|
Please [read this](#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node).
|
946
1010
|
|
947
1011
|
## Gem tests
|
data/lib/knapsack_pro/version.rb
CHANGED
data/lib/tasks/install.rake
CHANGED
@@ -188,6 +188,13 @@ bundle exec rake knapsack_pro:#{tool}
|
|
188
188
|
set_api_tokens_on_ci(prompt, answers)
|
189
189
|
end
|
190
190
|
|
191
|
+
def step_for_ci_jenkins(prompt, answers)
|
192
|
+
prompt.say "Step for Jenkins", color: :yellow
|
193
|
+
prompt.say "Please visit page to see example Jenkinsfile:"
|
194
|
+
prompt.say "https://github.com/KnapsackPro/knapsack_pro-ruby#info-for-jenkins-users"
|
195
|
+
puts
|
196
|
+
end
|
197
|
+
|
191
198
|
def step_for_ci_other(prompt, answers)
|
192
199
|
prompt.say "Step for other CI provider", color: :yellow
|
193
200
|
prompt.say "Set below global variables on your CI server."
|
@@ -284,6 +291,7 @@ namespace :knapsack_pro do
|
|
284
291
|
'https://buildkite.com' => :buildkite,
|
285
292
|
'https://semaphoreci.com' => :semaphore,
|
286
293
|
'https://snap-ci.com' => :snap_ci,
|
294
|
+
'Jenkins' => :jenkins,
|
287
295
|
'other' => :other,
|
288
296
|
}
|
289
297
|
answers[:ci] = prompt.select("What is your CI provider?", CI_PROVIDER_CHOICES)
|
@@ -308,9 +316,14 @@ namespace :knapsack_pro do
|
|
308
316
|
|
309
317
|
send("step_for_ci_#{answers[:ci]}", prompt, answers)
|
310
318
|
|
319
|
+
prompt.say "Final step", color: :yellow
|
311
320
|
prompt.say "Now you are ready to use the gem!"
|
321
|
+
puts
|
312
322
|
prompt.say "Please push a new commit to repository so knapsack_pro gem will record time execution of your test suite."
|
313
|
-
|
323
|
+
puts
|
324
|
+
prompt.say "Go to user dashboard https://knapsackpro.com/dashboard and click build metrics link next to your API token. Click show link on recent build and ensure the time execution data were recorded for all your CI nodes. You should see info that build subsets were collected."
|
325
|
+
puts
|
326
|
+
prompt.say "Your second test suite run on CI will be parallelized with optimal test suite split if first run was recorded correctly."
|
314
327
|
puts
|
315
328
|
puts
|
316
329
|
prompt.say "Later you may want to learn about Queue Mode and how to enable it:"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knapsack_pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.29.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|