Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- $LOAD_PATH.push File.expand_path("spaceship/lib")
- require "spaceship"
- require "date"
- require 'rubygems'
- require 'dogapi'
- # this application requiers fastlane installed and sapceship working.
- # in addition please install datadig api for ruby
- # Datadog api keys
- api_key = API_KEY
- application_key = APPLICATION_KEY
- max_days = 30 # maximum day before alerting
- user = APPLE_ACCOUNT
- password = APPLE_ACCOUNT_PASSWORD
- # Create a statsd client instance.
- dog = Dogapi::Client.new(api_key, application_key)
- # Log in to apple developer console
- Spaceship::Portal.login(user, password)
- # for eatch team write the name of the team the the certificate that will expires in $max_days
- teams = Spaceship::Portal.client.teams
- teams.each do |team|
- puts "#############"
- print "team: #{team['name']}\n"
- Spaceship::Portal.client.team_id = team['teamId']
- certificates = Spaceship::Portal.certificate.all
- certificates.each do |elem|
- name = elem.raw_data["certificate"]['name']
- date = Date.parse elem.raw_data["certificate"]['expirationDate']
- if date <= Date.today + max_days
- expiresin = date - Date.today
- dog.emit_point('apple.certificate.expires_in', expiresin, :tags => ["Name:#{name}"])
- print "#{name} expires in #{expiresin} days\n"
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement