Difference between revisions of "GitLab CI: artifacts:"

From wikieduonline
Jump to navigation Jump to search
Line 14: Line 14:
 
== Examples ==
 
== Examples ==
 
https://docs.gitlab.com/ee/ci/variables/#pass-an-environment-variable-to-another-job
 
https://docs.gitlab.com/ee/ci/variables/#pass-an-environment-variable-to-another-job
<pre>
 
build:
 
  stage: build
 
  script:
 
    - echo "BUILD_VARIABLE=value_from_build_job" >> build.env
 
  artifacts:
 
    reports:
 
      dotenv: build.env
 
  
deploy:
+
build:
  stage: deploy
+
  stage: build
  variables:
+
  script:
    BUILD_VARIABLE: value_from_deploy_job
+
    - echo "BUILD_VARIABLE=value_from_build_job" >> build.env
  script:
+
  artifacts:
    - echo "$BUILD_VARIABLE"  # Output is: 'value_from_build_job' due to precedence
+
    [[reports:]]
  environment: production
+
      [[dotenv:]] build.env
</pre>
+
 +
deploy:
 +
  stage: deploy
 +
  variables:
 +
    BUILD_VARIABLE: value_from_deploy_job
 +
  script:
 +
    - echo "$BUILD_VARIABLE"  # Output is: 'value_from_build_job' due to precedence
 +
  environment: production
  
 
== Related ==
 
== Related ==

Revision as of 11:47, 8 December 2022

artifacts:


 artifacts:
   name: "Your name $CI_COMMIT_SHA"
   paths:
     - mycv.pdf
   expire_in: 1 week


Examples

https://docs.gitlab.com/ee/ci/variables/#pass-an-environment-variable-to-another-job

build:
  stage: build
  script:
    - echo "BUILD_VARIABLE=value_from_build_job" >> build.env
  artifacts:
    reports:
      dotenv: build.env

deploy:
  stage: deploy
  variables:
    BUILD_VARIABLE: value_from_deploy_job
  script:
    - echo "$BUILD_VARIABLE"  # Output is: 'value_from_build_job' due to precedence
  environment: production

Related

See also

Advertising: