git - 重用 FaSTLane 匹配来加密其他凭据和 android key 存储

标签 git encryption fastlane fastlane-match

我正在使用 FaSTLane match 来管理我的 iOS 代码签名。

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

执行以下代码,但 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 🎉

最佳答案

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

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

关于git - 重用 FaSTLane 匹配来加密其他凭据和 android key 存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56038399/

相关文章:

git - Git可以将一个裸仓库克隆到另一个裸仓库吗

wordpress - 基于github仓库创建本地git仓库并保持更新

java - 如何在android中使用RSA进行加密和解密

testflight - faSTLane 包问题 :Couldn't find app 'com.xxx.xx' on the account of 'xxx@com.cn' on iTunes Connect

ios - 防止faSTLane扫描隐藏模拟器

git - 如何重置 Git LFS 带宽?

git - 如何创建现有存储库的 gitsubtree?

ios - 如何保护我的 iOS 应用免受 iFunbox 等工具的侵害

java - 如何根据网络服务器中的php部分在android java中进行WSSE身份验证实现?

ios - 不兼容的编码正则表达式匹配(UTF-8 正则表达式与 ASCII-8BIT 字符串)