Use this as the complete Jenkins pipeline reference after learning the pipeline progressively in the chapters.

These are complete pipeline listings, not a configured Jenkins installation. The C# agent needs Git, .NET SDK 10 and a Windows command shell. Install the Timestamper plugin for timestamps(), or remove that optional setting. The static-site agent also needs PowerShell, AWS CLI v2 and an approved AWS authentication configuration before deployment. See Prerequisites and Timestamper documentation.

C.1 C# pipeline

pipeline {
    agent any

    options {
        // Requires the Timestamper plugin; remove this optional setting if absent.
        timestamps()
    }

    stages {
        stage('Restore') {
            steps {
                // Jenkins on Windows executes the .NET CLI through cmd.exe here.
                bat 'dotnet restore JenkinsCSharpDemo.sln'
            }
        }

        stage('Build') {
            steps {
                // --no-restore proves this stage depends on Restore succeeding.
                bat 'dotnet build JenkinsCSharpDemo.sln --configuration Release --no-restore'
            }
        }

        stage('Test') {
            steps {
                // --no-build prevents the test stage from quietly rebuilding.
                bat 'dotnet test JenkinsCSharpDemo.sln --configuration Release --no-build'
            }
        }

        stage('Publish') {
            steps {
                // Publish to a predictable folder that Jenkins can archive.
                bat '''
                    dotnet publish src\\JenkinsHelloWorld\\JenkinsHelloWorld.csproj ^
                        --configuration Release ^
                        --runtime win-x64 ^
                        --self-contained false ^
                        --output artifacts\\publish
                '''
            }
        }
    }

    post {
        success {
            // Preserve all published output for download from the Jenkins build.
            archiveArtifacts artifacts: 'artifacts/publish/**/*',
                             fingerprint: true
        }
    }
}

C.2 Static-site pipeline

pipeline {
    agent any

    environment {
        // Required: replace with your real demo bucket name in Jenkins config
        // or inject it as a parameter/environment value.
        S3_BUCKET = '<BUCKET-NAME>'
    }

    stages {
        stage('Validate') {
            steps {
                powershell '''
                    ./scripts/Test-StaticSite.ps1
                '''
            }
        }

        stage('Deploy') {
            steps {
                // Start without --delete. Add it only after you understand
                // that it removes destination objects missing from the source.
                powershell '''
                    aws s3 sync ./site "s3://$env:S3_BUCKET"
                '''
            }
        }
    }
}

The AWS authentication mechanism is intentionally not hard-coded in this file. Inject credentials securely using Jenkins/AWS mechanisms appropriate to the environment.