leap_salesforce 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +25 -17
- data/ChangeLog +6 -0
- data/Rakefile +2 -1
- data/leap_salesforce.gemspec +1 -0
- data/lib/leap_salesforce/auth.rb +2 -2
- data/lib/leap_salesforce/get_prod_auth.sh +2 -2
- data/lib/leap_salesforce/get_scratch_auth_jwt.sh +2 -2
- data/lib/leap_salesforce/get_scratch_auth_url.sh +2 -2
- data/lib/leap_salesforce/rake/sfdx.rake +4 -4
- data/lib/leap_salesforce/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91e7d68b35916d600c053d7ec95f01bc26694eebf0bf176da4fa595b07506087
|
4
|
+
data.tar.gz: c3466149eaef469e70359c88c6d3ea3e125adea0f6b1bffbcdf5415699088d98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6daeecb2f063de6d7b615e16c9ab2931988c74404c53f5ef7d1ab5e79f21645ddcf6587bc377204c5f13314e97e8d6c70bcaaa63188668b5837fe728e1f530d
|
7
|
+
data.tar.gz: 6afc1a7aa1b7d0574a6821adf1eb5844a91c394f96158e5f970c4f7ee67b986544c1cc42aeb0d92310399482ea8e66de672a994e6cbf5b2192690aed8ea6130a
|
data/.gitlab-ci.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
include:
|
2
2
|
- template: Code-Quality.gitlab-ci.yml
|
3
3
|
|
4
|
-
image: ruby:3.
|
4
|
+
image: ruby:3.3
|
5
5
|
|
6
6
|
stages:
|
7
7
|
- test
|
@@ -13,7 +13,12 @@ variables:
|
|
13
13
|
client_id: $client_id
|
14
14
|
client_secret: $client_secret
|
15
15
|
SERVER_KEY_PASSWORD: $SERVER_KEY_PASSWORD
|
16
|
-
|
16
|
+
# LANG: 'UTF-8'
|
17
|
+
LC_CTYPE: en_US
|
18
|
+
LANG: en_US.UTF-8
|
19
|
+
LANGUAGE: en_US.UTF-8
|
20
|
+
LC_ALL: en_US.UTF-8
|
21
|
+
RUBYOPT: "-KU -E utf-8:utf-8"
|
17
22
|
|
18
23
|
pages:
|
19
24
|
stage: deploy
|
@@ -208,7 +213,7 @@ pages:
|
|
208
213
|
|
209
214
|
local file=$(mktemp)
|
210
215
|
echo $org_auth_url > $file
|
211
|
-
local cmd="sfdx force:auth:sfdxurl:store --sfdxurlfile $file --
|
216
|
+
local cmd="sfdx force:auth:sfdxurl:store --sfdxurlfile $file --alias $alias_to_set --json" && (echo $cmd >&2)
|
212
217
|
local output=$($cmd)
|
213
218
|
|
214
219
|
sfdx force:config:set defaultusername=$alias_to_set
|
@@ -231,7 +236,7 @@ pages:
|
|
231
236
|
echo "org_username=$org_username" >&2
|
232
237
|
|
233
238
|
# Parse the SFDX Auth URL for the given org
|
234
|
-
local cmd="sfdx force:org:display --verbose --
|
239
|
+
local cmd="sfdx force:org:display --verbose --target-org $org_username --json" && (echo $cmd >&2)
|
235
240
|
local output=$($cmd)
|
236
241
|
org_auth_url="$(jq -r '.result.sfdxAuthUrl' <<< $output)"
|
237
242
|
|
@@ -258,7 +263,7 @@ pages:
|
|
258
263
|
echo "org_username=$org_username" >&2
|
259
264
|
echo "limit_name=$limit_name" >&2
|
260
265
|
|
261
|
-
local cmd="sfdx force:limits:api:display --
|
266
|
+
local cmd="sfdx force:limits:api:display --target-org $org_username --json" && (echo $cmd >&2)
|
262
267
|
local limits=$($cmd) && (echo $limits | jq '.' >&2)
|
263
268
|
local limit=$(jq -r '.result[] | select(.name == env.limit_name)' <<< $limits)
|
264
269
|
|
@@ -426,7 +431,7 @@ pages:
|
|
426
431
|
fi
|
427
432
|
|
428
433
|
# install the package
|
429
|
-
local cmd="sfdx force:package:install --
|
434
|
+
local cmd="sfdx force:package:install --target-org $org_username --package $package_version_id --wait 10 --publishwait 10 --noprompt --json" && (echo $cmd >&2)
|
430
435
|
local output=$($cmd) && (echo $output | jq '.' >&2)
|
431
436
|
|
432
437
|
# assert no error response
|
@@ -470,7 +475,7 @@ pages:
|
|
470
475
|
exit 1;
|
471
476
|
fi
|
472
477
|
|
473
|
-
local cmd="sfdx force:org:open --
|
478
|
+
local cmd="sfdx force:org:open --target-org $org_username --urlonly --json" && (echo $cmd >&2)
|
474
479
|
local output=$($cmd) # don't echo/expose the output which contains the auth url
|
475
480
|
local url=$(jq -r ".result.url" <<< $output)
|
476
481
|
|
@@ -517,7 +522,7 @@ pages:
|
|
517
522
|
echo $scratch_org_username > SCRATCH_ORG_USERNAME.txt
|
518
523
|
|
519
524
|
# Get the auth URL
|
520
|
-
local cmd="sfdx force:org:display --verbose --
|
525
|
+
local cmd="sfdx force:org:display --verbose --target-org $org_username --json" && (echo $cmd >&2)
|
521
526
|
local output=$($cmd)
|
522
527
|
org_auth_url="$(jq -r '.result.sfdxAuthUrl' <<< $output)"
|
523
528
|
echo $org_auth_url > SCRATCH_ORG_AUTH_URL.txt
|
@@ -535,7 +540,7 @@ pages:
|
|
535
540
|
function get_scratch_org_usernames() {
|
536
541
|
local devhub=$1
|
537
542
|
local orgname=$2
|
538
|
-
local result=$(sfdx force:data:soql:query --
|
543
|
+
local result=$(sfdx force:data:soql:query --target-org $devhub --query "SELECT SignupUsername FROM ScratchOrgInfo WHERE OrgName='$orgname'" --json)
|
539
544
|
local usernames=$(jq -r ".result.records|map(.SignupUsername)|.[]" <<< $result)
|
540
545
|
echo $usernames
|
541
546
|
}
|
@@ -595,29 +600,32 @@ pages:
|
|
595
600
|
local usernames=$(get_scratch_org_usernames $devhub_username $scratch_org_name)
|
596
601
|
for scratch_org_username in $usernames; do
|
597
602
|
echo "Deleting $scratch_org_username"
|
598
|
-
local cmd="sfdx force:data:record:delete --sobjecttype ScratchOrgInfo --
|
603
|
+
local cmd="sfdx force:data:record:delete --sobjecttype ScratchOrgInfo --target-org $devhub_username --where "'"SignupUsername='$scratch_org_username'"'" --json" && (echo $cmd >&2)
|
599
604
|
local output=$($cmd) && (echo $output | jq '.' >&2)
|
600
605
|
done
|
601
606
|
}
|
602
607
|
|
603
608
|
function setup_integration_env() {
|
604
|
-
|
609
|
+
echo "Decrypt server key"
|
605
610
|
openssl aes-256-cbc -d -md md5 -in assets/server.key.enc -out assets/server.key -k $SERVER_KEY_PASSWORD
|
606
611
|
ls -la assets
|
607
|
-
install_jq
|
608
|
-
install_salesforce_cli
|
612
|
+
#install_jq
|
613
|
+
#install_salesforce_cli
|
609
614
|
# Integrated test
|
610
|
-
|
611
|
-
|
612
|
-
sfdx force:auth:jwt:grant --clientid "$SF_CONSUMER_KEY" --jwtkeyfile assets/server.key --username "$SF_USERNAME" --setdefaultdevhubusername --setalias HubOrg
|
615
|
+
|
616
|
+
sfdx force:auth:jwt:grant --client-id "$SF_CONSUMER_KEY" --jwt-key-file assets/server.key --username "$SF_USERNAME" --set-default-dev-hub --alias HubOrg
|
613
617
|
}
|
614
618
|
|
615
619
|
test:
|
616
|
-
image:
|
620
|
+
image: registry.gitlab.com/iqa_public/labs/salesforce_cicd_demo:latest
|
617
621
|
script:
|
618
622
|
# Decrypt server key
|
619
623
|
- *sfdx_helpers
|
620
624
|
- setup_integration_env
|
625
|
+
#- openssl aes-256-cbc -d -md md5 -in assets/server.key.enc -out assets/server.key -k $SERVER_KEY_PASSWORD
|
626
|
+
#- ls -la assets
|
627
|
+
- gem install bundler rake
|
628
|
+
- bundle install
|
621
629
|
- bundle exec rake check_oauth # Check OAuth
|
622
630
|
- bundle exec rake leaps:create_soql_objects
|
623
631
|
- bundle exec rake leaps:create_enums
|
data/ChangeLog
CHANGED
data/Rakefile
CHANGED
@@ -45,9 +45,10 @@ end
|
|
45
45
|
|
46
46
|
desc 'Example of cleaning up data'
|
47
47
|
task :remove_contacts do
|
48
|
+
require 'parallel'
|
48
49
|
contacts = Contact.where first_name: '!null'
|
49
50
|
puts "Deleting #{contacts.size} contacts"
|
50
|
-
|
51
|
+
Parallel.each(contacts) do |contact|
|
51
52
|
contact.delete
|
52
53
|
print '.'
|
53
54
|
end
|
data/leap_salesforce.gemspec
CHANGED
@@ -27,6 +27,7 @@ It reads the Metadata from Salesforce and creates the foundation for API tests.'
|
|
27
27
|
spec.require_paths = ['lib']
|
28
28
|
|
29
29
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
30
|
+
spec.add_development_dependency 'parallel'
|
30
31
|
spec.add_development_dependency 'pry'
|
31
32
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
32
33
|
spec.add_development_dependency 'semaphore_test_boosters'
|
data/lib/leap_salesforce/auth.rb
CHANGED
@@ -107,11 +107,11 @@ module LeapSalesforce
|
|
107
107
|
|
108
108
|
def from_output(variable)
|
109
109
|
var_line = sfdx_display_output.lines.find do |line|
|
110
|
-
line.start_with? variable
|
110
|
+
line.strip.start_with? variable
|
111
111
|
end
|
112
112
|
raise LeapSalesforce::SetupError, "Error retrieving from #{sfdx_display_output}" unless var_line
|
113
113
|
|
114
|
-
var_line.split[-1]
|
114
|
+
var_line.strip.split[-1]
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
@@ -1,2 +1,2 @@
|
|
1
|
-
sfdx force:auth:jwt:grant --
|
2
|
-
sfdx force:org:display --
|
1
|
+
sfdx force:auth:jwt:grant --client-id "$SF_CONSUMER_KEY" --jwt-key-file "$JWT_FOLDER"/server.key --username "$SF_USERNAME" --set-default-dev-hub --alias HubOrg
|
2
|
+
sfdx force:org:display --target-org "$SF_USERNAME"
|
@@ -1,3 +1,3 @@
|
|
1
1
|
# Get scratch ORG logging in via jwtkeyfile
|
2
|
-
sfdx force:auth:jwt:grant --
|
3
|
-
sfdx force:org:display --
|
2
|
+
sfdx force:auth:jwt:grant --client-id "$SF_CONSUMER_KEY" --jwt-key-file "$JWT_FOLDER"/server.key --username "$SF_USERNAME" --set-default-dev-hub --alias HubOrg
|
3
|
+
sfdx force:org:display --target-org "$SCRATCH_ORG_ALIAS"
|
@@ -1,4 +1,4 @@
|
|
1
1
|
# Get scratch ORG logging in via Auth url
|
2
2
|
#echo $org_auth_url > $file
|
3
|
-
sfdx force:auth:sfdxurl:store --sfdxurlfile "$file" --
|
4
|
-
sfdx force:org:display --
|
3
|
+
sfdx force:auth:sfdxurl:store --sfdxurlfile "$file" --alias HubOrg --json
|
4
|
+
sfdx force:org:display --target-org "$SCRATCH_ORG_ALIAS"
|
@@ -4,7 +4,7 @@
|
|
4
4
|
namespace :sfdx do
|
5
5
|
def login
|
6
6
|
puts 'Note these tasks are a work in progress'
|
7
|
-
puts `sfdx force:auth:jwt:grant --
|
7
|
+
puts `sfdx force:auth:jwt:grant --client-id $SF_CONSUMER_KEY --jwt-key-file "$JWT_FOLDER"/server.key --username $SF_USERNAME --set-default-dev-hub --alias HubOrg`
|
8
8
|
end
|
9
9
|
|
10
10
|
desc 'Login with credentials'
|
@@ -13,13 +13,13 @@ namespace :sfdx do
|
|
13
13
|
desc 'Display details about user'
|
14
14
|
task :display do
|
15
15
|
login
|
16
|
-
puts `sfdx force:org:display --
|
16
|
+
puts `sfdx force:org:display --target-org samuel.garratt@brave-otter-ttxype.com`
|
17
17
|
end
|
18
18
|
|
19
19
|
desc 'Create dev environment'
|
20
20
|
task :create_dev do
|
21
21
|
login
|
22
|
-
puts `sfdx force:org:create --targetdevhubusername HubOrg --setdefaultusername --definitionfile config/project-scratch-def.json --
|
22
|
+
puts `sfdx force:org:create --targetdevhubusername HubOrg --setdefaultusername --definitionfile config/project-scratch-def.json --alias $SCRATCH_ORG_ALIAS --wait 10 --durationdays 7`
|
23
23
|
end
|
24
24
|
|
25
25
|
desc 'Open environment in browser'
|
@@ -31,6 +31,6 @@ namespace :sfdx do
|
|
31
31
|
desc 'Delete dev environment'
|
32
32
|
task :delete_dev do
|
33
33
|
login
|
34
|
-
puts `sfdx force:org:delete --
|
34
|
+
puts `sfdx force:org:delete --target-org $SCRATCH_ORG_ALIAS --noprompt`
|
35
35
|
end
|
36
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leap_salesforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- IQA
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -25,6 +25,20 @@ dependencies:
|
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '2.0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: parallel
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: pry
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -371,7 +385,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
371
385
|
- !ruby/object:Gem::Version
|
372
386
|
version: '0'
|
373
387
|
requirements: []
|
374
|
-
rubygems_version: 3.
|
388
|
+
rubygems_version: 3.5.3
|
375
389
|
signing_key:
|
376
390
|
specification_version: 4
|
377
391
|
summary: Helps with setting up integrated automated test frameworks against Salesforce.
|