Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does "match nuke" support git branches? #9991

Closed
BennettSmith opened this issue Aug 8, 2017 · 10 comments
Closed

Does "match nuke" support git branches? #9991

BennettSmith opened this issue Aug 8, 2017 · 10 comments

Comments

@BennettSmith
Copy link

Issue Description

How can I cause match to generate new provisioning profiles for a single branch in my certificates/profiles git repo, using the correct team ID and team name for that Apple Developer account?

I have match setup to maintain two branches. They each have certificates and provisioning profiles for an app. One of the provisioning profiles is expiring soon. I would like to update it without changing anything else, but cannot seem to find a way for "match nuke" to only make changes to a specific branch.

Complete output when running fastlane, including the stack trace and command used

You can use: --capture_output as the last commandline argument to get that collected for you

No command run yet.

Environment

Please run fastlane env and copy the output below. This will help us help you 👍
If you used --capture_output option please remove this block - as it is already included there.

✅ fastlane environment ✅

Stack

Key Value
OS 10.12.6
Ruby 2.4.0
Bundler? true
Git git version 2.13.1
Installation Source ~/.rbenv/versions/2.4.0/bin/fastlane
Host Mac OS X 10.12.6 (16G29)
Ruby Lib Dir ~/.rbenv/versions/2.4.0/lib
OpenSSL Version OpenSSL 1.0.2j 26 Sep 2016
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 8.3.3

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
# vim: ft=ruby

import "Fastfile.helpers"

#   app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
#   team_id = CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
#   apple_id = CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)

fastlane_version "2.26.0"
REQUIRED_XCODE_VERSION = "8.3"
default_platform :ios

platform :ios do
  before_all do
    load_keys
    xcversion(version: "~> #{REQUIRED_XCODE_VERSION}")
  end

  after_all do
  end

  error do |lane, exception|
    slack(message: exception.message, success: false)
  end

  # This can be invoked MANUALLY by a developer to update her locally
  # stored certificates and profiles. It is also invoked during the
  # Xcode server integrations (See :before_integration, below).
  lane :certificates do
    app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
    team_id = CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
    match(git_branch: "#{team_id}", type: "development", app_identifier: "#{app_identifier}", readonly: true)
    match(git_branch: "#{team_id}", type: "adhoc", app_identifier: "#{app_identifier}", readonly: true)
    match(git_branch: "#{team_id}", type: "appstore", app_identifier: "#{app_identifier}", readonly: true)
  end

  # This should only be invoked via Xcode Server as part of the 
  # Blue Owl Mobile continuous integration builds.
  lane :before_integration do
    app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
    plist_file = "./HiRoad/Info-#{app_identifier}.plist"

    certificates

    version_number = get_info_plist_value(
      path: plist_file,
      key: 'CFBundleShortVersionString'
    )

    build_number = number_of_commits

    set_info_plist_value(
      path: plist_file,
      key: 'CFBundleVersion',
      value: "#{build_number}"
    )

    slack(
      message: "Starting Xcode Server Integration for HiRoad Build v#{version_number} (#{build_number})\nhttps://bender.local/xcode/bots/latest",
      channel: "#mobile-ci"
    )

  end

  lane :after_integration_develop do
    # Undo the badging of the app icon.
    reset_git_repo(force: true)
  end

  lane :after_integration_testflight do
    app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
    team_id = CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
    apple_id = CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
    plist_file = "./HiRoad/Info-#{app_identifier}.plist"

    ipa_path = ENV["XCS_PRODUCT"]
    if (defined?(ipa_path)).nil?
      UI.user_error!("XCS_PRODUCT not defined - IPA not produced - integration failed.")
    else
      build_number = get_info_plist_value(
        path: plist_file,
        key: 'CFBundleVersion'
      )

      version_number = get_info_plist_value(
        path: plist_file,
        key: 'CFBundleShortVersionString'
      )

      changelog = changelog_from_git_commits(
        pretty: "- (%ae) %s",
        date_format: "short",
        match_lightweight_tag: false,
        tag_match_pattern: "hiroad/v[[:digit:]]*",
        merge_commit_filtering: "exclude_merges"
      )

      beta_app_description = <<-BETA_APP_DESCRIPTION
        Mobile app supporting HiRoad insurance product.
      BETA_APP_DESCRIPTION

      # Fails if skip_waiting_for_build_processing set to false. Related to
      # changes Apple made to the TestFlight support in iTunesConnect.
      # Fastlane devs are working on a solution. The work can be tracked
      # here: https://github.com/fastlane/fastlane/pull/8871
      testflight(
        username: apple_id,
        team_id: team_id,
        app_identifier: app_identifier,
        ipa: "#{ipa_path}",
        skip_submission: true,
        skip_waiting_for_build_processing: true,
        beta_app_description: "#{beta_app_description}",
        beta_app_feedback_email: "johnny.appleseed@blueowl.xyz",
        distribute_external: false,
        changelog: "#{changelog}"
      )

      add_git_tag(
        tag: "hiroad/v#{version_number}_#{build_number}",
        force: true
      )

      push_to_git_remote
      push_git_tags

      slack(
        message: "HiRoad Build v#{version_number} (#{build_number}) Available for TestFlight Internal Testing\nRelease notes:\n #{changelog}",
        channel: "#mobile-ci"
      )
    end
  end
end
`./fastlane/Appfile`
#######################################################################
# Default values used for in-house development as part of
# the Blue Owl team. Can be overridden using environment variables.
#######################################################################

apple_id ENV["APPLE_ID"] || "ios-dev@blueowl.xyz"
app_identifier ENV["APP_IDENTIFIER"] || "xyz.blueowl.mobile"
team_id ENV["TEAM_ID"] || "5SVPC2KG65"

# Examples of accessing these values for fastlane
#   identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
#   team_id = CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
#   apple_id = CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)

fastlane gems

Gem Version Update-Status
fastlane 2.51.0 ✅ Up-To-Date

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-badge 0.8.2 ✅ Up-To-Date
Loaded gems
Gem Version
did_you_mean 1.1.2
bundler 1.15.3
io-console 0.4.6
CFPropertyList 2.3.5
i18n 0.8.6
minitest 5.10.3
thread_safe 0.3.6
tzinfo 1.2.3
activesupport 4.2.9
public_suffix 2.0.5
addressable 2.5.1
babosa 1.0.2
curb 0.9.3
fastimage 2.1.0
colored 1.2
highline 1.7.8
commander-fastlane 4.4.5
dotenv 2.2.1
excon 0.58.0
multipart-post 2.0.0
faraday 0.12.2
unf_ext 0.0.7.4
unf 0.1.4
domain_name 0.5.20170404
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
faraday_middleware 0.12.2
gh_inspector 1.0.3
jwt 1.5.6
little-plugger 1.1.4
multi_json 1.12.1
logging 2.2.2
memoist 0.16.0
os 0.9.6
signet 0.7.3
googleauth 0.5.3
httpclient 2.8.3
mime-types-data 3.2016.0521
mime-types 3.1
declarative 0.0.9
declarative-option 0.1.0
uber 0.1.0
representable 3.0.4
retriable 3.1.1
google-api-client 0.12.0
json 2.1.0
mini_magick 4.5.1
multi_xml 0.6.0
plist 3.3.0
rubyzip 1.2.1
security 0.1.3
slack-notifier 1.5.1
terminal-notifier 1.8.0
unicode-display_width 1.3.0
terminal-table 1.8.0
tty-screen 0.5.0
word_wrap 1.0.0
claide 1.0.2
colored2 3.1.2
nanaimo 0.2.3
xcodeproj 1.5.1
rouge 2.0.7
xcpretty 0.2.8
xcpretty-travis-formatter 0.0.4
badge 0.8.4
fuzzy_match 2.0.4
nap 1.1.0
cocoapods-core 1.3.1
cocoapods-deintegrate 1.0.1
cocoapods-downloader 1.1.3
cocoapods-plugins 1.0.0
cocoapods-search 1.0.0
cocoapods-stats 1.0.0
netrc 0.7.8
cocoapods-trunk 1.2.0
cocoapods-try 1.1.0
escape 0.0.4
fourflusher 2.0.1
molinillo 0.5.7
ruby-macho 1.1.0
cocoapods 1.3.1
fastlane-plugin-badge 0.8.2
sbconstants 1.2.0
xcode-install 2.2.0

generated on: 2017-08-08

@fastlane-bot
Copy link

It seems like this issue might be related to code signing 🚫

Have you seen our new Code Signing Troubleshooting Guide? It will help you resolve the most common code signing issues 👍

@BennettSmith
Copy link
Author

I have read through the code signing guide. I don't find any discussion of how nuke works with multiple branches in the git repo where certs and profiles are stored.

@ghost
Copy link

ghost commented Aug 8, 2017

You don't have to use nuke for just one profile. You can use the force flag to force the generation of specific new assets .

Here's a better doc on match vs the docs website: https://github.com/fastlane/fastlane/blob/master/match/README.md#nuke

My understanding it nuke is account based, not git based. So it'll nuke all the certificates and profiles of an apple developer account ignoring your git strategy.

@KrauseFx
Copy link
Member

KrauseFx commented Aug 8, 2017

Yep, the force parameter should help 👍

@BennettSmith
Copy link
Author

Does nuke know about the --team_id and --team_name values? This is what the usage message shows:

% bundle exec fastlane match nuke --help

  nuke

  Usage: fastlane match nuke

  Delete all certificates and provisioning profiles from the Apple Dev Portal

Maybe I misunderstand the nuke command. I was under the impression it would blow away the provisioning profiles and certificates and clean up the files stored in the git repo on the branch where match stores those files. If it just blows away content in the Developer Portal account, is there an easier way to refresh an expiring provisioning profile without using "nuke" at all?

@KrauseFx
Copy link
Member

KrauseFx commented Aug 9, 2017

You should be able to just remove the profile manually from git and the dev portal, and match should auto-detect it's missing and create a new one for you 👍

@hernangonzalez
Copy link

I've been removing them from git myself, though I was expecting it would do it self. They really have no use, and match will fail otherwise.

@KrauseFx
Copy link
Member

match should automatically re-generate the profiles and certs if necessary. Could you provide the complete output of a run where that didn't happen without you manually interfering on the developer portal. If that's the case, this is a high priority issue for us, and we'll do our best to reproduce the issue and try to work on a fix

@fastlane-bot
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest fastlane version and check if that solves the issue. Let us know if that works for you by adding a comment 👍

@fastlane-bot
Copy link

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍

@fastlane fastlane locked and limited conversation to collaborators Dec 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants