【问题标题】:Reuse Fastlane match for encrypting other credentials and android key stores重用 Fastlane 匹配来加密其他凭据和 android 密钥存储
【发布时间】:2019-05-08 10:17:07
【问题描述】:

我正在使用 Fastlane 匹配来管理我的 iOS 代码签名。

有没有办法使用相同的存储库来存储应用程序中使用但无法在 Git 中检查的其他项目凭据 [密钥、API 令牌等],或者使用 Fastlane 匹配命令创建新的加密存储库?

执行以下代码,但 repo out.txt 中的文件未加密。

当前代码:

  desc "Encrypt git"
  lane :encrypt do  
    UI.success "Encrypting git!"
    storage = Match::Storage.for_mode("git", { git_url: git_url, shallow_clone: shallow_clone, git_branch: branch, clone_branch_directly: true})  
    storage.download
    encryption = Match::Encryption.for_storage_mode("git", { git_url: git_url, working_directory: storage.working_directory})
    encryption.decrypt_files
    file = "#{storage.working_directory}/out.txt"
    out_file = File.new("#{file}", "w")
    out_file.puts("version:#{Time.now.to_i}")
    out_file.close 
    encryption.encrypt_files
    files_to_commit = Dir[File.join(storage.working_directory, "**", "*.{txt}")]
    encryption.encrypt_files
    storage.save_changes!(files_to_commit: files_to_commit)
  end 
end

输出:

Successfully loaded Appfile at path '/Users/xx/Workspace/yy/ci/zz/fastlane/Appfile'
-------
Successfully loaded Appfile at path '/Users/xx/Workspace/yy/ci/zz/fastlane/Appfile'
-------
WARN [2019-05-31 03:15:16.70]: You have required a gem, if this is a third party gem, please use `fastlane_require 'match'` to ensure the gem is installed locally.
INFO [2019-05-31 03:15:17.00]: ------------------------------
INFO [2019-05-31 03:15:17.00]: --- Step: default_platform ---
INFO [2019-05-31 03:15:17.00]: ------------------------------
INFO [2019-05-31 03:15:17.01]: Driving the lane 'mac test' ????
INFO [2019-05-31 03:15:17.01]: Encrypting git!
INFO [2019-05-31 03:15:17.01]: Cloning remote git repo...
INFO [2019-05-31 03:15:17.01]: $ git clone ./../gitrepo/.git /var/folders/7s/s7248n8j0yz0lth821hx4bdm0000gp/T/d20190531-95641-60lael -b master --single-branch
INFO [2019-05-31 03:15:17.02]: ▸ Cloning into '/var/folders/7s/s7248n8j0yz0lth821hx4bdm0000gp/T/d20190531-95641-60lael'...
INFO [2019-05-31 03:15:17.13]: ▸ done.
INFO [2019-05-31 03:15:17.15]: ????  Successfully decrypted certificates repo
INFO [2019-05-31 03:15:17.15]: ????  Successfully encrypted certificates repo
INFO [2019-05-31 03:15:17.15]: Pushing changes to remote git repo...
INFO [2019-05-31 03:15:17.15]: $ git add /var/folders/7s/s7248n8j0yz0lth821hx4bdm0000gp/T/d20190531-95641-60lael/match_version.txt
INFO [2019-05-31 03:15:17.17]: $ git add /var/folders/7s/s7248n8j0yz0lth821hx4bdm0000gp/T/d20190531-95641-60lael/out.txt
INFO [2019-05-31 03:15:17.19]: $ git commit -m \[fastlane\]\ Updated\ \ and\ platform\ 
INFO [2019-05-31 03:15:17.24]: ▸ [master 6bdc078] [fastlane] Updated  and platform
INFO [2019-05-31 03:15:17.25]: ▸ 1 file changed, 1 insertion(+), 1 deletion(-)
INFO [2019-05-31 03:15:17.25]: $ git push origin master
INFO [2019-05-31 03:15:17.31]: ▸ Enumerating objects: 5, done.
INFO [2019-05-31 03:15:17.31]: ▸ Counting objects: 100% (5/5), done.
INFO [2019-05-31 03:15:17.31]: ▸ Delta compression using up to 8 threads.
INFO [2019-05-31 03:15:17.31]: ▸ Compressing objects: 100% (2/2), done.
INFO [2019-05-31 03:15:17.32]: ▸ Writing objects: 100% (3/3), 289 bytes | 144.00 KiB/s, done.
INFO [2019-05-31 03:15:17.32]: ▸ Total 3 (delta 1), reused 0 (delta 0)
INFO [2019-05-31 03:15:17.37]: ▸ To /Users/xx/Workspace/yy/ci/zz/fastlane/./../gitrepo/.git
INFO [2019-05-31 03:15:17.37]: ▸ cac225c..6bdc078  master -> master
INFO [2019-05-31 03:15:17.37]: Finished uploading files to Git Repo [./../gitrepo/.git]
INFO [2019-05-31 03:15:17.44]: Successfully generated documentation at path '/Users/xx/Workspace/yy/ci/zz/fastlane/README.md'

+------+------------------+-------------+
|           fastlane summary            |
+------+------------------+-------------+
| Step | Action           | Time (in s) |
+------+------------------+-------------+
| 1    | default_platform | 0           |
+------+------------------+-------------+

INFO [2019-05-31 03:15:17.45]: fastlane.tools finished successfully ????

【问题讨论】:

  • “其他项目凭证”指的是什么?
  • 更重要的是:您希望如何使用您放入该存储库的这些凭据和其他信息?

标签: git encryption fastlane fastlane-match


【解决方案1】:

https://docs.fastlane.tools/advanced/other/#manually-manage-the-fastlane-match-repo(单击Instructions 查看实际内容)提供了有关如何手动解密和加密匹配存储库中的数据的建议。

这可能被用来在其中放置各种数据。由于代码只是普通的 ruby​​,您当然也可以将其包含在您编写的任何脚本或程序中以自动化该过程(而不是按照说明在 irb 中手动执行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-05
    • 1970-01-01
    • 2011-01-03
    • 2014-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多