Chapter 2. Adding your application to Jenkins


When you select Jenkins as your CI provider while creating an application, you must add your application to Jenkins. Proper integration ensures that your pipeline aligns with your CI/CD workflows and operates seamlessly.

Prerequisites

  • You must have installed and configured Jenkins in your environment.
  • You must have the necessary permissions to create and manage Jenkins jobs.
  • You must have added correct credentials for the Jenkins pipeline during the post RHTAP install phase.
  • Review the Jenkinsfile and ensure it aligns with your Jenkins configuration. For example, you may need to update the agent settings to limit where the pipeline can run.
  • Ensure that the Jenkins agent has the necessary binaries installed: git, curl, jq, yq, buildah, syft, cosign, python3, and tree. If the pipeline run fails at the start, it likely indicates that one or more binaries are missing.

Procedure

  1. Log in to your Jenkins instance.
  2. From the Jenkins dashboard, select New Item.
  3. Enter a name for your pipeline job and select Pipeline project (for example, secure-jenkins).

    Note

    The name of your pipeline job must match the name of the application for which you are adding Jenkins CI. If the names do not match, the pipeline will run on Jenkins but will not be visible on RHDH.

    1. (Optional) If you want to use a different pipeline name, update the jenkins.io/job-full-name field in the catalog-info.yaml file in the source repository with the pipeline name you choose.
  4. Select OK to create the job.
  5. On the Configure > General page, navigate to the Pipeline section, and from the Definition drop-down list, select Pipeline script from SCM.
  6. From the SCM drop-down list, select Git.
  7. In the Repository URL field, enter the Jenkins source repository URL.

    1. On the Red Hat Developer Hub platform, from the Catalog, select an appropriate application.
    2. Go to the Overview tab and select View Source to open the repository where your application’s source code is housed.
  8. In the Branches to build section, enter */main.
  9. Select Save. The system displays the live-jenkins (name of your job) page.
  10. Select Build Now. The system starts the build pipeline. Wait until the build is complete.

    1. In the Stage View section, select Pipeline Overview to visualize the pipeline run.
    2. Select Pipeline Console to review the live logs of each stage of the pipeline run.

Verification

After integrating your application with Jenkins, review various aspects of the Jenkins pipeline on the Red Hat Developer Hub platform.

  1. From the Catalog, select the appropriate application or component.

    • Go to the CI tab to view the Jenkins project. For the appropriate Jenkins job, using the Actions column, you can view, rerun, and view history of the job. The system displays the job overview with the status of latest run.
    • Go to the CD tab and select the appropriate card to view deployment details, such as the commit message, author name, and deployment history managed by ArgoCD and GitOps.
    • In the Catalog, from the Kind dropdown list, select Resource. The system displays Jenkins GitOps jobs. Select and review the appropriate GitOps resource.
    • Go to the Topology tab to visualize your application’s deployment within the development namespace.

Completing these steps ensures seamless integration of your application with Jenkins, enabling efficient and reliable CI/CD workflows.





Revised on 2025-02-06 18:02:18 UTC

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.