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

Match uses git private key to download but not to push new certs back #19266

Closed
4 tasks done
laurentS opened this issue Aug 22, 2021 · 5 comments · Fixed by #21360
Closed
4 tasks done

Match uses git private key to download but not to push new certs back #19266

laurentS opened this issue Aug 22, 2021 · 5 comments · Fixed by #21360

Comments

@laurentS
Copy link

New Issue Checklist

Issue Description

I try to renew certificates using match. My certs are stored in a gitlab repo. The command uses my git private key correctly to download the certs, but somehow seems to think it's not a valid file anymore when pushing back to git. Basically the test at

if File.file?(self.git_private_key)
seems to first be true, then false, and I can't figure out why.
I'm running fastlane 2.191.0. The entire log is visible at https://github.com/mapswipe/mapswipe/runs/3395027436?check_suite_focus=true (under "TEMP renew dev certificate").

The key has push permissions on gitlab, and the logs show that somehow fastlane does not load it properly the second time it uses it (when pushing), ie: it's not a gitlab issue. Specifically in the logs:

Cloning remote git repo...
$ ssh-agent bash -c 'ssh-add /Users/runner/work/mapswipe/mapswipe/ios/cfg/mapswipe.dev_at_gmail_rsa_key_for_travis_ci; git clone git@gitlab.com:mapswipe/ios-certificates.git /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20210822-14001-1a8x8m6 -b master --single-branch'

and when pushing (note the ssh-add command is now different):

Private key file does not exist, will continue by using it as a raw key.
INFO [2021-08-22 22:21:51.65]: Pushing changes to remote git repo...
INFO [2021-08-22 22:21:51.65]: $ git add /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20210822-14001-1a8x8m6/certs/development/BM87LANFVB.cer
INFO [2021-08-22 22:21:51.78]: $ git add /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20210822-14001-1a8x8m6/certs/development/BM87LANFVB.p12
INFO [2021-08-22 22:21:51.91]: $ git add /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20210822-14001-1a8x8m6/profiles/development/Development_org.missingmaps.mapswipe-dev.mobileprovision
INFO [2021-08-22 22:21:52.05]: $ git add match_version.txt
INFO [2021-08-22 22:21:52.18]: $ git commit -m \[fastlane\]\ Updated\ development\ and\ platform\ ios
INFO [2021-08-22 22:21:53.02]: ▸ [master 0e80e90] [fastlane] Updated development and platform ios
INFO [2021-08-22 22:21:53.02]: ▸  Committer: runner <runner@Mac-1629670511083.local>
INFO [2021-08-22 22:21:53.03]: ▸  4 files changed, 448 insertions(+), 1 deletion(-)
INFO [2021-08-22 22:21:53.03]: ▸  create mode 100644 certs/development/BM87LANFVB.cer
INFO [2021-08-22 22:21:53.03]: ▸  create mode 100644 certs/development/BM87LANFVB.p12
INFO [2021-08-22 22:21:53.03]: ▸  create mode 100644 profiles/development/Development_org.missingmaps.mapswipe-dev.mobileprovision
INFO [2021-08-22 22:21:53.03]: $ ssh-agent bash -c 'ssh-add - <<< "cfg/mapswipe.dev_at_gmail_rsa_key_for_travis_ci"; git push origin master'
INFO [2021-08-22 22:21:53.14]: ▸ Error loading key "(stdin)": invalid format
INFO [2021-08-22 22:21:53.67]: ▸ git@gitlab.com: Permission denied (publickey,keyboard-interactive).
INFO [2021-08-22 22:21:53.67]: ▸ fatal: Could not read from remote repository.
INFO [2021-08-22 22:21:53.67]: ▸ Please make sure you have the correct access rights
INFO [2021-08-22 22:21:53.67]: ▸ and the repository exists.
Command executed
match(type: "development", app_identifier: "org.missingmaps.mapswipe-dev", readonly: false, verbose: true)

I also tried the following variant, inspired by
0e4d620
but neither work, they both seem to have the same result.

match(type: "development", app_identifier: "org.missingmaps.mapswipe-dev", readonly: false, verbose: true, git_private_key: "cfg/mapswipe.dev_at_gmail_rsa_key_for_travis_ci")
Complete output when running fastlane, including the stack trace and command used
 [22:21:22]: ------------------------------
[22:21:22]: --- Step: default_platform ---
[22:21:22]: ------------------------------
[22:21:22]: --------------------------
[22:21:22]: --- Step: setup_travis ---
[22:21:22]: --------------------------
[22:21:22]: Creating temporary keychain: "fastlane_tmp_keychain".
[22:21:22]: $ security list-keychains -d user
[22:21:22]: ▸ "/Users/runner/Library/Keychains/fastlane_tmp_keychain-db"
[22:21:22]: Found keychain '/Users/runner/Library/Keychains/fastlane_tmp_keychain-db' in list-keychains, adding to search list skipped
[22:21:22]: Enabling match readonly mode.
[22:21:22]: Driving the lane 'ios matchDev' 🚀
INFO [2021-08-22 22:21:23.22]: -------------------
INFO [2021-08-22 22:21:23.22]: --- Step: match ---
INFO [2021-08-22 22:21:23.22]: -------------------
INFO [2021-08-22 22:21:23.22]: Successfully loaded '/Users/runner/work/mapswipe/mapswipe/ios/fastlane/Matchfile' 📄

+-----------------------+-------------------------------------------------+
| Detected Values from './fastlane/Matchfile' |
+-----------------------+-------------------------------------------------+
| git_url | git@gitlab.com:mapswipe/ios-certificates.git |
| type | development |
| clone_branch_directly | true |
| app_identifier | org.missingmaps.mapswipe |
| username | mapswipe.dev@gmail.com |
| git_private_key | cfg/mapswipe.dev_at_gmail_rsa_key_for_travis_ci |
| team_id | N4W28E5PA4 |
+-----------------------+-------------------------------------------------+

+--------------------------------+----------------------------------------------+
| Summary for match 2.191.0 |
+--------------------------------+----------------------------------------------+
| type | development |
| app_identifier | ["org.missingmaps.mapswipe-dev"] |
| readonly | false |
| verbose | true |
| git_private_key | ******** |
| generate_apple_certs | true |
| skip_provisioning_profiles | false |
| username | mapswipe.dev@gmail.com |
| team_id | N4W28E5PA4 |
| storage_mode | git |
| git_url | git@gitlab.com:mapswipe/ios-certificates.git |
| git_branch | master |
| shallow_clone | false |
| clone_branch_directly | true |
| keychain_name | fastlane_tmp_keychain |
| force | false |
| force_for_new_devices | false |
| skip_confirmation | false |
| skip_docs | false |
| platform | ios |
| derive_catalyst_app_identifier | false |
| fail_on_name_taken | false |
| skip_certificate_matching | false |
| skip_set_partition_list | false |
+--------------------------------+----------------------------------------------+

INFO [2021-08-22 22:21:23.23]: Cloning remote git repo...
INFO [2021-08-22 22:21:23.23]: $ ssh-agent bash -c 'ssh-add /Users/runner/work/mapswipe/mapswipe/ios/cfg/mapswipe.dev_at_gmail_rsa_key_for_travis_ci; git clone git@gitlab.com:mapswipe/ios-certificates.git /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20210822-14001-1a8x8m6 -b master --single-branch'
INFO [2021-08-22 22:21:25.74]: ▸ Identity added: /Users/runner/work/mapswipe/mapswipe/ios/cfg/mapswipe.dev_at_gmail_rsa_key_for_travis_ci (mapswipe.dev@gmail.com)
INFO [2021-08-22 22:21:25.83]: ▸ Cloning into '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20210822-14001-1a8x8m6'...
INFO [2021-08-22 22:21:28.07]: ▸ Warning: Permanently added the ECDSA host key for IP address '172.65.251.78' to the list of known hosts.
INFO [2021-08-22 22:21:29.06]: ▸ remote: Enumerating objects: 153, done.
INFO [2021-08-22 22:21:29.06]: ▸ remote: Counting objects: 100% (130/130), done.
INFO [2021-08-22 22:21:29.13]: ▸ remote: Compressing objects: 100% (97/97), done.
INFO [2021-08-22 22:21:29.28]: ▸ remote: Total 153 (delta 29), reused 102 (delta 19), pack-reused 23
INFO [2021-08-22 22:21:29.28]: ▸ Receiving objects: 100% (153/153), 169.52 KiB | 1.15 MiB/s, done.
INFO [2021-08-22 22:21:29.32]: ▸ Resolving deltas: 100% (30/30), done.
INFO [2021-08-22 22:21:30.40]: $ git --no-pager branch --list origin/master --no-color -r
INFO [2021-08-22 22:21:30.41]: ▸ origin/master
INFO [2021-08-22 22:21:30.41]: Checking out branch master...
INFO [2021-08-22 22:21:30.41]: $ git checkout master
INFO [2021-08-22 22:21:30.62]: ▸ Already on 'master'
INFO [2021-08-22 22:21:30.62]: ▸ Your branch is up to date with 'origin/master'.
INFO [2021-08-22 22:21:30.67]: 🔓 Decrypted 'Development_org.missingmaps.mapswipe.mobileprovision'
INFO [2021-08-22 22:21:30.67]: 🔓 Successfully decrypted certificates repo
INFO [2021-08-22 22:21:30.67]: Verifying that the certificate and profile are still valid on the Dev Portal...
Reading keychain entry, because either user or password were empty
Loading session from environment variable
WARN [2021-08-22 22:21:31.90]: Couldn't find a valid code signing identity for development... creating one for you now

+-------------------------+----------------------------------------------------------+
| Summary for cert 2.191.0 |
+-------------------------+----------------------------------------------------------+
| platform | ios |
| development | true |
| generate_apple_certs | true |
| force | true |
| username | mapswipe.dev@gmail.com |
| team_id | N4W28E5PA4 |
| keychain_path | /Users/runner/Library/Keychains/fastlane_tmp_keychain-db |
| skip_set_partition_list | false |
+-------------------------+----------------------------------------------------------+

INFO [2021-08-22 22:21:31.91]: Starting login with user 'mapswipe.dev@gmail.com'
Reading keychain entry, because either user or password were empty
Loading session from environment variable
INFO [2021-08-22 22:21:32.55]: Successfully logged in
INFO [2021-08-22 22:21:32.94]: $ security import /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20210822-14001-1a8x8m6/certs/development/BM87LANFVB.p12 -k '/Users/runner/Library/Keychains/fastlane_tmp_keychain-db' -P ******** -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
INFO [2021-08-22 22:21:33.74]: ▸ 1 key imported.
INFO [2021-08-22 22:21:33.75]: Setting key partition list... (this can take a minute if there are a lot of keys installed)
INFO [2021-08-22 22:21:33.75]: $ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k ******** /Users/runner/Library/Keychains/fastlane_tmp_keychain-db 1> /dev/null
INFO [2021-08-22 22:21:34.12]: $ security import /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20210822-14001-1a8x8m6/certs/development/BM87LANFVB.cer -k '/Users/runner/Library/Keychains/fastlane_tmp_keychain-db' -P ******** -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
INFO [2021-08-22 22:21:34.51]: ▸ 1 certificate imported.
INFO [2021-08-22 22:21:34.52]: Setting key partition list... (this can take a minute if there are a lot of keys installed)
INFO [2021-08-22 22:21:34.52]: $ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k ******** /Users/runner/Library/Keychains/fastlane_tmp_keychain-db 1> /dev/null
INFO [2021-08-22 22:21:36.41]: Successfully generated BM87LANFVB which was imported to the local machine.
INFO [2021-08-22 22:21:36.41]: $ security list-keychains -d user
INFO [2021-08-22 22:21:36.42]: ▸ "/Users/runner/Library/Keychains/fastlane_tmp_keychain-db"
INFO [2021-08-22 22:21:36.42]: $ security find-certificate -a -c 'Apple Worldwide Developer Relations Certification Authority' /Users/runner/Library/Keychains/fastlane_tmp_keychain-db
INFO [2021-08-22 22:21:36.53]: $ security list-keychains -d user
INFO [2021-08-22 22:21:36.54]: ▸ "/Users/runner/Library/Keychains/fastlane_tmp_keychain-db"
DEBUG [2021-08-22 22:21:36.54]: Installing WWDR Cert: curl -f -o /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/AppleWWDRCA.cer20210822-14001-zu7yox https://developer.apple.com/certificationauthority/AppleWWDRCA.cer && security import /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/AppleWWDRCA.cer20210822-14001-zu7yox -k /Users/runner/Library/Keychains/fastlane_tmp_keychain-db
INFO [2021-08-22 22:21:43.33]: ▸ 1 certificate imported.
INFO [2021-08-22 22:21:43.33]: ▸ 100 1062 100 1062 0 0 258 0 0:00:04 0:00:04 --:--:-- 264
INFO [2021-08-22 22:21:43.33]: $ security list-keychains -d user
INFO [2021-08-22 22:21:43.34]: ▸ "/Users/runner/Library/Keychains/fastlane_tmp_keychain-db"
DEBUG [2021-08-22 22:21:43.34]: Installing WWDR Cert: curl -f -o /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/AppleWWDRCAG3.cer20210822-14001-92nrzm https://www.apple.com/certificateauthority/AppleWWDRCAG3.cer && security import /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/AppleWWDRCAG3.cer20210822-14001-92nrzm -k /Users/runner/Library/Keychains/fastlane_tmp_keychain-db
INFO [2021-08-22 22:21:45.95]: ▸ 1 certificate imported.
INFO [2021-08-22 22:21:45.95]: ▸ 100 1109 100 1109 0 0 9928 0 --:--:-- --:--:-- --:--:-- 10364
INFO [2021-08-22 22:21:46.82]: Verifying the certificate is properly installed locally...
INFO [2021-08-22 22:21:46.82]: Successfully installed certificate BM87LANFVB

+-------------------------------------+------------------------------------------------+
| Summary for sigh 2.191.0 |
+-------------------------------------+------------------------------------------------+
| app_identifier | org.missingmaps.mapswipe-dev |
| username | mapswipe.dev@gmail.com |
| force | false |
| cert_id | BM87LANFVB |
| provisioning_name | match Development org.missingmaps.mapswipe-dev |
| ignore_profiles_with_different_name | true |
| team_id | N4W28E5PA4 |
| fail_on_name_taken | false |
| platform | ios |
| development | true |
| adhoc | false |
| developer_id | false |
| skip_install | false |
| skip_fetch_profiles | false |
| skip_certificate_verification | false |
| readonly | false |
+-------------------------------------+------------------------------------------------+

INFO [2021-08-22 22:21:47.07]: Starting login with user 'mapswipe.dev@gmail.com'
Reading keychain entry, because either user or password were empty
Loading session from environment variable
INFO [2021-08-22 22:21:47.67]: Successfully logged in
INFO [2021-08-22 22:21:47.67]: Fetching profiles...
INFO [2021-08-22 22:21:47.84]: Verifying certificates...
WARN [2021-08-22 22:21:47.84]: No existing profiles found, that match the certificates you have installed locally! Creating a new provisioning profile for you
WARN [2021-08-22 22:21:48.25]: Creating new provisioning profile for 'org.missingmaps.mapswipe-dev' with name 'match Development org.missingmaps.mapswipe-dev' for 'ios' platform
INFO [2021-08-22 22:21:48.42]: $ security list-keychains -d user
INFO [2021-08-22 22:21:48.43]: ▸ "/Users/runner/Library/Keychains/fastlane_tmp_keychain-db"
INFO [2021-08-22 22:21:48.43]: $ security find-certificate -a -c 'Apple Worldwide Developer Relations Certification Authority' /Users/runner/Library/Keychains/fastlane_tmp_keychain-db
INFO [2021-08-22 22:21:48.58]: ▸ keychain: "/Users/runner/Library/Keychains/fastlane_tmp_keychain-db"
INFO [2021-08-22 22:21:48.58]: ▸ version: 512
INFO [2021-08-22 22:21:48.58]: ▸ class: 0x80001000
INFO [2021-08-22 22:21:48.58]: ▸ attributes:
INFO [2021-08-22 22:21:48.58]: ▸ "alis"="Apple Worldwide Developer Relations Certification Authority"
INFO [2021-08-22 22:21:48.58]: ▸ "cenc"=0x00000003
INFO [2021-08-22 22:21:48.58]: ▸ "ctyp"=0x00000001
INFO [2021-08-22 22:21:48.58]: ▸ "hpky"=0x88271709A9B618608BECEBBAF64759C55254A3B7 "\210'\027\011\251\266\030\213\354\353\272\366GY\305RT\243\267" INFO [2021-08-22 22:21:48.58]: ▸ "issu"<blob>=0x3062310B300906035504061302555331133011060355040A130A4150504C4520494E432E31263024060355040B131D4150504C452043455254494649434154494F4E20415554484F52495459311630140603550403130D4150504C4520524F4F54204341 "0b1\0130\011\006\003U\004\006\023\002US1\0230\021\006\003U\004\012\023\012APPLE INC.1&0$\006\003U\004\013\023\035APPLE CERTIFICATION AUTHORITY1\0260\024\006\003U\004\003\023\015APPLE ROOT CA" INFO [2021-08-22 22:21:48.58]: ▸ "labl"<blob>="Apple Worldwide Developer Relations Certification Authority" INFO [2021-08-22 22:21:48.58]: ▸ "skid"<blob>=0x88271709A9B618608BECEBBAF64759C55254A3B7 "\210'\027\011\251\266\030\213\354\353\272\366GY\305RT\243\267"
INFO [2021-08-22 22:21:48.58]: ▸ "snbr"=0x01DEBCC4396DA010 "\001\336\274\3049m\240\020"
INFO [2021-08-22 22:21:48.58]: ▸ "subj"=0x308196310B300906035504061302555331133011060355040A0C0A4170706C6520496E632E312C302A060355040B0C234170706C6520576F726C647769646520446576656C6F7065722052656C6174696F6E733144304206035504030C3B4170706C6520576F726C647769646520446576656C6F7065722052656C6174696F6E732043657274696669636174696F6E20417574686F72697479 "0\201\2261\0130\011\006\003U\004\006\023\002US1\0230\021\006\003U\004\012\014\012Apple Inc.1,0*\006\003U\004\013\014#Apple Worldwide Developer Relations1D0B\006\003U\004\003\014;Apple Worldwide Developer Relations Certification Authority"
INFO [2021-08-22 22:21:48.58]: ▸ keychain: "/Users/runner/Library/Keychains/fastlane_tmp_keychain-db"
INFO [2021-08-22 22:21:48.58]: ▸ version: 512
INFO [2021-08-22 22:21:48.58]: ▸ class: 0x80001000
INFO [2021-08-22 22:21:48.58]: ▸ attributes:
INFO [2021-08-22 22:21:48.58]: ▸ "alis"="Apple Worldwide Developer Relations Certification Authority"
INFO [2021-08-22 22:21:48.58]: ▸ "cenc"=0x00000003
INFO [2021-08-22 22:21:48.58]: ▸ "ctyp"=0x00000001
INFO [2021-08-22 22:21:48.58]: ▸ "hpky"=0x09FEC01590F9AF640A9212B92628630C97ECA7B2 "\011\376\300\025\220\371\257d\012\222\022\271&(c\014\227\354\247\262"
INFO [2021-08-22 22:21:48.58]: ▸ "issu"=0x3062310B300906035504061302555331133011060355040A130A4150504C4520494E432E31263024060355040B131D4150504C452043455254494649434154494F4E20415554484F52495459311630140603550403130D4150504C4520524F4F54204341 "0b1\0130\011\006\003U\004\006\023\002US1\0230\021\006\003U\004\012\023\012APPLE INC.1&0$\006\003U\004\013\023\035APPLE CERTIFICATION AUTHORITY1\0260\024\006\003U\004\003\023\015APPLE ROOT CA"
INFO [2021-08-22 22:21:48.58]: ▸ "labl"="Apple Worldwide Developer Relations Certification Authority"
INFO [2021-08-22 22:21:48.58]: ▸ "skid"=0x09FEC01590F9AF640A9212B92628630C97ECA7B2 "\011\376\300\025\220\371\257d\012\222\022\271&(c\014\227\354\247\262"
INFO [2021-08-22 22:21:48.58]: ▸ "snbr"=0x7CAF690A25B739FE7B9B447AC178C5EE "|\257i\012%\2679\376{\233Dz\301x\305\356"
INFO [2021-08-22 22:21:48.58]: ▸ "subj"=0x30753144304206035504030C3B4170706C6520576F726C647769646520446576656C6F7065722052656C6174696F6E732043657274696669636174696F6E20417574686F72697479310B3009060355040B0C02473331133011060355040A0C0A4170706C6520496E632E310B3009060355040613025553 "0u1D0B\006\003U\004\003\014;Apple Worldwide Developer Relations Certification Authority1\0130\011\006\003U\004\013\014\002G31\0230\021\006\003U\004\012\014\012Apple Inc.1\0130\011\006\003U\004\006\023\002US"
WARN [2021-08-22 22:21:49.45]: Downloading provisioning profile...
INFO [2021-08-22 22:21:49.49]: Successfully downloaded provisioning profile...
INFO [2021-08-22 22:21:50.19]: Installing provisioning profile...
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20210822-14001-1a8x8m6/profiles/development/Development_org.missingmaps.mapswipe-dev.mobileprovision
INFO [2021-08-22 22:21:50.59]: Installing provisioning profile...
WARN [2021-08-22 22:21:51.36]: Setting environment variable 'sigh_org.missingmaps.mapswipe-dev_development' to 'c843f77b-79f4-47b3-9c09-3ddba5e5ec8d'
WARN [2021-08-22 22:21:51.36]: Setting environment variable 'sigh_org.missingmaps.mapswipe-dev_development_team-id' to 'N4W28E5PA4'
WARN [2021-08-22 22:21:51.36]: Setting environment variable 'sigh_org.missingmaps.mapswipe-dev_development_profile-name' to 'match Development org.missingmaps.mapswipe-dev'
WARN [2021-08-22 22:21:51.36]: Setting environment variable 'sigh_org.missingmaps.mapswipe-dev_development_profile-path' to '/Users/runner/Library/MobileDevice/Provisioning Profiles/c843f77b-79f4-47b3-9c09-3ddba5e5ec8d.mobileprovision'
INFO [2021-08-22 22:21:51.40]: 🔒 Encrypted 'BM87LANFVB.p12'
INFO [2021-08-22 22:21:51.48]: 🔒 Encrypted 'BM87LANFVB.cer'
INFO [2021-08-22 22:21:51.52]: 🔒 Encrypted 'Development_org.missingmaps.mapswipe.mobileprovision'
INFO [2021-08-22 22:21:51.60]: 🔒 Encrypted 'Development_org.missingmaps.mapswipe-dev.mobileprovision'
INFO [2021-08-22 22:21:51.60]: 🔒 Successfully encrypted certificates repo
INFO [2021-08-22 22:21:51.64]: Private key file does not exist, will continue by using it as a raw key.
INFO [2021-08-22 22:21:51.65]: Pushing changes to remote git repo...
INFO [2021-08-22 22:21:51.65]: $ git add /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20210822-14001-1a8x8m6/certs/development/BM87LANFVB.cer
INFO [2021-08-22 22:21:51.78]: $ git add /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20210822-14001-1a8x8m6/certs/development/BM87LANFVB.p12
INFO [2021-08-22 22:21:51.91]: $ git add /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20210822-14001-1a8x8m6/profiles/development/Development_org.missingmaps.mapswipe-dev.mobileprovision
INFO [2021-08-22 22:21:52.05]: $ git add match_version.txt
INFO [2021-08-22 22:21:52.18]: $ git commit -m [fastlane]\ Updated\ development\ and\ platform\ ios
INFO [2021-08-22 22:21:53.02]: ▸ [master 0e80e90] [fastlane] Updated development and platform ios
INFO [2021-08-22 22:21:53.02]: ▸ Committer: runner runner@Mac-1629670511083.local
INFO [2021-08-22 22:21:53.03]: ▸ 4 files changed, 448 insertions(+), 1 deletion(-)
INFO [2021-08-22 22:21:53.03]: ▸ create mode 100644 certs/development/BM87LANFVB.cer
INFO [2021-08-22 22:21:53.03]: ▸ create mode 100644 certs/development/BM87LANFVB.p12
INFO [2021-08-22 22:21:53.03]: ▸ create mode 100644 profiles/development/Development_org.missingmaps.mapswipe-dev.mobileprovision
INFO [2021-08-22 22:21:53.03]: $ ssh-agent bash -c 'ssh-add - <<< "cfg/mapswipe.dev_at_gmail_rsa_key_for_travis_ci"; git push origin master'
INFO [2021-08-22 22:21:53.14]: ▸ Error loading key "(stdin)": invalid format
INFO [2021-08-22 22:21:53.67]: ▸ git@gitlab.com: Permission denied (publickey,keyboard-interactive).
INFO [2021-08-22 22:21:53.67]: ▸ fatal: Could not read from remote repository.
INFO [2021-08-22 22:21:53.67]: ▸ Please make sure you have the correct access rights
INFO [2021-08-22 22:21:53.67]: ▸ and the repository exists.
Error loading key "(stdin)": invalid format
git@gitlab.com: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
ERROR [2021-08-22 22:21:53.68]: Exit status: 128
ERROR [2021-08-22 22:21:53.68]: Couldn't commit or push changes back to git...
ERROR [2021-08-22 22:21:53.68]: Exit status: 128
INFO [2021-08-22 22:21:53.68]: Finished uploading files to Git Repo [git@gitlab.com:mapswipe/ios-certificates.git]

+---------------------+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+
| Installed Provisioning Profile |
+---------------------+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+
| Parameter | Environment Variable | Value |
+---------------------+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+
| App Identifier | | org.missingmaps.mapswipe-dev |
| Type | | development |
| Platform | | ios |
| Profile UUID | sigh_org.missingmaps.mapswipe-dev_development | c843f77b-79f4-47b3-9c09-3ddba5e5ec8d |
| Profile Name | sigh_org.missingmaps.mapswipe-dev_development_profile-name | match Development org.missingmaps.mapswipe-dev |
| Profile Path | sigh_org.missingmaps.mapswipe-dev_development_profile-path | /Users/runner/Library/MobileDevice/Provisioning Profiles/c843f77b-79f4-47b3-9c09-3ddba5e5ec8d.mobileprovision |
| Development Team ID | sigh_org.missingmaps.mapswipe-dev_development_team-id | N4W28E5PA4 |
+---------------------+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+

INFO [2021-08-22 22:21:53.69]: All required keys, certificates and provisioning profiles are installed 🙌
INFO [2021-08-22 22:21:53.69]: Setting Provisioning Profile type to 'development'
INFO [2021-08-22 22:21:53.73]: Successfully generated documentation at path '/Users/runner/work/mapswipe/mapswipe/ios/fastlane/README.md'

+------+------------------+-------------+
| fastlane summary |
+------+------------------+-------------+
| Step | Action | Time (in s) |
+------+------------------+-------------+
| 1 | default_platform | 0 |
| 2 | setup_travis | 0 |
| 3 | match | 30 |
+------+------------------+-------------+

INFO [2021-08-22 22:21:53.88]: fastlane.tools finished successfully 🎉

Environment

 
✅ fastlane environment ✅

Stack

Key Value
OS 10.15.7
Ruby 2.7.3
Bundler? true
Git git version 2.32.0
Installation Source ~/hostedtoolcache/Ruby/2.7.3/x64/bin/fastlane
Host Mac OS X 10.15.7 (19H1323)
Ruby Lib Dir ~/hostedtoolcache/Ruby/2.7.3/x64/lib
OpenSSL Version OpenSSL 1.1.1j 16 Feb 2021
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode_12.4.app/Contents/Developer/
Xcode Version 12.4
Swift Version 5.3.2

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL en_US.UTF-8
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
# fastlane/Fastfile
default_platform :ios
setup_travis

platform :ios do
  before_all do |lane|
    if lane != :matchDev && lane != :matchProd
      cocoapods(repo_update: true, silent: true)
    end
  end

  desc "Update dev certificates locally"
  lane :matchDev do
      match(type: "development", app_identifier: "org.missingmaps.mapswipe-dev", readonly: false, verbose: true, git_private_key: "cfg/mapswipe.dev_at_gmail_rsa_key_for_travis_ci")
  end

  lane :matchProd do
    match(type: "appstore", app_identifier: "org.missingmaps.mapswipe", readonly: false, verbose: true, git_private_key: "cfg/mapswipe.dev_at_gmail_rsa_key_for_travis_ci")
  end

  desc "Build the app and run the tests defined for the mapswipe scheme. Used in github actions to trigger the CI step."
  lane :test do
    match(type: "development", app_identifier: "org.missingmaps.mapswipe-dev", readonly: is_ci)
    scan(scheme: "mapswipe",
         configuration: "Debug",
         clean: true,
         derived_data_path: "build",
         build_for_testing: true,
         devices:['iPhone X'])
    # scan(scheme: "mapswipe",
    #      configuration: "Debug",
    #      test_without_building: true,
    #      derived_data_path: "build",
    #      devices:['iPhone X'])
  end

  desc "Build production version and upload to appstore. This step is executed when a tag on master is created"
  lane :release do
    app_store_connect_api_key(
      key_id: "4B2GC5YX57",
      issuer_id: "69a6de7b-aa28-47e3-e053-5b8c7c11a4d1",
      key_filepath: "./AuthKey_4B2GC5YX57.p8",
      duration: 1200,
      in_house: false
    )
    match(type: "appstore", app_identifier: "org.missingmaps.mapswipe", readonly: false)
    build_app(scheme: "mapswipe", configuration: "Release", clean: true)
    upload_to_app_store(username: "mapswipe.dev@gmail.com",
                        app_identifier: "org.missingmaps.mapswipe",
                        force: is_ci,
                        precheck_include_in_app_purchases: false)
  end

  desc "Build the beta version and upload it to testflight. This step is executed when a tag on any branch is created"
  lane :beta do
    app_store_connect_api_key(
      key_id: "4B2GC5YX57",
      issuer_id: "69a6de7b-aa28-47e3-e053-5b8c7c11a4d1",
      key_filepath: "./AuthKey_4B2GC5YX57.p8",
      duration: 1200,
      in_house: false
    )
    match(type: "appstore", app_identifier: "org.missingmaps.mapswipe-dev", readonly: false)
    build_app(scheme: "mapswipe", configuration: "Beta", clean: true, include_symbols: true)
    upload_to_testflight(username: "mapswipe.dev@gmail.com",
                         app_identifier: "org.missingmaps.mapswipe-dev",
                         skip_waiting_for_build_processing: true
                         )
  end
end

No Appfile found

fastlane gems

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

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.4.0
bundler 2.1.4
uri 0.10.0
rake 13.0.6
CFPropertyList 3.0.3
concurrent-ruby 1.1.9
i18n 1.8.10
minitest 5.14.4
thread_safe 0.3.6
tzinfo 1.2.9
activesupport 5.2.6
public_suffix 4.0.6
addressable 2.8.0
httpclient 2.8.3
json 2.5.1
algoliasearch 1.27.5
artifactory 3.0.15
atomos 0.1.3
aws-eventstream 1.1.1
aws-partitions 1.489.0
aws-sigv4 1.2.4
jmespath 1.4.0
aws-sdk-core 3.119.1
aws-sdk-kms 1.46.0
aws-sdk-s3 1.99.0
babosa 1.0.4
claide 1.0.3
fuzzy_match 2.0.4
nap 1.1.0
netrc 0.11.0
ffi 1.15.3
ethon 0.14.0
typhoeus 1.4.0
cocoapods-core 1.10.2
cocoapods-deintegrate 1.0.5
cocoapods-downloader 1.4.0
cocoapods-plugins 1.0.0
cocoapods-search 1.0.1
cocoapods-trunk 1.5.0
cocoapods-try 1.2.0
colored2 3.1.2
escape 0.0.4
fourflusher 2.3.1
gh_inspector 1.1.3
molinillo 0.6.6
ruby-macho 1.4.0
nanaimo 0.3.0
rexml 3.2.5
xcodeproj 1.21.0
cocoapods 1.10.2
colored 1.2
highline 2.0.3
commander 4.6.0
declarative 0.0.20
digest-crc 0.6.4
unf_ext 0.0.7.7
unf 0.1.4
domain_name 0.5.20190701
dotenv 2.7.6
emoji_regex 3.2.2
excon 0.85.0
faraday-em_http 1.0.0
faraday-em_synchrony 1.0.0
faraday-excon 1.1.0
faraday-httpclient 1.0.1
faraday-net_http 1.0.1
faraday-net_http_persistent 1.2.0
faraday-patron 1.0.0
faraday-rack 1.0.0
multipart-post 2.0.0
ruby2_keywords 0.0.5
faraday 1.7.0
http-cookie 1.0.4
faraday-cookie_jar 0.0.7
faraday_middleware 1.1.0
fastimage 2.2.5
jwt 2.2.3
memoist 0.16.2
multi_json 1.15.0
os 1.1.1
signet 0.15.0
googleauth 0.17.0
mini_mime 1.1.0
trailblazer-option 0.1.1
uber 0.1.0
representable 3.1.1
retriable 3.1.2
webrick 1.7.0
google-apis-core 0.4.1
google-apis-androidpublisher_v3 0.10.0
google-apis-playcustomapp_v1 0.5.0
google-apis-iamcredentials_v1 0.6.0
google-apis-storage_v1 0.6.0
google-cloud-env 1.5.0
google-cloud-errors 1.1.0
google-cloud-core 1.6.0
google-cloud-storage 1.34.1
mini_magick 4.11.0
naturally 2.2.1
plist 3.6.0
rubyzip 2.3.2
security 0.1.3
simctl 1.6.8
terminal-notifier 2.0.0
unicode-display_width 1.7.0
terminal-table 1.8.0
tty-screen 0.8.1
tty-cursor 0.7.1
tty-spinner 0.9.3
word_wrap 1.0.0
rouge 2.0.7
xcpretty 0.3.0
xcpretty-travis-formatter 1.0.1
@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 👍

Friendly reminder: contributions are always welcome! Check out CONTRIBUTING.md for more information on how to help with fastlane and feel free to tackle this issue yourself 💪

This issue will be auto-closed if there is no reply within 1 month.

@laurentS
Copy link
Author

This issue is still happening with 2.197.0, see https://github.com/mapswipe/mapswipe/runs/3988403476?check_suite_focus=true for an example of output (under TEMP renew dev certificate)

@laurentS
Copy link
Author

Some more findings using a fork with extra debugging output:

  • we use a private key for our git storage of certs as a file, that fastlane knows as a relative path. The file is copied just after cloning our code repo from an env var.
  • when cloning the certs repo, the CWD for the command is "correct", ie: it is the folder where fastlane is called from repo_root/ios (see line 328 in our CI run output)
  • but when pushing changes back, the CWD is now self.working_directory, which is a temp directory created by git_storage, here
  • it looks like the culprit is this line in the parent interface.rb which changes the CWD, which further down the line is the wrong one when git_push calls command_from_private_key

I'm not entirely sure what the best solution is, because I don't really know the fastlane codebase, and the other storage methods.

@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 👍

Friendly reminder: contributions are always welcome! Check out CONTRIBUTING.md for more information on how to help with fastlane and feel free to tackle this issue yourself 💪

This issue will be auto-closed if there is no reply within 1 month.

@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 Mar 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants