Git Product home page Git Product logo

create-artifacts-and-reports's Introduction

Create artifacts and reports You’re on a development team working on a new Java application.

You've been assigned to develop a Jenkins pipeline that tests the application code and creates a report that the team can review. Specifically, the test stage creates test report using the JUnit format.

If the tests pass, the pipeline should compile the code into a Java archive and store the JAR file as an artifact.

Requirements

  • Set up a global tool configuration for Maven.

  • Make sure the JUnit plugin is installed.

  • Update the pipeline to use the Maven tool configuration.

  • Update the pipeline to call Maven.

  • Collect test results from the following location: '**/TEST-com.learningjenkins.AppTest.xml'.

  • Archive artifacts from the following location: '**/hello-1.0-SNAPSHOT.jar'.

Additional information

  • A pipeline template and all supporting code are available in the exercise files.

  • Use the pipeline syntax tool to generate snippets for:

    • Tool configuration
    • Collecting test results
    • Archiving artifacts
  • This challenge should take about 15 to 20 minutes to complete.

The pipeline template

Follow this link for the Jenkinsfile template or view it below:

pipeline {
    agent any
    // Add a tool configuration here...
    stages {
        stage('Source') {
            steps {
                git branch: 'main',
                    changelog: false,
                    poll: false,
                    url: 'https://github.com/LinkedInLearning/essential-jenkins-2468076.git'
            }
        }
        stage('Clean') {
            steps {
                dir("${env.WORKSPACE}/Ch05/05_04-challenge-create-artifacts-and-reports"){
                    echo "Cleaning the workspace..."
                    // Uncomment the following line after Maven is configured as a global tool
                    // sh 'mvn clean'
                }
            }
        }
        stage('Test') {
            steps {
                dir("${env.WORKSPACE}/Ch05/05_04-challenge-create-artifacts-and-reports"){
                    echo "Running tests..."
                    // Uncomment the following line after Maven is configured as a global tool
                    // sh 'mvn test'
                }
            }
        }
        stage('Package') {
            steps {
                dir("${env.WORKSPACE}/Ch05/05_04-challenge-create-artifacts-and-reports"){
                    echo "Creating the JAR file..."
                    // Uncomment the following line after Maven is configured as a global tool
                    // sh 'mvn package -DskipTests'
                }
            }
        }
    }
    post {
        always {
            echo "Collecting jUnit test results..."
            // Add jUnit report collection here...

            echo "Archiving the JAR file..."
            // Add artifact archiving here...
        }
    }
}

create-artifacts-and-reports's People

Contributors

syr7-s avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.