Help Center/ CodeArts Pipeline/ User Guide/ Reference/ Pipeline Contexts/ Obtaining Artifact Information Using the Pipeline Context
Updated on 2025-01-22 GMT+08:00

Obtaining Artifact Information Using the Pipeline Context

You can reference pipeline context during job configuration to obtain desired information. The following example uses the Build extension to generate an artifact and retrieves the artifact information by referencing context in the ExecuteShellCommand job.

  1. Create a pipeline.
  2. Add the Build extension to Stage_1, obtain the task ID as shown in Figure 1, and set the artifact identifier to demo as shown in Figure 2.

    Figure 1 Obtaining the task ID
    Figure 2 Adding the Build extension

  3. Add the ExecuteShellCommand extension to Stage_2. Run the following commands to obtain the artifact information:

    # Obtain the download address of the artifact.
    echo ${{ jobs.JOB_xZGhF.artifacts.demo.download_url }}
    # Obtain all information about the artifact.
    echo ${{ jobs.JOB_xZGhF.artifacts.demo }}
    Figure 3 Adding the ExecuteShellCommand extension

  4. Execute the pipeline. After the execution is successful, check the printed artifact information in the log.

    Figure 4 Artifact information