簡體   English   中英

如何為具有私有 git 子模塊的私有倉庫設置 GitHub Actions CI 服務?

[英]How to setting up GitHub Actions CI service for a private repo which has private git submodules?

我正在為具有多個 git 子模塊的 Android 項目私有倉庫設置 GitHub 操作,我的工作流程甚至無法通過結帳步驟!

我知道這可能是身份驗證問題,但不知道如何解決。 我想知道,因為 CI 用於 GitHub,它可以訪問公司的所有存儲庫,並且不需要任何令牌或 hash 密鑰。

這是 yml 文件中的結帳步驟:

 - name: Chrckout repo
   uses: actions/checkout@v1
   with:
    submodules: true
    lfs: true

這是日志的某些部分(抱歉,由於項目機密性,我不得不混淆某些部分,但它應該是可讀的):

2019-09-29T13:03:39.9185317Z ##[group]Run actions/checkout@v1
2019-09-29T13:03:39.9272863Z with:
2019-09-29T13:03:39.9273270Z   submodules: true
2019-09-29T13:03:39.9273443Z   lfs: true
2019-09-29T13:03:39.9273636Z ##[endgroup]
2019-09-29T13:03:40.9117862Z Added matchers: 'checkout-git'. Problem matchers scan action output for known warning or error strings and report these inline.
2019-09-29T13:03:40.9118799Z ##[add-matcher]/home/runner/work/_temp/git_edd66dd0-526a-44d1-97ad-a70a018bc61e.json
2019-09-29T13:03:40.9137013Z Syncing repository: ***/***-Android
2019-09-29T13:03:40.9145133Z ##[command]git version
2019-09-29T13:03:40.9145665Z git version 2.23.0
2019-09-29T13:03:40.9146108Z ##[command]git lfs version
2019-09-29T13:03:41.5663318Z git-lfs/2.8.0 (GitHub; linux amd64; go 1.12.6)
2019-09-29T13:03:41.6007068Z ##[command]git init "/home/runner/work/***-Android/***-Android"
2019-09-29T13:03:41.6453117Z Initialized empty Git repository in /home/runner/work/***-Android/***-Android/.git/
2019-09-29T13:03:41.6502397Z ##[command]git remote add origin https://github.com/***/***-Android
2019-09-29T13:03:41.6686542Z ##[command]git config gc.auto 0
2019-09-29T13:03:41.6767746Z ##[command]git config --get-all http.https://github.com/***/***-Android.extraheader
2019-09-29T13:03:41.6826722Z ##[command]git config --get-all http.proxy
2019-09-29T13:03:41.6946989Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --tags --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/*
2019-09-29T13:03:42.5443344Z remote: Enumerating objects: 1483, done.        
2019-09-29T13:03:42.5444124Z remote: Counting objects:   0% (1/1483)        
2019-09-29T13:03:42.5444498Z remote: Counting objects:   1% (15/1483)        
.
.
.       
2019-09-29T13:03:42.5493616Z remote: Counting objects:  99% (1469/1483)        
2019-09-29T13:03:42.5493904Z remote: Counting objects: 100% (1483/1483)        
2019-09-29T13:03:42.5494370Z remote: Counting objects: 100% (1483/1483), done.        
2019-09-29T13:03:42.5495148Z remote: Compressing objects:   0% (1/727)        
2019-09-29T13:03:42.5495381Z remote: Compressing objects:   1% (8/727)
.
.
.        
2019-09-29T13:03:42.5898942Z remote: Compressing objects:  99% (720/727)        
2019-09-29T13:03:42.5899526Z remote: Compressing objects: 100% (727/727)        
2019-09-29T13:03:42.5899818Z remote: Compressing objects: 100% (727/727), done.        
2019-09-29T13:03:42.6030874Z 
2019-09-29T13:03:42.6031956Z                                                                                 
2019-09-29T13:03:42.6181873Z Receiving objects:   0% (1/98154)
2019-09-29T13:03:42.6182681Z 
2019-09-29T13:03:42.6184320Z                                                                                 
2019-09-29T13:03:42.6327511Z Receiving objects:   1% (982/98154)
2019-09-29T13:03:42.6328000Z 
2019-09-29T13:03:42.6328418Z                                                                                 
2019-09-29T13:03:42.6459740Z Receiving objects:   2% (1964/98154)
2019-09-29T13:03:42.6459933Z 
2019-09-29T13:03:42.6460265Z                                                                                 

.
.
.
2019-09-29T13:03:46.7921902Z 
2019-09-29T13:03:46.7923021Z                                                                                 
2019-09-29T13:03:46.8059761Z Receiving objects:  99% (97173/98154), 140.24 MiB | 35.06 MiB/s
2019-09-29T13:03:46.8061958Z remote: Total 98154 (delta 502), reused 1355 (delta 448), pack-reused 96671        
2019-09-29T13:03:46.8096377Z 
2019-09-29T13:03:46.8097502Z                                                                                 
2019-09-29T13:03:46.8099271Z Receiving objects: 100% (98154/98154), 140.24 MiB | 35.06 MiB/s
2019-09-29T13:03:46.8100178Z 
2019-09-29T13:03:46.8101120Z                                                                                 
2019-09-29T13:03:46.8102099Z Receiving objects: 100% (98154/98154), 150.44 MiB | 35.77 MiB/s, done.
2019-09-29T13:03:46.8177656Z 
2019-09-29T13:03:46.8179286Z                                                                                 
2019-09-29T13:03:46.8247809Z Resolving deltas:   0% (0/50478)
2019-09-29T13:03:46.8249644Z 
2019-09-29T13:03:46.8250044Z                                                                                 
2019-09-29T13:03:46.8275539Z Resolving deltas:   1% (606/50478)
2019-09-29T13:03:46.8275687Z 
2019-09-29T13:03:46.8275943Z                                                                                 

.
.
.                                                                               
2019-09-29T13:03:47.8181717Z Resolving deltas:  99% (49974/50478)
2019-09-29T13:03:47.8245769Z 
2019-09-29T13:03:47.8246196Z                                                                                 
2019-09-29T13:03:47.8246479Z Resolving deltas: 100% (50478/50478)
2019-09-29T13:03:47.8246612Z 
2019-09-29T13:03:47.8247201Z                                                                                 
2019-09-29T13:03:47.8247576Z Resolving deltas: 100% (50478/50478), done.
2019-09-29T13:03:51.8552178Z From https://github.com/***/***-Android
2019-09-29T13:03:51.8556296Z  * [new branch]      refactor -> origin/refactor
.
.
.
2019-09-29T13:03:51.9186875Z  * [new tag]         v0.63.0                -> v0.63.0
.
.
.
2019-09-29T13:03:51.9858238Z ##[command]git checkout --progress --force 4e746ed66b5dc33310ebdc6eb12b945e385d9c4a
2019-09-29T13:03:52.5800307Z Note: switching to '4e746ed66b5dc33310ebdc6eb12b945e385d9c4a'.
2019-09-29T13:03:52.5801297Z 
2019-09-29T13:03:52.5802472Z You are in 'detached HEAD' state. You can look around, make experimental
2019-09-29T13:03:52.5803107Z changes and commit them, and you can discard any commits you make in this
2019-09-29T13:03:52.5803598Z state without impacting any branches by switching back to a branch.
2019-09-29T13:03:52.5803933Z 
2019-09-29T13:03:52.5804367Z If you want to create a new branch to retain commits you create, you may
2019-09-29T13:03:52.5805414Z do so (now or later) by using -c with the switch command. Example:
2019-09-29T13:03:52.5806068Z 
2019-09-29T13:03:52.5806726Z   git switch -c <new-branch-name>
2019-09-29T13:03:52.5807094Z 
2019-09-29T13:03:52.5807511Z Or undo this operation with:
2019-09-29T13:03:52.5807830Z 
2019-09-29T13:03:52.5809354Z   git switch -
2019-09-29T13:03:52.5809855Z 
2019-09-29T13:03:52.5810364Z Turn off this advice by setting config variable advice.detachedHead to false
2019-09-29T13:03:52.5810742Z 
2019-09-29T13:03:52.5811258Z HEAD is now at 4e746ed66 submodules 99
2019-09-29T13:03:52.7096856Z ##[command]git submodule sync
2019-09-29T13:03:52.7930660Z ##[command]git -c http.https://github.com.extraheader="AUTHORIZATION: basic ***" submodule update --init --force
2019-09-29T13:03:52.8223899Z Submodule 'proto' (git@github.***/***-Protobuf.git) registered for path 'c/device/proto/src/main/proto'
2019-09-29T13:03:52.8229867Z Submodule 'json' (git@github.***/json.git) registered for path 'c/n/a/json'
2019-09-29T13:03:52.8234606Z Submodule 'v' (git@github.com:***/V.git) registered for path 'c/n/a/v'
2019-09-29T13:03:52.8239790Z Submodule 'd' (git@github.com:***/D.git) registered for path 'c/n/d/d'
2019-09-29T13:03:52.8383255Z Cloning into '/home/runner/work/***-Android/***-Android/c/device/proto/src/main/proto'...
2019-09-29T13:03:53.0073411Z Host key verification failed.
2019-09-29T13:03:53.0191036Z ##[error]fatal: Could not read from remote repository.
2019-09-29T13:03:53.0204269Z 
2019-09-29T13:03:53.0204574Z Please make sure you have the correct access rights
2019-09-29T13:03:53.0204816Z and the repository exists.
2019-09-29T13:03:53.0207224Z ##[error]fatal: clone of 'git@github.com:***/***-Protobuf.git' into submodule path '/home/runner/work/***-Android/***-Android/c/device/proto/src/main/proto' failed
2019-09-29T13:03:53.0208627Z Failed to clone 'c/device/proto/src/main/proto'. Retry scheduled
2019-09-29T13:03:53.0210196Z Cloning into '/home/runner/work/***-Android/***-Android/c/n/a/json'...
2019-09-29T13:03:53.0895134Z Host key verification failed.
2019-09-29T13:03:53.0901281Z ##[error]fatal: Could not read from remote repository.
2019-09-29T13:03:53.0901797Z 
2019-09-29T13:03:53.0902198Z Please make sure you have the correct access rights
2019-09-29T13:03:53.0902587Z and the repository exists.
2019-09-29T13:03:53.0910343Z ##[error]fatal: clone of 'git@github.com:***/json.git' into submodule path '/home/runner/work/***-Android/***-Android/c/n/a/json' failed
2019-09-29T13:03:53.0911390Z Failed to clone 'c/n/a/json'. Retry scheduled
2019-09-29T13:03:53.0938254Z Cloning into '/home/runner/work/***-Android/***-Android/c/n/a/v'...
2019-09-29T13:03:53.1691373Z Host key verification failed.
2019-09-29T13:03:53.1698028Z ##[error]fatal: Could not read from remote repository.
2019-09-29T13:03:53.1702098Z 
2019-09-29T13:03:53.1703485Z Please make sure you have the correct access rights
2019-09-29T13:03:53.1704308Z and the repository exists.
2019-09-29T13:03:53.1710654Z ##[error]fatal: clone of 'git@github.com:***/V.git' into submodule path '/home/runner/work/***-Android/***-Android/c/n/a/v' failed
2019-09-29T13:03:53.1713573Z Failed to clone 'c/n/a/v'. Retry scheduled
2019-09-29T13:03:53.1741011Z Cloning into '/home/runner/work/***-Android/***-Android/c/n/d/d'...
2019-09-29T13:03:53.2511414Z Host key verification failed.
2019-09-29T13:03:53.2514791Z ##[error]fatal: Could not read from remote repository.
2019-09-29T13:03:53.2526450Z 
2019-09-29T13:03:53.2526930Z Please make sure you have the correct access rights
2019-09-29T13:03:53.2527255Z and the repository exists.
2019-09-29T13:03:53.2528958Z ##[error]fatal: clone of 'git@github.com:***/D.git' into submodule path '/home/runner/work/***-Android/***-Android/c/n/d/d' failed
2019-09-29T13:03:53.2530699Z Failed to clone 'c/n/d/d'. Retry scheduled
2019-09-29T13:03:53.2558956Z Cloning into '/home/runner/work/***-Android/***-Android/c/device/proto/src/main/proto'...
2019-09-29T13:03:53.3373002Z Host key verification failed.
2019-09-29T13:03:53.3378381Z ##[error]fatal: Could not read from remote repository.
2019-09-29T13:03:53.3380657Z 
2019-09-29T13:03:53.3381349Z Please make sure you have the correct access rights
2019-09-29T13:03:53.3381662Z and the repository exists.
2019-09-29T13:03:53.3394503Z ##[error]fatal: clone of 'git@github.com:***/***-Protobuf.git' into submodule path '/home/runner/work/***-Android/***-Android/c/device/proto/src/main/proto' failed
2019-09-29T13:03:53.3400724Z Failed to clone 'c/device/proto/src/main/proto' a second time, aborting
2019-09-29T13:03:53.3487425Z Removed matchers: 'checkout-git'
2019-09-29T13:03:53.3487829Z ##[remove-matcher owner=checkout-git]
2019-09-29T13:03:53.3509685Z ##[error]Git submodule update failed with exit code: 1
2019-09-29T13:03:53.3905892Z ##[error]Exit code 1 returned from process: file name '/home/runner/runners/2.158.0/bin/Runner.PluginHost', arguments 'action "GitHub.Runner.Plugins.Repository.CheckoutTask, Runner.Plugins"'.
2019-09-29T13:03:53.4082152Z Cleaning up orphan processes

簽出操作使用的默認秘密GITHUB_TOKEN僅適用於該存儲庫。 您不能使用它來訪問其他存儲庫。

嘗試改用repo范圍的令牌。 https://github.com/settings/tokens創建一個,然后將其作為機密添加到您的工作流程運行的存儲庫中。它將位於https://github.com/[username]/[repo]/settings /秘密

然后通過token參數將此密鑰傳遞給結帳操作。

- uses: actions/checkout@v1
  with:
    submodules: true
    token: ${{ secrets.REPO_SCOPED_TOKEN }}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM