[英]How to pass variables between jobs without artifacts in Gitlab-CI?
我想在我的 gitlab-ci scrypt 中的作業(在其他階段)之間傳遞一些變量。 我在示例中使用:
buildTest:
stage: build
artifacts:
reports:
dotenv: build.env
name: "FullRelease"
paths:
- 'app'
expire_in: 1 day
script: |
echo "version=1.2.3" >> build.env
....
runWin:
stage: runOnWin
variables:
GIT_STRATEGY: none
script: |
echo "Version is %version%"
needs:
- job: buildTest
artifacts: true
一切正常,但我已經從“buildTest”(整個文件夾應用程序,很大)中獲得了所有工件。 有點奇怪,但它不包含文件“build.env”,這正是我需要的。 是否有可能只傳遞變量,而不傳遞其他工件。 如果我設置 artifacts: false - 沒有變量被傳遞。
沒有其他方法,但您可以嘗試從環境變量為GitLab 管道 API的作業中調用管道
不幸的是,目前這是不可能的。 在 GitLab 有一個未解決的問題,其中有一個提案:
https://gitlab.com/gitlab-org/gitlab/-/issues/384028
請在那里發表評論以獲得對該主題的關注。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.