Este contenido no está disponible en el idioma seleccionado.

Chapter 4. Configuring RHTAP to use built-in Jenkins libraries


By default {ProductLongName} (RHTAP) uses dynamically loaded Jenkins libraries. While dynamically loading provides flexibility, using built-in Jenkins libraries offer improved stability, security, and traceability during builds. Configuring RHTAP to use built-in libraries instead of dynamically loaded ones allows for better Red Hat Enterprise Contract (Enterprise Contract) attestations and enhanced build verification.

Prerequisites

Before making changes, ensure that:

4.1. Define the built-in library in Jenkins

Procedure

  1. Log in to Jenkins and navigate to Manage Jenkins > System.
  2. Locate the Global Trusted Pipeline Libraries section.
  3. Click Add and define the new library with the following parameters:

    1. Name: <your-library-name>
    2. Default version: Set to a specific branch or commit reference. For example, v1.5.
    3. Allow default version to be overridden: (Optional) Select this option to restrict users to a specific version of the Jenkins library. This ensures that the users cannot select a different version.
    4. Include @Library changes in your recent changes: Select this option to track modifications made to the shared library. This feature helps users understand changes that might affect their builds.
    5. Retrieval method: Select Modern SCM.

      1. From the Source Code Management drop-down list, select Git.
      2. In the Project Repository field, enter the Jenkins library URL. For example, https://github.com/redhat-appstudio/tssc-sample-jenkins.
      3. Select Fresh clone per build, to ensure each build fetches a clean copy of the library.
      4. Select Save.

4.2. Modify the Jenkins pipeline to use the built-in library

Procedure

  1. Navigate to your Jenkins CI source repository, For example, https://github.com/redhat-appstudio/tssc-sample-templates/blob/main/skeleton/ci/source-repo/jenkins.
  2. Select Jenkinsfile in edit mode.
  3. Replace the dynamic library loading with the @Library annotation.

    Expand
    Replace thisWith this

    library identifier: 'RHTAP_Jenkins@main', retriever: modernSCM( [$class: 'GitSCMSource', remote: 'https://github.com/redhat-appstudio/tssc-sample-jenkins.git'])

    @Library('RHTAP_Jenkins@v1.5') _

  4. Save and commit the updated Jenkinsfile.

4.3. Use the configured Jenkins library

Procedure

  1. In your Jenkins instance, navigate to your project.
  2. Select Build Now to trigger a new build.

Verification

  1. Check the Jenkins build logs to confirm that the built-in library is loaded instead of dynamically retrieving dependencies.
  2. Validate that Enterprise Contract attestations now reflect a built-in library.
  3. Verify the library name, retrieval method, and pipeline script if any error occur.

4.4. Applying changes to one or all RHTAP templates

Depending on your use case, you can apply this configuration to one RHTAP template or all RHTAP templates in Red Hat Developer Hub (RHDH).

  • To apply this change to a single template: Modify only the specific pipeline template used in your project. This ensures that only this pipeline uses the built-in Jenkins library, while others continue using dynamic loading.
  • To apply this change to all RHTAP templates in RHDH: Update the global RHTAP template configuration to reference the built-in library instead of dynamically loaded ones. This ensures consistency across all RHTAP pipelines.
Important

Applying this change globally may impact all builds using RHTAP. Ensure that the built-in library is correctly defined and tested before making this change across all templates.

Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2026 Red Hat
Volver arriba