Module: KeychainUtil

Includes:
LoggerUtil
Defined in:
lib/jenkins_util/keychain_util.rb

Class Method Summary collapse

Methods included from LoggerUtil

fatal, log, verbose?

Class Method Details

.exec_code_sign_identities(desired_identities) ⇒ Object



37
38
39
40
41
# File 'lib/jenkins_util/keychain_util.rb', line 37

def self.exec_code_sign_identities(desired_identities)
  code_sign_command = CommandLineScript.new("#{@security_executable} find-identity -p codesigning -v")

  validate_identities(code_sign_command.stdout, desired_identities)
end

.exec_provisioning_profilesObject

TODO: implment and pass desired_profiles



44
45
46
47
# File 'lib/jenkins_util/keychain_util.rb', line 44

def self.exec_provisioning_profiles
  CommandLineScript.new("#{@security_executable} find-certificate -a -Z")
  # check_provisioning_profiles
end

.exec_unlock_keychain(keychain, password) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/jenkins_util/keychain_util.rb', line 26

def self.exec_unlock_keychain(keychain, password)
  # This command registers keychain in keychain tool
  CommandLineScript.new("#{@security_executable} list-keychain -s #{keychain}")

  # Unlock key-chain
  CommandLineScript.new("#{@security_executable} unlock-keychain -p #{password} #{keychain}")

  # Change default timeout
  CommandLineScript.new("#{@security_executable} set-keychain-settings -lut 7200 #{keychain}")
end

.unlock_keychain(keychain, password, code_signing_identities) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/jenkins_util/keychain_util.rb', line 11

def self.unlock_keychain(keychain, password, code_signing_identities)
  unless File.exist?(@security_executable) && File.exist?(keychain)
    LoggerUtil.log.fatal('security executable or keychain is not found')
    abort
  end

  if password.nil? || password.to_s.empty?
    LoggerUtil.log.fatal('Password is empty')
    abort
  end

  exec_unlock_keychain(keychain, password)
  exec_code_sign_identities(code_signing_identities)
end