diff --git a/jenkins-examples/pipeline-examples/README.md b/jenkins-examples/pipeline-examples/README.md deleted file mode 100755 index c44c375105..0000000000 --- a/jenkins-examples/pipeline-examples/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# Jenkins Pipeline - Working With Artifactory - -## Introduction -Pipeline jobs in Jenkins allow creating a script which defines your build steps. -For those not familiar with Jenkins Pipelines, check out the [Pipeline Tutorial](https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md) or the [Getting Started With Pipeline](https://jenkins.io/doc/book/pipeline/) documentation. - -You may find more information on working with JFrog Artifactory using Jenkins pipeline jobs on the [Working With Pipeline Jobs in Jenkins](https://www.jfrog.com/confluence/display/RTF/Working+With+Pipeline+Jobs+in+Jenkins) documentation. - -## Examples -The examples in this repository are meant to help you get started using the Artifactory Pipeline APIs in your pipeline scripts. - -Follow the below steps to run the examples. - -### Step 1 - Configure Artifactory Server for the Examples -All examples use an Artifactory server defined in Jenkins' Configuration. - -Find or configure an Artifactory server in Jenkins through *Manage Jenkins*, *Configure System*. You'll need its Server ID. - -### Step 2 - Set or Replace Variables in the Example's Pipeline -The pipeline of most examples includes variables, such as `SERVER_ID`, `MAVEN_TOOL`, `ARTIFACTORY_LOCAL_RELEASE_REPO`, etc. - -Please make sure to either set or replace these variables with values that suit your configuration. - -To set the variables for the pipeline, follow these steps: - -* In the Jenkins job configuration, check the *This project is parameterized* option. -* Click *Add Parameter* and then select *String Parameter*. -* Set the *Name* as the variable name (`SERVER_ID` for example) and the *Default Value* as the required value (Artifactory Server ID configured in `Manage Jenkins`, for example). - -### Step 3 - Configure the Jenkins Job -Configure the Jenkins using one of the following methods. -#### Method 1: -In the job configuration, set *Definition* to *Pipeline script*, -and then copy the content of the example's Jenkinsfile into the *Script* text-area. -#### Method 2: -In the job configuration: -* Set *Definition* to *Pipeline script from SCM*. -* Set *SCM* to *Git*. -* Set *Repository URL* to *https://github.com/jfrog/project-examples.git* -* Set *Script Path* to the relative path to the example's Jenkinsfile. For example, to run the [maven-example](declarative-examples/maven-example/Jenkinsfile) set *Script Path* to *jenkins-examples/pipeline-examples/declarative-examples/maven-example/Jenkinsfile* - -### Available Examples -This repository includes [Declarative pipeline examples](declarative-examples) and [Scripted pipeline examples](scripted-examples) - -Learn more about [working with pipeline jobs in Jenkins](https://www.jfrog.com/confluence/display/RTF/Working+With+Pipeline+Jobs+in+Jenkins) and the benefits of [Artifactory’s integration with Jenkins CI](https://jfrog.com/integration/jenkins-ci/). \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/README.md b/jenkins-examples/pipeline-examples/declarative-examples/README.md deleted file mode 100644 index 2b71cbf8c8..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Declarative pipeline examples: - -The examples here are meant to help you get started working with Artifactory in your Jenkins pipeline scripts. -To set up Jenkins to use the example, read [this](https://github.com/jfrog/project-examples/tree/master/jenkins-examples/pipeline-examples) page. - -* The [aql-example](aql-example) uses a Download Spec which includes [AQL](https://www.jfrog.com/confluence/display/RTF/Artifactory+Query+Language) instead of a wildcard pattern. -* The [build-retention-example](build-retention-example) demonstrates triggering build retention in Artifactory. -* The [build-scan-example](build-scan-example) demonstrates how to scan published builds with JFrog Xray. -* The [build-trigger-example](build-trigger-example) demonstrates how to trigger a build when files are added or modified in a specific Artifactory path. -* The [conan-example](conan-example) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a Conan build. -* The [docker-push-example](docker-push-example) demonstrates how to push a docker image to Artifactory. -* The [docker-pull-example](docker-pull-example) demonstrates how to pull a docker image from Artifactory. -* The [dotnet-example](dotnet-example) resolves dependencies and publishes build-info to Artifactory for a .NET build. -* The [exclude-patterns-download-example](exclude-patterns-download-example) demonstrates how to exclude certain files while downloading. -* The [exclude-patterns-upload-example](exclude-patterns-upload-example) demonstrates how to exclude certain files while uploading. -* The [go-example](go-example) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a Go build. -* The [gradle-example-ci-server](gradle-example-ci-server) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a Gradle build. Unlike the [gradle-example](gradle-example), this examples assumes that the Gradle Artifactory Plugin in not applied to the Gradle build script. -* The [gradle-example](gradle-example) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a Gradle build. Unlike the [gradle-example-ci-server](gradle-example-ci-server), this examples assumes that the Gradle Artifactory Plugin in already applied in the Gradle build script. -* The [interactive-promotion-example](interactive-promotion-example) demonstrates how to promote a build in Artifactory after the build finished. -* The [issues-collection-example](issues-collection-example) demonstrates how to collect the list of tracked project issues and add them to the build-info. -* The [jfrog-distribution-example](jfrog-distribution-example) demonstrates how to create, update, sign, distribute, and delete a release bundle. -* The [jfrog-pipelines-example](jfrog-pipelines-example) demonstrates how to collect output resources when using JFrog Pipelines integration. -* The [kaniko-example](kaniko-example) demonstrate how to collect build info for Docker images created by Kaniko. -* The [maven-example](maven-example) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a Maven build. -* The [maven-jib-example](maven-example) demonstrates how to collect and publish build-info for a Maven JIB build. -* The [npm-container-example](npm-container-example) demonstrates how to run npm in a Docker container. Use this example only in **Multibranch Pipeline** or a **Pipeline from SCM**, as instructed [here](https://jenkins.io/doc/book/pipeline/syntax/#agent) under **dockerfile**. -* The [npm-example](npm-example) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a npm build. -* The [nuget-example](nuget-example) resolves dependencies and publishes build-info to Artifactory for a NuGet build. -* The [pip-examples](pip-examples) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a pip build. -* The [promotion-example](promotion-example) demonstrates how to promote a build in Artifactory. -* The [props-example](props-example) demonstrates setting/deleting properties on artifacts in Artifactory. Also downloads and uploads files to Artifactory with properties, while using a placeholder when downloading. -* The [props-single-file-example](props-single-file-example) is the same as the [props-example](props-example), but has the specs embedded inside the Groovy script. -* The [jenkins-with-jfrog-pipelines](jenkins-with-jfrog-pipelines) demonstrates three different ways to leap forward with JFrog Pipelines as part of your existing Jenkins based DevOps processes. diff --git a/jenkins-examples/pipeline-examples/declarative-examples/aql-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/aql-example/Jenkinsfile deleted file mode 100755 index 8ccb7af8c2..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/aql-example/Jenkinsfile +++ /dev/null @@ -1,44 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Upload') { - steps { - rtUpload ( - buildName: 'holyFrog', - buildNumber: '42', - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - serverId: SERVER_ID, - specPath: 'jenkins-examples/pipeline-examples/resources/recursive-flat-upload.json' - ) - } - } - - stage ('Download') { - steps { - rtDownload ( - buildName: 'holyFrog', - buildNumber: '42', - serverId: SERVER_ID, - specPath: 'jenkins-examples/pipeline-examples/resources/aql-download.json' - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - buildName: 'holyFrog', - buildNumber: '42', - serverId: SERVER_ID - ) - } - } - } -} diff --git a/jenkins-examples/pipeline-examples/declarative-examples/build-retention-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/build-retention-example/Jenkinsfile deleted file mode 100755 index 400d553cd1..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/build-retention-example/Jenkinsfile +++ /dev/null @@ -1,27 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Configure build info') { - steps { - rtBuildInfo ( - // Build retention: - maxBuilds: 1, - maxDays: 2, - doNotDiscardBuilds: ["3"], - deleteBuildArtifacts: true - // Using the Jenkins job's build name and number. - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - serverId: SERVER_ID - ) - } - } - } -} diff --git a/jenkins-examples/pipeline-examples/declarative-examples/build-scan-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/build-scan-example/Jenkinsfile deleted file mode 100644 index 2ceeaba6e6..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/build-scan-example/Jenkinsfile +++ /dev/null @@ -1,63 +0,0 @@ -pipeline { - agent any - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Artifactory configuration') { - steps { - rtServer ( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - - rtMavenDeployer ( - id: "MAVEN_DEPLOYER", - serverId: "ARTIFACTORY_SERVER", - releaseRepo: ARTIFACTORY_LOCAL_RELEASE_REPO, - snapshotRepo: ARTIFACTORY_LOCAL_SNAPSHOT_REPO - ) - - rtMavenResolver ( - id: "MAVEN_RESOLVER", - serverId: "ARTIFACTORY_SERVER", - releaseRepo: ARTIFACTORY_VIRTUAL_RELEASE_REPO, - snapshotRepo: ARTIFACTORY_VIRTUAL_SNAPSHOT_REPO - ) - } - } - - stage ('Exec Maven') { - steps { - rtMavenRun ( - tool: MAVEN_TOOL, // Tool name from Jenkins configuration - pom: 'maven-examples/maven-example/pom.xml', - goals: 'clean install -U', - deployerId: "MAVEN_DEPLOYER", - resolverId: "MAVEN_RESOLVER" - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: "ARTIFACTORY_SERVER" - ) - } - } - - stage ('Xray scan') { - steps { - xrayScan ( - serverId: "ARTIFACTORY_SERVER", - failBuild: false - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/build-trigger-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/build-trigger-example/Jenkinsfile deleted file mode 100644 index 202dd26044..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/build-trigger-example/Jenkinsfile +++ /dev/null @@ -1,31 +0,0 @@ -pipeline { - agent any - - environment { - // The URL of the artifact in Artifactory, that caused the job to be triggered. - // May be empty if the build isn't triggered by a change in Artifactory. - RT_TRIGGER_URL = "${currentBuild.getBuildCauses('org.jfrog.hudson.trigger.ArtifactoryCause')[0]?.url}" - } - - stages { - stage('Artifactory configuration') { - steps { - rtServer( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - } - } - - stage('Add build trigger') { - steps { - rtBuildTrigger( - serverId: "ARTIFACTORY_SERVER", - spec: "*/10 * * * *", - paths: "generic-libs-local/builds/starship" - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/conan-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/conan-example/Jenkinsfile deleted file mode 100644 index 2fb8f3b86f..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/conan-example/Jenkinsfile +++ /dev/null @@ -1,59 +0,0 @@ -pipeline { - agent any - - stages { - // Clone the code from github: - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/memsharded/example-poco-timer.git" - } - } - - stage ('Conan configuration') { - steps { - // Create a conan client instance - rtConanClient ( - id: "myConanClient" - ) - - // Add a new repository named 'conan-local' to the conan client. - // The name provided can be used later in the script: - rtConanRemote ( - name: "myRemoteName", - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - serverId: SERVER_ID, - repo: "conan-local", - clientId: "myConanClient" - ) - } - } - - // Run a conan build. - stage ('Exec Conan install') { - steps { - rtConanRun ( - clientId: "myConanClient", - command: "install . --build missing" - ) - } - } - - // Run an upload command, with the remote name defined in rtConanRemote step. - stage ('Exec Conan upload') { - steps { - rtConanRun ( - clientId: "myConanClient", - command: "upload * --all -r myRemoteName --confirm" - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: SERVER_ID - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/docker-pull-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/docker-pull-example/Jenkinsfile deleted file mode 100644 index dcaafe1d3b..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/docker-pull-example/Jenkinsfile +++ /dev/null @@ -1,37 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Artifactory configuration') { - steps { - rtServer ( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - } - } - - stage ('Pull an image from Artifactory') { - steps { - rtDockerPull( - serverId: "ARTIFACTORY_SERVER", - image: ARTIFACTORY_DOCKER_REGISTRY + '/hello-world:latest', - // Host: - // On OSX: "tcp://127.0.0.1:1234" - // On Linux can be omitted or null - host: HOST_NAME, - sourceRepo: 'docker-remote', - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: "ARTIFACTORY_SERVER" - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/docker-push-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/docker-push-example/Jenkinsfile deleted file mode 100644 index 36a0899284..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/docker-push-example/Jenkinsfile +++ /dev/null @@ -1,53 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Artifactory configuration') { - steps { - rtServer ( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - } - } - - stage ('Build docker image') { - steps { - script { - docker.build(ARTIFACTORY_DOCKER_REGISTRY + '/hello-world:latest', 'jenkins-examples/pipeline-examples/resources') - } - } - } - - stage ('Push image to Artifactory') { - steps { - rtDockerPush( - serverId: "ARTIFACTORY_SERVER", - image: ARTIFACTORY_DOCKER_REGISTRY + '/hello-world:latest', - // Host: - // On OSX: "tcp://127.0.0.1:1234" - // On Linux can be omitted or null - host: HOST_NAME, - targetRepo: 'docker-local', - // Attach custom properties to the published artifacts: - properties: 'project-name=docker1;status=stable' - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: "ARTIFACTORY_SERVER" - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/dotnet-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/dotnet-example/Jenkinsfile deleted file mode 100644 index 78ac899d7e..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/dotnet-example/Jenkinsfile +++ /dev/null @@ -1,44 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/graphql-dotnet/graphql-dotnet.git" - } - } - - stage ('Artifactory configuration') { - steps { - rtServer ( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - - rtDotnetResolver ( - id: "DOTNET_RESOLVER", - serverId: "ARTIFACTORY_SERVER", - repo: "nuget-remote" - ) - } - } - - stage ('Exec .NET restore') { - steps { - rtDotnetRun ( - resolverId: "DOTNET_RESOLVER", - args: "restore ./src/GraphQL.sln" - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: "ARTIFACTORY_SERVER" - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/exclude-patterns-download-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/exclude-patterns-download-example/Jenkinsfile deleted file mode 100644 index 5ef53376ca..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/exclude-patterns-download-example/Jenkinsfile +++ /dev/null @@ -1,38 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Upload') { - steps { - rtUpload ( - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - serverId: SERVER_ID, - specPath: 'jenkins-examples/pipeline-examples/resources/props-upload.json' - ) - } - } - - stage ('Excluded download') { - steps { - rtDownload ( - serverId: SERVER_ID, - specPath: 'jenkins-examples/pipeline-examples/resources/exclude-download.json' - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: SERVER_ID - ) - } - } - } -} diff --git a/jenkins-examples/pipeline-examples/declarative-examples/exclude-patterns-upload-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/exclude-patterns-upload-example/Jenkinsfile deleted file mode 100644 index b5756c8c8b..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/exclude-patterns-upload-example/Jenkinsfile +++ /dev/null @@ -1,29 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Excluded upload') { - steps { - rtUpload ( - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - serverId: SERVER_ID, - specPath: 'jenkins-examples/pipeline-examples/resources/exclude-upload.json' - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: SERVER_ID - ) - } - } - } -} diff --git a/jenkins-examples/pipeline-examples/declarative-examples/go-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/go-example/Jenkinsfile deleted file mode 100644 index 0f9897c608..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/go-example/Jenkinsfile +++ /dev/null @@ -1,61 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Artifactory configuration') { - steps { - rtServer ( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - - rtGoResolver ( - id: "GO_RESOLVER", - serverId: "ARTIFACTORY_SERVER", - repo: "go" - ) - - rtGoDeployer ( - id: "GO_DEPLOYER", - serverId: "ARTIFACTORY_SERVER", - repo: "go-local" - ) - } - } - - stage ('Exec Go run') { - steps { - rtGoRun ( - path: "golang-example", - resolverId: "GO_RESOLVER", - args: "build" - ) - } - } - - stage ('Exec Go publish') { - steps { - rtGoPublish ( - path: "golang-example", - deployerId: "GO_DEPLOYER", - version: "1.0.0" - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: "ARTIFACTORY_SERVER" - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/gradle-example-ci-server/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/gradle-example-ci-server/Jenkinsfile deleted file mode 100755 index bd49fe6636..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/gradle-example-ci-server/Jenkinsfile +++ /dev/null @@ -1,53 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Artifactory configuration') { - steps { - rtServer ( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - - rtGradleDeployer ( - id: "GRADLE_DEPLOYER", - serverId: "ARTIFACTORY_SERVER", - repo: ARTIFACTORY_LOCAL_RELEASE_REPO, - ) - - rtGradleResolver ( - id: "GRADLE_RESOLVER", - serverId: "ARTIFACTORY_SERVER", - repo: ARTIFACTORY_VIRTUAL_RELEASE_REPO - ) - } - } - - stage ('Exec Gradle') { - steps { - rtGradleRun ( - tool: GRADLE_TOOL, // Tool name from Jenkins configuration - rootDir: "gradle-examples/gradle-example-ci-server/", - tasks: 'clean artifactoryPublish', - deployerId: "GRADLE_DEPLOYER", - resolverId: "GRADLE_RESOLVER" - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: "ARTIFACTORY_SERVER" - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/gradle-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/gradle-example/Jenkinsfile deleted file mode 100644 index e5d96d20b1..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/gradle-example/Jenkinsfile +++ /dev/null @@ -1,70 +0,0 @@ -pipeline { - agent any - - environment { - DONT_COLLECT = 'FOO' - } - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Artifactory configuration') { - steps { - rtServer ( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - - rtGradleDeployer ( - id: "GRADLE_DEPLOYER", - serverId: "ARTIFACTORY_SERVER", - repo: ARTIFACTORY_LOCAL_SNAPSHOT_REPO, - excludePatterns: ["*.war"], - ) - - rtGradleResolver ( - id: "GRADLE_RESOLVER", - serverId: "ARTIFACTORY_SERVER", - repo: ARTIFACTORY_VIRTUAL_RELEASE_REPO - ) - } - } - - stage ('Config Build Info') { - steps { - rtBuildInfo ( - captureEnv: true, - includeEnvPatterns: ["*"], - excludeEnvPatterns: ["DONT_COLLECT*"] - ) - } - } - - stage ('Exec Gradle') { - steps { - rtGradleRun ( - usesPlugin: true, // Artifactory plugin already defined in build script - useWrapper: true, - tool: GRADLE_TOOL, // Tool name from Jenkins configuration - rootDir: "gradle-examples/gradle-example-publish/", - tasks: 'clean artifactoryPublish', - deployerId: "GRADLE_DEPLOYER", - resolverId: "GRADLE_RESOLVER" - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: "ARTIFACTORY_SERVER" - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/interactive-promotion-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/interactive-promotion-example/Jenkinsfile deleted file mode 100755 index 69e8939b35..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/interactive-promotion-example/Jenkinsfile +++ /dev/null @@ -1,77 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Upload') { - steps { - rtUpload ( - buildName: 'MK', - buildNumber: '48', - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - serverId: SERVER_ID, - specPath: 'jenkins-examples/pipeline-examples/resources/props-upload.json' - ) - } - } - - stage ('Download') { - steps { - rtDownload ( - buildName: 'MK', - buildNumber: '49', - serverId: SERVER_ID, - specPath: 'jenkins-examples/pipeline-examples/resources/props-download.json' - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - buildName: 'MK', - buildNumber: '48', - serverId: SERVER_ID - ) - - rtPublishBuildInfo ( - buildName: 'MK', - buildNumber: '49', - serverId: SERVER_ID - ) - } - } - - stage ('Add interactive promotion') { - steps { - rtAddInteractivePromotion ( - //Mandatory parameter - serverId: SERVER_ID, - - //Optional parameters - targetRepo: ARTIFACTORY_LOCAL_RELEASE_REPO, - displayName: 'Promote me please', - buildName: 'MK', - buildNumber: '48', - comment: 'this is the promotion comment', - sourceRepo: ARTIFACTORY_LOCAL_SNAPSHOT_REPO, - status: 'Released', - includeDependencies: true, - failFast: true, - copy: true - ) - - rtAddInteractivePromotion ( - serverId: SERVER_ID, - buildName: 'MK', - buildNumber: '49' - ) - } - } - } -} diff --git a/jenkins-examples/pipeline-examples/declarative-examples/issues-collection-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/issues-collection-example/Jenkinsfile deleted file mode 100644 index 610011b568..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/issues-collection-example/Jenkinsfile +++ /dev/null @@ -1,58 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/jenkins-artifactory-plugin.git" - } - } - - stage ('Build Info') { - steps { - rtBuildInfo ( - // Optional - Build name and build number. If not set, the Jenkins job's build name and build number are used. - buildName: 'my-build', - buildNumber: '20' - ) - } - } - - stage ('Issues Collection') { - steps { - rtCollectIssues ( - serverId: SERVER_ID, - config: """{ - "version": 1, - "issues": { - "trackerName": "JIRA", - "regexp": "(.+-[0-9]+)\\s-\\s(.+)", - "keyGroupIndex": 1, - "summaryGroupIndex": 2, - "trackerUrl": "http://my-jira.com/issues", - "aggregate": "true", - "aggregationStatus": "RELEASED" - } - }""", - - // You may alternatively provide a path to a config file, instead of the config itself, by setting: - // configPath: '/path/to/config' - - // If custom build name and/or number were set: - buildName: 'my-build', - buildNumber: '20' - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: SERVER_ID, - buildName: 'my-build', - buildNumber: '20' - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/Dockerfile b/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/Dockerfile deleted file mode 100644 index c3c999d3e0..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -# Alpine Linux with OpenJDK JRE -FROM openjdk:8-jre-alpine - -RUN apk --no-cache add curl - -EXPOSE 8181 - -# copy jar into image -COPY target/spring-petclinic-*.jar /usr/bin/spring-petclinic.jar - -# run application with this command line -ENTRYPOINT ["java","-jar","/usr/bin/spring-petclinic.jar","--server.port=8181"] diff --git a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/Jenkinsfile deleted file mode 100644 index 498dfba12c..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/Jenkinsfile +++ /dev/null @@ -1,107 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/talitz/spring-petclinic-ci-cd-k8s-example.git" - } - } - - stage ('Artifactory Configuration') { - steps { - rtServer ( - id: "artifactory-server-id", - url: "https://talyi.jfrog.io/artifactory", - credentialsId: "admin.jfrog" - ) - - rtMavenResolver ( - id: 'maven-resolver', - serverId: 'artifactory-server-id', - releaseRepo: ARTIFACTORY_VIRTUAL_RELEASE_REPO, - snapshotRepo: ARTIFACTORY_VIRTUAL_SNAPSHOT_REPO - ) - - rtMavenDeployer ( - id: 'maven-deployer', - serverId: 'artifactory-server-id', - releaseRepo: ARTIFACTORY_LOCAL_RELEASE_REPO, - snapshotRepo: ARTIFACTORY_LOCAL_SNAPSHOT_REPO, - threads: 6, - properties: ['BinaryPurpose=Technical-BlogPost', 'Team=DevOps-Acceleration'] - ) - } - } - - stage('Build Maven Project') { - steps { - rtMavenRun ( - tool: 'Maven 3.3.9', - pom: 'pom.xml', - goals: '-U clean install', - deployerId: "maven-deployer", - resolverId: "maven-resolver" - ) - } - } - - stage ('Build Docker Image') { - steps { - script { - docker.build("talyi-docker.jfrog.io/" + "pet-clinic:1.0.${env.BUILD_NUMBER}") - } - } - } - - stage ('Push Image to Artifactory') { - steps { - rtDockerPush( - serverId: "artifactory-server-id", - image: "talyi-docker.jfrog.io/" + "pet-clinic:1.0.${env.BUILD_NUMBER}", - targetRepo: 'docker', - properties: 'project-name=jfrog-blog-post;status=stable' - ) - } - } - - stage ('Publish Build Info') { - steps { - rtPublishBuildInfo ( - serverId: "helmRepoResource" - ) - } - } - - stage('Install Helm') { - steps { - sh """ - curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 - chmod 700 get_helm.sh && helm version - """ - } - } - - stage('Configure Helm & Artifactory') { - steps { - withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'admin.jfrog', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { - sh """ - helm repo add helm https://talyi.jfrog.io/artifactory/helm --username ${env.USERNAME} --password ${env.PASSWORD} - helm repo update - """ - } - } - } - - stage('Deploy Chart') { - steps { - withCredentials([kubeconfigContent(credentialsId: 'k8s-cluster-kubeconfig', variable: 'KUBECONFIG_CONTENT')]) { - sh """ - echo "$KUBECONFIG_CONTENT" > config && cp config ~/.kube/config - helm upgrade --install spring-petclinic-ci-cd-k8s-example helm/spring-petclinic-ci-cd-k8s-chart --kube-context=gke_soleng-dev_us-west1-a_artifactory-ha-cluster --set=image.tag=1.0.${env.BUILD_NUMBER} - """ - } - } - } - } -} diff --git a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/README.md b/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/README.md deleted file mode 100644 index 72d367bd09..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# How I Leaped Forward My Jenkins Build with JFrog Pipelines - -This examples demonstrates different ways to accelerate and improve your CI/CD, with JFrog Pipelines as part of your SDLC. -The full description of how to set up and run this examples are available on <---this blog post--->. diff --git a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/ci-jenkins-cd-pipelines/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/ci-jenkins-cd-pipelines/Jenkinsfile deleted file mode 100644 index a0afaa531e..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/ci-jenkins-cd-pipelines/Jenkinsfile +++ /dev/null @@ -1,84 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/talitz/spring-petclinic-ci-cd-k8s-example.git" - } - } - - stage ('Artifactory Configuration') { - steps { - rtServer ( - id: "artifactory-server-id", - url: "https://talyi.jfrog.io/artifactory", - credentialsId: "admin.jfrog" - ) - - rtMavenResolver ( - id: 'maven-resolver', - serverId: 'artifactory-server-id', - releaseRepo: ARTIFACTORY_VIRTUAL_RELEASE_REPO, - snapshotRepo: ARTIFACTORY_VIRTUAL_SNAPSHOT_REPO - ) - - rtMavenDeployer ( - id: 'maven-deployer', - serverId: 'artifactory-server-id', - releaseRepo: ARTIFACTORY_LOCAL_RELEASE_REPO, - snapshotRepo: ARTIFACTORY_LOCAL_SNAPSHOT_REPO, - threads: 6, - properties: ['BinaryPurpose=Technical-BlogPost', 'Team=DevOps-Acceleration'] - ) - } - } - - stage('Build Maven Project') { - steps { - rtMavenRun ( - tool: 'Maven 3.3.9', - pom: 'pom.xml', - goals: '-U clean install', - deployerId: "maven-deployer", - resolverId: "maven-resolver" - ) - } - } - - stage ('Build Docker Image') { - steps { - script { - docker.build("talyi-docker.jfrog.io/" + "pet-clinic:1.0.${env.BUILD_NUMBER}") - } - } - } - - stage ('Push Image to Artifactory') { - steps { - rtDockerPush( - serverId: "artifactory-server-id", - image: "talyi-docker.jfrog.io/" + "pet-clinic:1.0.${env.BUILD_NUMBER}", - targetRepo: 'docker', - properties: 'project-name=jfrog-blog-post;status=stable' - ) - } - } - - stage ('Publish Build Info') { - steps { - rtPublishBuildInfo ( - serverId: "artifactory-server-id" - ) - } - } - - stage('Trigger JFrog Pipelines') { - steps { - withCredentials([usernamePassword(credentialsId: 'incoming-web-hook-creds', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { - sh "curl -XPOST https://$USERNAME:$PASSWORD@talyi-pipelines-api.jfrog.io/v1/projectIntegrations/39/hook" - } - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/ci-jenkins-cd-pipelines/pipelines.yml b/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/ci-jenkins-cd-pipelines/pipelines.yml deleted file mode 100644 index bfbb8eb8c4..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/ci-jenkins-cd-pipelines/pipelines.yml +++ /dev/null @@ -1,53 +0,0 @@ - -#CI in Jenkins, CD in Pipelines -resources: - - name: incoming_basic_hook - type: IncomingWebhook - configuration: - webhookName: in_hook_int - - - name: spring_helm_chart_resource - type: HelmChart - configuration: - sourceArtifactory: artifactory_eu - repository: helm - chart: spring-petclinic-ci-cd-k8s-chart - version: '1.0.0' - -pipelines: - - name: deploy_spring_pet_clinic - steps: - - name: start_by_hook - type: Bash - configuration: - inputResources: - - name: incoming_basic_hook - execution: - onExecute: - - echo "job triggered by resource-> $step_triggered_by_resource_name" - - echo "$res_incoming_basic_hook_payload" | jq '.' > payload.json - - echo "$(read_json payload.json my.nested.object)" - - - name: deploy_helm_chart - type: HelmDeploy - configuration: - runtime: - type: image - image: - custom: - name: releases-docker.jfrog.io/jfrog/pipelines-u18node - tag: "12.18.2" - autoPull: true - integrations: - - name: app_spring_pet_clinic_k8s_cluster_integration - - name: gcloud_k8s_creds - helmVersion: 3 - lint: true - flags: --kube-context=gke_soleng-dev_us-west1-a_artifactory-ha-cluster --set=image.tag=1.0.100 - inputSteps: - - name: start_by_hook - inputResources: - - name: spring_helm_chart_resource - releaseName: spring-petclinic-ci-cd-k8s-example - valueFilePaths: - - values.yaml diff --git a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/ci-pipelines-cd-jenkins/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/ci-pipelines-cd-jenkins/Jenkinsfile deleted file mode 100644 index e7b7a843eb..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/ci-pipelines-cd-jenkins/Jenkinsfile +++ /dev/null @@ -1,44 +0,0 @@ -pipeline { - agent any - - stages { - stage('Install Helm') { - steps { - sh """ - curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 - chmod 700 get_helm.sh && helm version - """ - } - } - - stage('Configure Helm & Artifactory') { - steps { - withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'admin.jfrog', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { - sh """ - helm repo add helm https://talyi.jfrog.io/artifactory/helm --username ${env.USERNAME} --password ${env.PASSWORD} - helm repo update - """ - } - } - } - - stage('Deploy Chart') { - steps { - withCredentials([kubeconfigContent(credentialsId: 'k8s-cluster-kubeconfig', variable: 'KUBECONFIG_CONTENT')]) { - sh """ - echo "$KUBECONFIG_CONTENT" > config && cp config ~/.kube/config - helm upgrade --install spring-petclinic-ci-cd-k8s-example helm/spring-petclinic-ci-cd-k8s-chart --kube-context=gke_soleng-dev_us-west1-a_artifactory-ha-cluster --set=image.tag=1.0.${env.BUILD_NUMBER} - """ - } - } - } - - stage('Report to Pipelines') { - steps { - jfPipelines ( - reportStatus: "SUCCESS" - ) - } - } - } -} diff --git a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/ci-pipelines-cd-jenkins/pipelines.yml b/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/ci-pipelines-cd-jenkins/pipelines.yml deleted file mode 100644 index 03ce7ec85a..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/ci-pipelines-cd-jenkins/pipelines.yml +++ /dev/null @@ -1,103 +0,0 @@ -# CI in Pipelines, CD in Jenkins -resources: - - name: calculate_repository_resource - type: GitRepo - configuration: - gitProvider: talitzgithub - path: talitz/spring-petclinic-ci-cd-k8s-example - branches: - include: master - - - name: appl_build_info - type: BuildInfo - configuration: - sourceArtifactory: artifactory_eu - buildName: build_and_dockerize_spring_pet_clinic - buildNumber: 1 - - - name: dbp_image - type: Image - configuration: - registry: artifactory_eu - sourceRepository: docker_local - imageName: talyi-docker.jfrog.io/pet-clinic - imageTag: 1.0.0 - autoPull: true - -pipelines: - - name: build_and_dockerize_spring_pet_clinic - steps: - - name: build_app - type: MvnBuild - configuration: - affinityGroup: dbp_group - integrations: - - name: artifactory_eu - sourceLocation: . - autoPublishBuildInfo: true - mvnCommand: clean install -s settings.xml - configFileLocation: . - configFileName: maven.yaml - inputResources: - - name: calculate_repository_resource - outputResources: - - name: appl_build_info - - - name: docker_build - type: DockerBuild - configuration: - runtime: - type: image - image: - custom: - name: releases-docker.jfrog.io/jfrog/pipelines-u18node - tag: "12.18.2" - autoPull: true - inputSteps: - - name: build_app - affinityGroup: dbp_group - dockerFileLocation: . - dockerFileName: Dockerfile - dockerImageName: talyi-docker.jfrog.io/pet-clinic - dockerImageTag: 1.0.${run_number} - inputResources: - - name: calculate_repository_resource - integrations: - - name: artifactory_eu - execution: - onStart: - - jfrog rt dl libs-snapshot-local --build=build_and_dockerize_spring_pet_clinic --flat=true - - mkdir target - - cp spring-petclinic-*.jar target/ - - pwd - - mv -v target $res_calculate_repository_resource_resourcePath - - - name: docker_push - type: DockerPush - configuration: - runtime: - type: image - image: - custom: - name: releases-docker.jfrog.io/jfrog/pipelines-u18node - tag: "12.18.2" - autoPull: true - inputSteps: - - name: docker_build - affinityGroup: dbp_group - targetRepository: docker-local - integrations: - - name: artifactory_eu - outputResources: - - name: dbp_image - - - name: trigger_jenkins - type: Jenkins - configuration: - inputSteps: - - name: docker_push - jenkinsJobName: spring-petclinic-ci-cd-k8s-example - inputResources: - - name: dbp_image - integrations: - - name: new_jenk_int \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/pipelines-ci-for-chart/pipelines.yml b/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/pipelines-ci-for-chart/pipelines.yml deleted file mode 100644 index 35929984ac..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/jenkins-with-jfrog-pipelines/pipelines-ci-for-chart/pipelines.yml +++ /dev/null @@ -1,29 +0,0 @@ -resources: - - name: spring_petclinic_ci_cd_k8s_chart_repo - type: GitRepo - configuration: - gitProvider: talitzgithub - path: talitz/spring-petclinic-ci-cd-k8s-chart - branches: - include: master - -pipelines: - - name: helm_chart_ci - steps: - - name: publish_helm_chart - type: HelmPublish - configuration: - runtime: - type: image - image: - custom: - name: releases-docker.jfrog.io/jfrog/pipelines-u18node - tag: "12.18.2" - autoPull: true - helmVersion: 3 - lint: true - inputResources: - - name: spring_petclinic_ci_cd_k8s_chart_repo - outputResources: - - name: spring_helm_chart_resource - chartPath: spring-petclinic-ci-cd-k8s-chart diff --git a/jenkins-examples/pipeline-examples/declarative-examples/jfrog-distribution-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/jfrog-distribution-example/Jenkinsfile deleted file mode 100644 index 6f2aac320d..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/jfrog-distribution-example/Jenkinsfile +++ /dev/null @@ -1,114 +0,0 @@ -pipeline { - agent any - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Upload file') { - steps { - rtUpload ( - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - serverId: SERVER_ID, - spec: """{ - "files": [ - { - "pattern": "jenkins-examples/pipeline-examples/resources/ArtifactoryPipeline.zip", - "target": "libs-release-local" - } - ] - }""" - ) - } - } - - stage ('Create release bundle') { - steps { - dsCreateReleaseBundle( - serverId: SERVER_ID, - name: "example-release-bundle", - version: "1", - spec: """{ - "files": [ - { - "pattern": "libs-release-local/ArtifactoryPipeline.zip" - } - ] - }""" - ) - } - } - - stage ('Update release bundle') { - steps { - dsUpdateReleaseBundle( - serverId: SERVER_ID, - name: "example-release-bundle", - version: "1", - spec: """{ - "files": [ - { - "pattern": "libs-release-local/ArtifactoryPipeline.zip" - } - ] - }""", - description: "Update a release bundle" - ) - } - } - - // Optional - this step can be achieved also by providing "signImmediately: true" to dsUpdateReleaseBundle step - stage ('Sign release bundle') { - steps { - dsSignReleaseBundle( - serverId: SERVER_ID, - name: "example-release-bundle", - version: "1" - ) - } - } - - stage ('Distribute release bundle') { - steps { - dsDistributeReleaseBundle( - serverId: SERVER_ID, - name: "example-release-bundle", - version: "1", - sync: true, - distRules: """{ - "distribution_rules": [ - { - "site_name": "*", - "city_name": "*", - "country_codes": ["*"] - } - ] - }""" - ) - } - } - - stage ('Delete release bundle') { - steps { - dsDeleteReleaseBundle( - serverId: SERVER_ID, - name: "example-release-bundle", - version: "1", - sync: true, - deleteFromDist: true, - distRules: """{ - "distribution_rules": [ - { - "site_name": "*", - "city_name": "*", - "country_codes": ["*"] - } - ] - }""" - ) - } - } - } -} diff --git a/jenkins-examples/pipeline-examples/declarative-examples/jfrog-pipelines-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/jfrog-pipelines-example/Jenkinsfile deleted file mode 100644 index d323d505f5..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/jfrog-pipelines-example/Jenkinsfile +++ /dev/null @@ -1,57 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: 'https://github.com/jfrog/project-examples.git' - } - } - - stage ('Upload file') { - steps { - rtUpload ( - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - serverId: SERVER_ID, - spec: """{ - "files": [ - { - "pattern": "jenkins-examples/pipeline-examples/resources/ArtifactoryPipeline.zip", - "target": "libs-snapshot-local" - } - ] - }""" - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: SERVER_ID - ) - } - } - - stage ('Set output resources') { - steps { - // 'jfPipelines' step will be skipped if the build is not triggered by JFrog Pipelines. - jfPipelines( - /** - * Sets the output resources to send to JFrog Pipelines. - * 'pipelinesBuildInfo' is the build-info resource defined in JFrog Pipelines. - */ - outputResources: """[ - { - "name": "pipelinesBuildInfo", - "content": { - "buildName": "${env.JOB_NAME}", - "buildNumber": "${env.BUILD_NUMBER}" - } - } - ]""" - ) - } - } - } -} diff --git a/jenkins-examples/pipeline-examples/declarative-examples/kaniko-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/kaniko-example/Jenkinsfile deleted file mode 100644 index aed19f5ef7..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/kaniko-example/Jenkinsfile +++ /dev/null @@ -1,47 +0,0 @@ -pipeline { - agent any - stages { - stage ('Clone') { - steps { - git url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Exec Kaniko') { - steps { - withCredentials([usernamePassword(credentialsId: CREDENTIALS, usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) { - dir('jenkins-examples/pipeline-examples/resources/kaniko') { - sh ''' - eval "echo \"$( kaniko-config.json - docker run --rm -v ${PWD}:/workspace -v ${PWD}/kaniko-config.json:/kaniko/.docker/config.json:ro gcr.io/kaniko-project/executor:latest --dockerfile=Dockerfile --destination=${ARTIFACTORY_DOCKER_REGISTRY}/artifactory-kaniko-example:latest --image-name-with-digest-file=image-file - ''' - } - } - } - } - - stage ('Run create Docker build') { - steps { - rtCreateDockerBuild ( - serverId: SERVER_ID, - sourceRepo: ARTIFACTORY_DOCKER_REPO, - kanikoImageFile: "jenkins-examples/pipeline-examples/resources/kaniko/image-file" - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: SERVER_ID - ) - } - } - } - - post { - always { - sh 'rm jenkins-examples/pipeline-examples/resources/kaniko/kaniko-config.json' - } - } -} diff --git a/jenkins-examples/pipeline-examples/declarative-examples/kaniko-example/README.md b/jenkins-examples/pipeline-examples/declarative-examples/kaniko-example/README.md deleted file mode 100644 index 1a81557f93..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/kaniko-example/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Kaniko Example - -## Prerequisites - -* Make sure to have the following job parameters configured: - * `SERVER_ID` - JFrog instance ID, defined in Jenkins --> Manage Jenkins --> Configure System - * `CREDENTIALS` - Credentials parameter type with username and password - * `ARTIFACTORY_DOCKER_REPO` - Artifactory virtual or remote docker repository (i.e. docker-virtual) - * `ARTIFACTORY_DOCKER_REGISTRY` - Artifactory docker registry (i.e. acme-docker-virtual.jfrog.io) \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/maven-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/maven-example/Jenkinsfile deleted file mode 100644 index 98cfd3cbed..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/maven-example/Jenkinsfile +++ /dev/null @@ -1,54 +0,0 @@ -pipeline { - agent any - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Artifactory configuration') { - steps { - rtServer ( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - - rtMavenDeployer ( - id: "MAVEN_DEPLOYER", - serverId: "ARTIFACTORY_SERVER", - releaseRepo: ARTIFACTORY_LOCAL_RELEASE_REPO, - snapshotRepo: ARTIFACTORY_LOCAL_SNAPSHOT_REPO - ) - - rtMavenResolver ( - id: "MAVEN_RESOLVER", - serverId: "ARTIFACTORY_SERVER", - releaseRepo: ARTIFACTORY_VIRTUAL_RELEASE_REPO, - snapshotRepo: ARTIFACTORY_VIRTUAL_SNAPSHOT_REPO - ) - } - } - - stage ('Exec Maven') { - steps { - rtMavenRun ( - tool: MAVEN_TOOL, // Tool name from Jenkins configuration - pom: 'maven-examples/maven-example/pom.xml', - goals: 'clean install', - deployerId: "MAVEN_DEPLOYER", - resolverId: "MAVEN_RESOLVER" - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: "ARTIFACTORY_SERVER" - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/maven-jib-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/maven-jib-example/Jenkinsfile deleted file mode 100755 index ed0626acb2..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/maven-jib-example/Jenkinsfile +++ /dev/null @@ -1,60 +0,0 @@ -pipeline { - agent any - stages { - stage ('Clone') { - steps { - git url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Artifactory configuration') { - steps { - rtMavenDeployer ( - id: "MAVEN_DEPLOYER", - serverId: SERVER_ID, - releaseRepo: ARTIFACTORY_LOCAL_RELEASE_REPO, - snapshotRepo: ARTIFACTORY_LOCAL_SNAPSHOT_REPO - ) - - rtMavenResolver ( - id: "MAVEN_RESOLVER", - serverId: SERVER_ID, - releaseRepo: ARTIFACTORY_VIRTUAL_RELEASE_REPO, - snapshotRepo: ARTIFACTORY_VIRTUAL_SNAPSHOT_REPO - ) - } - } - - stage ('Exec Maven') { - steps { - withCredentials([usernamePassword(credentialsId: CREDENTIALS, usernameVariable: 'ARTIFACTORY_USERNAME', passwordVariable: 'ARTIFACTORY_PASSWORD')]) { - rtMavenRun ( - tool: MAVEN_TOOL, // Tool name from Jenkins configuration - pom: 'maven-examples/maven-jib-example/pom.xml', - goals: 'clean install jib:build -B', - deployerId: "MAVEN_DEPLOYER", - resolverId: "MAVEN_RESOLVER" - ) - } - } - } - - stage ('Run create Docker build') { - steps { - rtCreateDockerBuild( - serverId: SERVER_ID, - sourceRepo: "${env.JENKINS_ARTIFACTORY_DOCKER_PUSH_REPO}", - jibImageFiles: "maven-examples/maven-jib-example/*/target/jib-image.json" - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: SERVER_ID - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/maven-jib-example/README.md b/jenkins-examples/pipeline-examples/declarative-examples/maven-jib-example/README.md deleted file mode 100644 index d8b2037073..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/maven-jib-example/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Maven JIB Example - -## Prerequisites - -* Make sure to have the following job parameters configured: - * `SERVER_ID` - JFrog instance ID, defined in Jenkins --> Manage Jenkins --> Configure System - * `CREDENTIALS` - Credentials parameter type with username and password - * `ARTIFACTORY_LOCAL_RELEASE_REPO` - Artifactory local releases repository for deployment (i.e. libs-release-local) - * `ARTIFACTORY_LOCAL_SNAPSHOT_REPO` - Artifactory local snapshots repository for deployment (i.e. - libs-snapshot-local) - * `ARTIFACTORY_VIRTUAL_RELEASE_REPO` - Artifactory virtual releases repository for resolution (i.e. libs-release) - * `ARTIFACTORY_VIRTUAL_SNAPSHOT_REPO` - Artifactory virtual snapshots repository for resolution (i.e libs-snapshot) - * `ARTIFACTORY_DOCKER_REPO` - Artifactory virtual or remote docker repository (i.e. docker-virtual) - * `ARTIFACTORY_DOCKER_REGISTRY` - Artifactory docker registry (i.e. acme-docker-virtual.jfrog.io) \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/npm-container-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/npm-container-example/Jenkinsfile deleted file mode 100644 index e4a88b26ca..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/npm-container-example/Jenkinsfile +++ /dev/null @@ -1,66 +0,0 @@ -pipeline { - /** - * In this example, the agent's Dockerfile is within the repository. - * Therefore, you must use this example only in "Multibranch Pipeline" or a "Pipeline from SCM". - * More information here: https://jenkins.io/doc/book/pipeline/syntax/#agent under "dockerfile". - */ - agent { - dockerfile { - dir 'jenkins-examples/pipeline-examples/resources/npm' - } - } - - environment { - npm_config_cache = 'npm-cache' - } - - stages { - stage('Artifactory configuration') { - steps { - rtServer( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - - rtNpmResolver( - id: "NPM_RESOLVER", - serverId: "ARTIFACTORY_SERVER", - repo: "npm-remote" - ) - - rtNpmDeployer( - id: "NPM_DEPLOYER", - serverId: "ARTIFACTORY_SERVER", - repo: "npm-local" - ) - } - } - - stage('Exec npm install') { - steps { - rtNpmInstall( - path: "npm-example", - resolverId: "NPM_RESOLVER" - ) - } - } - - stage('Exec npm publish') { - steps { - rtNpmPublish( - path: "npm-example", - deployerId: "NPM_DEPLOYER" - ) - } - } - - stage('Publish build info') { - steps { - rtPublishBuildInfo( - serverId: "ARTIFACTORY_SERVER" - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/npm-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/npm-example/Jenkinsfile deleted file mode 100644 index 6c83b49908..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/npm-example/Jenkinsfile +++ /dev/null @@ -1,61 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Artifactory configuration') { - steps { - rtServer ( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - - rtNpmResolver ( - id: "NPM_RESOLVER", - serverId: "ARTIFACTORY_SERVER", - repo: "npm-remote" - ) - - rtNpmDeployer ( - id: "NPM_DEPLOYER", - serverId: "ARTIFACTORY_SERVER", - repo: "npm-local" - ) - } - } - - stage ('Exec npm install') { - steps { - rtNpmInstall ( - tool: NPM_TOOL, // Tool name from Jenkins configuration - path: "npm-example", - resolverId: "NPM_RESOLVER" - ) - } - } - - stage ('Exec npm publish') { - steps { - rtNpmPublish ( - tool: NPM_TOOL, // Tool name from Jenkins configuration - path: "npm-example", - deployerId: "NPM_DEPLOYER" - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: "ARTIFACTORY_SERVER" - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/nuget-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/nuget-example/Jenkinsfile deleted file mode 100644 index 0e84830ec2..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/nuget-example/Jenkinsfile +++ /dev/null @@ -1,44 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/autofac/Examples.git" - } - } - - stage ('Artifactory configuration') { - steps { - rtServer ( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - - rtNugetResolver ( - id: "NUGET_RESOLVER", - serverId: "ARTIFACTORY_SERVER", - repo: "nuget-remote" - ) - } - } - - stage ('Exec NuGet restore') { - steps { - rtNugetRun ( - resolverId: "NUGET_RESOLVER", - args: "restore ./Examples.sln" - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: "ARTIFACTORY_SERVER" - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/pip-examples/README.md b/jenkins-examples/pipeline-examples/declarative-examples/pip-examples/README.md deleted file mode 100644 index d207404537..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/pip-examples/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Jenkins Declarative Pipeline Examples for Pip Build - -## About the Examples - -### pip-example -This example allows running the pip-install command inside a pip virtual-environment. -Provide the virtual-environment activation command in *'virtual_env_activation'*. -If you do not wish the pip-install execution to activate a virtual-environment for you, don't use the *'envActivation'* argument in *'rtPip.install'* execution. - -### pip-environment-example -This example demonstrates how to build your Python project without providing an activation command for the pip virtual-environment. -Instead, add the virtual-environment to the execution *PATH*. - -## Python Package and Create Distribution Archives Stage -This part, in both of the examples, executes after the pip-install has completed, and doesn't involve Artifactory. -This example uses 'wheel' and 'setuptools' tools in this step, you can use any other packaging tool instead. - -Refer to [Pip install with JFrog CLI example](https://github.com/jfrog/project-examples/tree/master/python-example) for information about setting the build environment. diff --git a/jenkins-examples/pipeline-examples/declarative-examples/pip-examples/pip-environment-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/pip-examples/pip-environment-example/Jenkinsfile deleted file mode 100644 index a452884869..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/pip-examples/pip-environment-example/Jenkinsfile +++ /dev/null @@ -1,72 +0,0 @@ -pipeline { - agent any - environment { - PATH = "/Users/myUser/venv-example/bin:$PATH" // Add pip virtual-environment's path to PATH - } - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Configuration') { - steps { - rtServer ( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - - rtPipResolver ( - id: "PIP_RESOLVER", - serverId: "ARTIFACTORY_SERVER", - repo: "pypi-virtual" - ) - } - } - - stage ('Pip install') { - steps { - rtPipInstall ( - resolverId: "PIP_RESOLVER" - args: "-r python-example/pip-example/requirements.txt" - ) - } - } - - stage ('Package and create distribution archives') { - steps { - sh ''' - cd python-example - python setup.py sdist bdist_wheel - ''' - } - } - - stage ('Upload packages') { - steps { - rtUpload ( - serverId: "ARTIFACTORY_SERVER", - spec: '''{ - "files": [ - { - "pattern": "python-example/dist/", - "target": "pypi-virtual/" - } - ] - }''' - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: "ARTIFACTORY_SERVER" - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/pip-examples/pip-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/pip-examples/pip-example/Jenkinsfile deleted file mode 100644 index 67a77d302f..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/pip-examples/pip-example/Jenkinsfile +++ /dev/null @@ -1,73 +0,0 @@ -def virtual_env_activation = "source /Users/myUser/venv-example/bin/activate" // pip virtual-environment activation command - -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Configuration') { - steps { - rtServer ( - id: "ARTIFACTORY_SERVER", - url: SERVER_URL, - credentialsId: CREDENTIALS - ) - - rtPipResolver ( - id: "PIP_RESOLVER", - serverId: "ARTIFACTORY_SERVER", - repo: "pypi-virtual" - ) - } - } - - stage ('Pip install') { - steps { - rtPipInstall ( - resolverId: "PIP_RESOLVER", - args: "-r python-example/pip-example/requirements.txt", - envActivation: virtual_env_activation - ) - } - } - - stage ('Package and create distribution archives') { - steps { - sh ''' - $virtual_env_activation - cd python-example - python setup.py sdist bdist_wheel - ''' - } - } - - stage ('Upload packages') { - steps { - rtUpload ( - serverId: "ARTIFACTORY_SERVER", - spec: '''{ - "files": [ - { - "pattern": "python-example/dist/", - "target": "pypi-virtual/" - } - ] - }''' - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: "ARTIFACTORY_SERVER" - ) - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/declarative-examples/promotion-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/promotion-example/Jenkinsfile deleted file mode 100755 index 9e1788bd44..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/promotion-example/Jenkinsfile +++ /dev/null @@ -1,64 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Upload') { - steps { - rtUpload ( - buildName: 'MK', - buildNumber: '48', - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - serverId: SERVER_ID, - specPath: 'jenkins-examples/pipeline-examples/resources/props-upload.json' - ) - } - } - - stage ('Download') { - steps { - rtDownload ( - buildName: 'MK', - buildNumber: '48', - serverId: SERVER_ID, - specPath: 'jenkins-examples/pipeline-examples/resources/props-download.json' - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - buildName: 'MK', - buildNumber: '48', - serverId: SERVER_ID - ) - } - } - - stage ('Promotion') { - steps { - rtPromote ( - //Mandatory parameter - serverId: SERVER_ID, - targetRepo: ARTIFACTORY_LOCAL_RELEASE_REPO, - - //Optional parameters - buildName: 'MK', - buildNumber: '48', - comment: 'this is the promotion comment', - sourceRepo: ARTIFACTORY_LOCAL_SNAPSHOT_REPO, - status: 'Released', - includeDependencies: true, - failFast: true, - copy: true - ) - } - } - } -} diff --git a/jenkins-examples/pipeline-examples/declarative-examples/props-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/props-example/Jenkinsfile deleted file mode 100755 index 0e70e1fb25..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/props-example/Jenkinsfile +++ /dev/null @@ -1,60 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Upload') { - steps { - rtUpload ( - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - serverId: SERVER_ID, - specPath: 'jenkins-examples/pipeline-examples/resources/props-upload.json' - ) - } - } - - stage ('Set Props') { - steps { - rtSetProps ( - serverId: SERVER_ID, - specPath: 'jenkins-examples/pipeline-examples/resources/set-props.json', - props: "p3=v3", - failNoOp: true - ) - } - } - - stage ('Download') { - steps { - rtDownload ( - serverId: SERVER_ID, - specPath: 'jenkins-examples/pipeline-examples/resources/props-download.json' - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: SERVER_ID - ) - } - } - - stage ('Delete Props') { - steps { - rtDeleteProps ( - serverId: SERVER_ID, - specPath: 'jenkins-examples/pipeline-examples/resources/delete-props.json', - props: "p1,p2", - failNoOp: true - ) - } - } - } -} diff --git a/jenkins-examples/pipeline-examples/declarative-examples/props-single-file-example/Jenkinsfile b/jenkins-examples/pipeline-examples/declarative-examples/props-single-file-example/Jenkinsfile deleted file mode 100755 index 2a45936773..0000000000 --- a/jenkins-examples/pipeline-examples/declarative-examples/props-single-file-example/Jenkinsfile +++ /dev/null @@ -1,94 +0,0 @@ -pipeline { - agent any - - stages { - stage ('Clone') { - steps { - git branch: 'master', url: "https://github.com/jfrog/project-examples.git" - } - } - - stage ('Upload') { - steps { - rtUpload ( - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - serverId: SERVER_ID, - spec: """{ - "files": [ - { - "pattern": "jenkins-examples/pipeline-examples/resources/ArtifactoryPipeline.zip", - "target": "libs-snapshot-local", - "props": "p1=v1;p2=v2" - }, - { - "pattern": "jenkins-examples/pipeline-examples/resources/ArtifactoryPipelineNoProps.zip", - "target": "libs-snapshot-local" - } - ] - }""" - ) - } - } - - stage ('Set Props') { - steps { - rtSetProps ( - serverId: SERVER_ID, - spec: """{ - "files": [ - { - "pattern": "libs-snapshot-local/*(Pipeline).zip", - "props": "p1=v1;p2=v2" - } - ] - }""", - props: "p3=v3", - failNoOp: true - ) - } - } - - stage ('Download') { - steps { - rtDownload ( - serverId: SERVER_ID, - spec: """{ - "files": [ - { - "pattern": "libs-snapshot-local/*(Pipeline).zip", - "target": "Bazinga/{1}/", - "props": "p1=v1;p2=v2" - } - ] - }""" - ) - } - } - - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: SERVER_ID - ) - } - } - - stage ('Delete Props') { - steps { - rtDeleteProps ( - serverId: SERVER_ID, - spec: """{ - "files": [ - { - "pattern": "libs-snapshot-local/*(Pipeline).zip", - "props": "p3=v3" - } - ] - }""", - props: "p1,p2", - failNoOp: true - ) - } - } - } -} diff --git a/jenkins-examples/pipeline-examples/resources/ArtifactoryPipeline.zip b/jenkins-examples/pipeline-examples/resources/ArtifactoryPipeline.zip deleted file mode 100755 index 15cb0ecb3e..0000000000 Binary files a/jenkins-examples/pipeline-examples/resources/ArtifactoryPipeline.zip and /dev/null differ diff --git a/jenkins-examples/pipeline-examples/resources/ArtifactoryPipelineNoProps.zip b/jenkins-examples/pipeline-examples/resources/ArtifactoryPipelineNoProps.zip deleted file mode 100755 index 15cb0ecb3e..0000000000 Binary files a/jenkins-examples/pipeline-examples/resources/ArtifactoryPipelineNoProps.zip and /dev/null differ diff --git a/jenkins-examples/pipeline-examples/resources/Dockerfile b/jenkins-examples/pipeline-examples/resources/Dockerfile deleted file mode 100644 index 803cf7508c..0000000000 --- a/jenkins-examples/pipeline-examples/resources/Dockerfile +++ /dev/null @@ -1 +0,0 @@ -FROM hello-world:latest diff --git a/jenkins-examples/pipeline-examples/resources/aql-download.json b/jenkins-examples/pipeline-examples/resources/aql-download.json deleted file mode 100755 index 8135b45788..0000000000 --- a/jenkins-examples/pipeline-examples/resources/aql-download.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "files": [ - { - "aql": { - "items.find": { - "repo": "libs-snapshot-local", - "$or": [ - { - "$and": [ - { - "path": { - "$match": "." - }, - "name": { - "$match": "​*Pipeline.zip" - } - } - ] - }, - { - "$and": [ - { - "path": { - "$match": "*​" - }, - "name": { - "$match": "*Pipeline.zip" - } - } - ] - } - ] - } - }, - "target": "Bazinga/Artifactory/" - } - ] -} diff --git a/jenkins-examples/pipeline-examples/resources/delete-props.json b/jenkins-examples/pipeline-examples/resources/delete-props.json deleted file mode 100644 index ecdee535c9..0000000000 --- a/jenkins-examples/pipeline-examples/resources/delete-props.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "files": [ - { - "pattern": "libs-snapshot-local/*(Pipeline).zip", - "props": "p3=v3" - } - ] -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/resources/exclude-download.json b/jenkins-examples/pipeline-examples/resources/exclude-download.json deleted file mode 100644 index bd1da52156..0000000000 --- a/jenkins-examples/pipeline-examples/resources/exclude-download.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "files": [ - { - "pattern": "libs-snapshot-local", - "target": "Bazinga/", - "exclusions": ["*ArtifactoryPipeline.zip"] - } - ] -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/resources/exclude-upload.json b/jenkins-examples/pipeline-examples/resources/exclude-upload.json deleted file mode 100644 index 71699d239f..0000000000 --- a/jenkins-examples/pipeline-examples/resources/exclude-upload.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "files": [ - { - "pattern": "jenkins-examples/pipeline-examples/resources/", - "target": "libs-snapshot-local", - "regexp": "true", - "exclusions": [".*.zip", "jenkins-examples/pipeline-examples/resources/props.*"] - } - ] -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/resources/kaniko/Dockerfile b/jenkins-examples/pipeline-examples/resources/kaniko/Dockerfile deleted file mode 100644 index cc284a91ca..0000000000 --- a/jenkins-examples/pipeline-examples/resources/kaniko/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM alpine -RUN echo "created from standard input" \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/resources/kaniko/kaniko-config-template.json b/jenkins-examples/pipeline-examples/resources/kaniko/kaniko-config-template.json deleted file mode 100644 index 88e51968b1..0000000000 --- a/jenkins-examples/pipeline-examples/resources/kaniko/kaniko-config-template.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "\"auths\"": { - "\"$ARTIFACTORY_DOCKER_REGISTRY\"": { - "\"username\"": "\"$ARTIFACTORY_USER\"", - "\"password\"": "\"$ARTIFACTORY_PASSWORD\"" - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/resources/npm/Dockerfile b/jenkins-examples/pipeline-examples/resources/npm/Dockerfile deleted file mode 100644 index e21f1e40e5..0000000000 --- a/jenkins-examples/pipeline-examples/resources/npm/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM openjdk:latest -RUN curl -sL https://rpm.nodesource.com/setup_12.x | bash - \ - && yum install -y nodejs diff --git a/jenkins-examples/pipeline-examples/resources/props-download.json b/jenkins-examples/pipeline-examples/resources/props-download.json deleted file mode 100755 index eead2385e6..0000000000 --- a/jenkins-examples/pipeline-examples/resources/props-download.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "files": [ - { - "pattern": "libs-snapshot-local/*(Pipeline).zip", - "target": "Bazinga/{1}/", - "props": "p1=v1;p2=v2" - } - ] -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/resources/props-upload.json b/jenkins-examples/pipeline-examples/resources/props-upload.json deleted file mode 100755 index 8d41cfe806..0000000000 --- a/jenkins-examples/pipeline-examples/resources/props-upload.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "files": [ - { - "pattern": "jenkins-examples/pipeline-examples/resources/ArtifactoryPipeline.zip", - "target": "libs-snapshot-local", - "props": "p1=v1;p2=v2" - }, - { - "pattern": "jenkins-examples/pipeline-examples/resources/ArtifactoryPipelineNoProps.zip", - "target": "libs-snapshot-local" - } - ] -} diff --git a/jenkins-examples/pipeline-examples/resources/recursive-flat-upload.json b/jenkins-examples/pipeline-examples/resources/recursive-flat-upload.json deleted file mode 100755 index 99071013f4..0000000000 --- a/jenkins-examples/pipeline-examples/resources/recursive-flat-upload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "files": [ - { - "pattern": "jenkins-examples/pipeline-examples/resources/*Artifactory*.zip", - "target": "libs-snapshot-local/", - "recursive": "false" - }, - { - "pattern": "jenkins-examples/pipeline-examples/resources/*ArtifactoryPipelineNoFlat.zip", - "target": "libs-snapshot-local", - "flat" :"false" - } - ] -} diff --git a/jenkins-examples/pipeline-examples/resources/recursiveArtifacts/InnerArtifactoryPipeline.zip b/jenkins-examples/pipeline-examples/resources/recursiveArtifacts/InnerArtifactoryPipeline.zip deleted file mode 100755 index 15cb0ecb3e..0000000000 Binary files a/jenkins-examples/pipeline-examples/resources/recursiveArtifacts/InnerArtifactoryPipeline.zip and /dev/null differ diff --git a/jenkins-examples/pipeline-examples/resources/recursiveArtifacts/InnerArtifactoryPipelineNoFlat.zip b/jenkins-examples/pipeline-examples/resources/recursiveArtifacts/InnerArtifactoryPipelineNoFlat.zip deleted file mode 100755 index 15cb0ecb3e..0000000000 Binary files a/jenkins-examples/pipeline-examples/resources/recursiveArtifacts/InnerArtifactoryPipelineNoFlat.zip and /dev/null differ diff --git a/jenkins-examples/pipeline-examples/resources/set-props.json b/jenkins-examples/pipeline-examples/resources/set-props.json deleted file mode 100644 index 7882f613d2..0000000000 --- a/jenkins-examples/pipeline-examples/resources/set-props.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "files": [ - { - "pattern": "libs-snapshot-local/*(Pipeline).zip", - "props": "p1=v1;p2=v2" - } - ] -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/README.md b/jenkins-examples/pipeline-examples/scripted-examples/README.md deleted file mode 100644 index b6f931890e..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# Scripted pipeline examples. - -The examples here are meant to help you get started working with Artifactory in your Jenkins pipeline scripts. -To set up Jenkins to use the example, read [this](https://github.com/jfrog/project-examples/tree/master/jenkins-examples/pipeline-examples) page. - -* The [aql-example](aql-example) uses a Download Spec which includes [AQL](https://www.jfrog.com/confluence/display/RTF/Artifactory+Query+Language) instead of a wildcard pattern. -* The [build-scan-example](build-scan-example) demonstrates how to scan published builds with JFrog Xray. -* The [build-trigger-example](build-trigger-example) demonstrates how to trigger a build when files are added or modified in a specific Artifactory path. -* The [conan-example](conan-example) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a Conan build. -* The [declarative-example](declarative-example) demonstrates how to download, upload and publish build-info to Artifactory using a Declarative Pipeline script. -* The [docker-push-example](docker-push-example) demonstrates how to push a docker image to Artifactory. -* The [docker-pull-example](docker-pull-example) demonstrates how to pull a docker image from Artifactory. -* The [dotnet-example](dotnet-example) resolves dependencies and publishes build-info to Artifactory for a .NET build. -* The [exclude-patterns-download-example](exclude-patterns-download-example) demonstrates how to exclude certain files while downloading. -* The [exclude-patterns-upload-example](exclude-patterns-upload-example) demonstrates how to exclude certain files while uploading. -* The [go-example](go-example) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a Go build. -* The [gradle-container-example](gradle-container-example) demonstrates how to run Gradle in a Docker container. -* The [gradle-deploy-example](gradle-deploy-example) demonstrates how to defer the build artifacts deployment to a separate stage. -* The [gradle-example-ci-server](gradle-example-ci-server) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a Gradle build. Unlike the [gradle-example](gradle-example), this examples assumes that the Gradle Artifactory Plugin in not applied to the Gradle build script. -* The [gradle-example](gradle-example) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a Gradle build. Unlike the [gradle-example-ci-server](gradle-example-ci-server), this examples assumes that the Gradle Artifactory Plugin in already applied in the Gradle build script. -* The [issues-collection-example](issues-collection-example) demonstrates how to collect the list of tracked project issues and add them to the build-info. -* The [jfrog-distribution-example](jfrog-distribution-example) demonstrates how to create, update, sign, distribute, and delete a release bundle. -* The [kaniko-example](kaniko-example) demonstrate how to collect build info for Docker images created by Kaniko. -* The [maven-container-example](maven-container-example) demonstrates how to run Maven in a Docker container. -* The [maven-deploy-example](maven-deploy-example) demonstrates how to defer the build artifacts deployment to a separate stage. -* The [maven-example](maven-example) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a Maven build. -* The [maven-jib-example](maven-example) demonstrates how to collect and publish build-info for a Maven JIB build. -* The [npm-container-example](npm-container-example) demonstrates how to run npm in a Docker container. -* The [npm-example](npm-example) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a npm build. -* The [nuget-example](nuget-example) resolves dependencies and publishes build-info to Artifactory for a NuGet build. -* The [pip-examples](pip-examples) resolves dependencies, deploys artifacts and publishes build-info to Artifactory for a pip build. -* The [promotion-example](promotion-example) demonstrates how to promote a build in Artifactory. -* The [props-example](props-example) demonstrates setting/deleting properties on artifacts in Artifactory. Also downloads and uploads files to Artifactory with properties, while using a placeholder when downloading. -* The [props-single-file-example](props-single-file-example) is the same as the [props-example](props-example), but has the specs embedded inside the Groovy script. -* The [vars-build-retention-example](vars-build-retention-example) demonstrates capturing environment variables and build retention in Artifactory. diff --git a/jenkins-examples/pipeline-examples/scripted-examples/aql-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/aql-example/Jenkinsfile deleted file mode 100755 index ef0037c88f..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/aql-example/Jenkinsfile +++ /dev/null @@ -1,23 +0,0 @@ -node { - git url: 'https://github.com/jfrog/project-examples.git' - - // Get Artifactory server instance, defined in the Artifactory Plugin administration page. - def server = Artifactory.server SERVER_ID - - def buildInfo = Artifactory.newBuildInfo() - // Set custom build name and number. - buildInfo.setName 'holyFrog' - buildInfo.setNumber '42' - - // Read the upload spec which was downloaded from github. - def uploadSpec = readFile 'jenkins-examples/pipeline-examples/resources/recursive-flat-upload.json' - // Upload to Artifactory. - server.upload spec: uploadSpec, buildInfo: buildInfo - - // The download file contains pattern for downloading artifacts to the root directory by setting recursive=false - def downloadSpec = readFile 'jenkins-examples/pipeline-examples/resources/aql-download.json' - server.download spec: downloadSpec, buildInfo: buildInfo - - // Publish build info. - server.publishBuildInfo buildInfo -} diff --git a/jenkins-examples/pipeline-examples/scripted-examples/build-scan-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/build-scan-example/Jenkinsfile deleted file mode 100644 index 56fb6c8768..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/build-scan-example/Jenkinsfile +++ /dev/null @@ -1,39 +0,0 @@ -node { - def server - def rtMaven - def buildInfo - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - server = Artifactory.server SERVER_ID - - rtMaven = Artifactory.newMavenBuild() - // Tool name from Jenkins configuration - rtMaven.tool = MAVEN_TOOL - rtMaven.deployer releaseRepo: ARTIFACTORY_LOCAL_RELEASE_REPO, snapshotRepo: ARTIFACTORY_LOCAL_SNAPSHOT_REPO, server: server - rtMaven.resolver releaseRepo: ARTIFACTORY_VIRTUAL_RELEASE_REPO, snapshotRepo: ARTIFACTORY_VIRTUAL_SNAPSHOT_REPO, server: server - buildInfo = Artifactory.newBuildInfo() - } - - stage ('Exec Maven') { - rtMaven.run pom: 'maven-examples/maven-example/pom.xml', goals: 'clean install', buildInfo: buildInfo - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } - - stage ('Xray scan') { - def scanConfig = [ - 'buildName' : buildInfo.name, - 'buildNumber' : buildInfo.number, - 'failBuild' : true - ] - def scanResult = server.xrayScan scanConfig - echo scanResult as String - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/build-trigger-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/build-trigger-example/Jenkinsfile deleted file mode 100644 index 1c3071d4f7..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/build-trigger-example/Jenkinsfile +++ /dev/null @@ -1,16 +0,0 @@ -node { - // The URL of the artifact in Artifactory, that caused the job to be triggered. - // May be empty if the build isn't triggered by a change in Artifactory. - def rtTriggerUrl = currentBuild.getBuildCauses('org.jfrog.hudson.trigger.ArtifactoryCause')[0]?.url - - def server - - stage ('Artifactory configuration') { - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - server = Artifactory.server SERVER_ID - } - - stage('Trigger build') { - server.setBuildTrigger spec: "*/10 * * * *", paths: "generic-libs-local/builds/starship" - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/conan-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/conan-example/Jenkinsfile deleted file mode 100755 index d26f6cfb5e..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/conan-example/Jenkinsfile +++ /dev/null @@ -1,31 +0,0 @@ - node { - // Clone the code from github: - git url :'https://github.com/memsharded/example-poco-timer.git' - - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - def server = Artifactory.server SERVER_ID - - // Create a local build-info instance: - def buildInfo = Artifactory.newBuildInfo() - buildInfo.name = "Conan-pipeline" - - // Create a conan client instance: - def conanClient = Artifactory.newConanClient() - - // Add a new repository named 'conan-local' to the conan client. - // The 'remote.add' method returns a 'serverName' string, which is used later in the script: - String serverName = conanClient.remote.add server: server, repo: "conan-local" - - // Run a conan build. The 'buildInfo' instance is passed as an argument to the 'run' method: - conanClient.run(command: "install . --build missing", buildInfo: buildInfo) - - // Create an upload command. The 'serverName' string is used as a conan 'remote', so that - // the artifacts are uploaded into it: - String command = "upload * --all -r ${serverName} --confirm" - - // Run the upload command, with the same build-info instance as an argument: - conanClient.run(command: command, buildInfo: buildInfo) - - // Publish the build-info to Artifactory: - server.publishBuildInfo buildInfo -} diff --git a/jenkins-examples/pipeline-examples/scripted-examples/declarative-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/declarative-example/Jenkinsfile deleted file mode 100644 index cb4163feda..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/declarative-example/Jenkinsfile +++ /dev/null @@ -1,34 +0,0 @@ -pipeline { - agent any - stages { - stage('Clone'){ - steps { - git url: 'https://github.com/jfrog/project-examples.git' - } - } - - stage('Artifactory download and upload'){ - steps { - script{ - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - def server = Artifactory.server SERVER_ID - - // Read the download and upload specs: - def downloadSpec = readFile 'jenkins-examples/pipeline-examples/resources/props-download.json' - def uploadSpec = readFile 'jenkins-examples/pipeline-examples/resources/props-upload.json' - - // Download files from Artifactory: - def buildInfo1 = server.download spec: downloadSpec - // Upload files to Artifactory: - def buildInfo2 = server.upload spec: uploadSpec - - // Merge the local download and upload build-info instances: - buildInfo1.append buildInfo2 - - // Publish the merged build-info to Artifactory - server.publishBuildInfo buildInfo1 - } - } - } - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/docker-pull-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/docker-pull-example/Jenkinsfile deleted file mode 100644 index 5106360051..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/docker-pull-example/Jenkinsfile +++ /dev/null @@ -1,23 +0,0 @@ -node { - def server - def rtDocker - def buildInfo - - stage ('Artifactory configuration') { - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - server = Artifactory.server SERVER_ID - // Host: - // On OSX: "tcp://127.0.0.1:1234" - // On Linux can be omitted or null - rtDocker = Artifactory.docker server: server, host: HOST_NAME - buildInfo = Artifactory.newBuildInfo() - } - - stage ('Pull an image from Artifactory') { - rtDocker.pull ARTIFACTORY_DOCKER_REGISTRY + '/hello-world:latest', 'docker-remote', buildInfo - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/docker-push-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/docker-push-example/Jenkinsfile deleted file mode 100644 index 9decf0e2e5..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/docker-push-example/Jenkinsfile +++ /dev/null @@ -1,36 +0,0 @@ -node { - def server - def rtDocker - def buildInfo - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - server = Artifactory.server SERVER_ID - // Host: - // On OSX: "tcp://127.0.0.1:1234" - // On Linux can be omitted or null - rtDocker = Artifactory.docker server: server, host: HOST_NAME - buildInfo = Artifactory.newBuildInfo() - } - - stage ('Add properties') { - // Attach custom properties to the published artifacts: - rtDocker.addProperty("project-name", "docker1").addProperty("status", "stable") - } - - stage ('Build docker image') { - docker.build(ARTIFACTORY_DOCKER_REGISTRY + '/hello-world:latest', 'jenkins-examples/pipeline-examples/resources') - } - - stage ('Push image to Artifactory') { - rtDocker.push ARTIFACTORY_DOCKER_REGISTRY + '/hello-world:latest', 'docker-local', buildInfo - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/dotnet-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/dotnet-example/Jenkinsfile deleted file mode 100644 index f90296fefa..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/dotnet-example/Jenkinsfile +++ /dev/null @@ -1,22 +0,0 @@ -node { - def server = Artifactory.server SERVER_ID - def rtDotnet = Artifactory.newDotnetBuild() - def buildInfo - - stage ('Clone') { - git url: 'https://github.com/graphql-dotnet/graphql-dotnet.git' - } - - stage ('Artifactory configuration') { - rtDotnet.resolver repo: 'nuget-remote', server: server - buildInfo = Artifactory.newBuildInfo() - } - - stage ('.NET restore') { - rtDotnet.run buildInfo: buildInfo, args: 'restore ./src/GraphQL.sln' - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/exclude-patterns-download-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/exclude-patterns-download-example/Jenkinsfile deleted file mode 100644 index ef0912d7f4..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/exclude-patterns-download-example/Jenkinsfile +++ /dev/null @@ -1,21 +0,0 @@ -node { - git url: 'https://github.com/jfrog/project-examples.git' - - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - def server = Artifactory.server SERVER_ID - - // Read the upload spec which was downloaded from github. - def uploadSpec = readFile 'jenkins-examples/pipeline-examples/resources/props-upload.json' - // Upload to Artifactory. - def buildInfo1 = server.upload spec: uploadSpec - - // Read the download spec and download files from Artifactory. - def downloadSpec = readFile 'jenkins-examples/pipeline-examples/resources/exclude-download.json' - def buildInfo2 = server.download spec: downloadSpec - - // Merge the upload and download build-info objects. - buildInfo1.append buildInfo2 - - // Publish the build to Artifactory - server.publishBuildInfo buildInfo1 -} diff --git a/jenkins-examples/pipeline-examples/scripted-examples/exclude-patterns-upload-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/exclude-patterns-upload-example/Jenkinsfile deleted file mode 100644 index 27316d889b..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/exclude-patterns-upload-example/Jenkinsfile +++ /dev/null @@ -1,14 +0,0 @@ -node { - git url: 'https://github.com/jfrog/project-examples.git' - - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - def server = Artifactory.server SERVER_ID - - // Read the upload spec which was downloaded from github. - def uploadSpec = readFile 'jenkins-examples/pipeline-examples/resources/exclude-upload.json' - // Upload to Artifactory. - def buildInfo = server.upload spec: uploadSpec - - // Publish the build to Artifactory - server.publishBuildInfo buildInfo -} diff --git a/jenkins-examples/pipeline-examples/scripted-examples/go-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/go-example/Jenkinsfile deleted file mode 100644 index eafdc3e1e3..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/go-example/Jenkinsfile +++ /dev/null @@ -1,27 +0,0 @@ -node { - def server = Artifactory.server SERVER_ID - def rtGo = Artifactory.newGoBuild() - def buildInfo - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - rtGo.deployer repo: 'go-local', server: server - rtGo.resolver repo: 'go', server: server - buildInfo = Artifactory.newBuildInfo() - } - - stage ('Go run') { - rtGo.run buildInfo: buildInfo, path: 'golang-example', args: 'build' - } - - stage ('Go publish') { - rtGo.publish buildInfo: buildInfo, path: 'golang-example', version: '1.0.0' - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/gradle-container-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/gradle-container-example/Jenkinsfile deleted file mode 100644 index e769a5717f..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/gradle-container-example/Jenkinsfile +++ /dev/null @@ -1,29 +0,0 @@ -node { - def server - def rtGradle - def buildInfo = Artifactory.newBuildInfo() - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - server = Artifactory.server SERVER_ID - - rtGradle = Artifactory.newGradleBuild() - rtGradle.tool = CONTAINER_GRADLE_TOOL // Tool name from Jenkins configuration - rtGradle.deployer repo:ARTIFACTORY_LOCAL_RELEASE_REPO, server: server - rtGradle.resolver repo:ARTIFACTORY_VIRTUAL_RELEASE_REPO, server: server - } - - stage ('Exec Gradle') { - docker.image('gradle').inside { - rtGradle.run rootDir: 'gradle-examples/gradle-example-ci-server/', tasks: 'aP', buildInfo: buildInfo - } - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/gradle-container-example/README.md b/jenkins-examples/pipeline-examples/scripted-examples/gradle-container-example/README.md deleted file mode 100644 index 5337c73407..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/gradle-container-example/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Gradle Container Example -## Prerequisites -* Make sure that Java and Gradle installed inside your Docker container. -* In order to use Artifactory integration with Docker containers, Gradle installation path should be set by one of the following: - * Option 1: In Jenkins Manage, configure a new Gradle tool. - * Use `GRADLE_HOME` as configured in the container. In our example use `/opt/gradle`. - * Uncheck `Install automatically`. - * Add the configured Gradle tool name to the pipeline script: - * rtGradle.tool = GRADLE_TOOL - * Option 2: Set `GRADLE_HOME` environment variable as configured in the container. - * withEnv(['GRADLE_HOME=/opt/gradle']) { - rtGradle.run rootDir: "gradle-examples/gradle-example/", tasks: 'clean artifactoryPublish', buildInfo: buildInfo - } diff --git a/jenkins-examples/pipeline-examples/scripted-examples/gradle-deploy-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/gradle-deploy-example/Jenkinsfile deleted file mode 100644 index 3f0a5b7c29..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/gradle-deploy-example/Jenkinsfile +++ /dev/null @@ -1,36 +0,0 @@ -node { - def server - def buildInfo - def rtGradle - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - server = Artifactory.server SERVER_ID - - rtGradle = Artifactory.newGradleBuild() - rtGradle.tool = GRADLE_TOOL // Tool name from Jenkins configuration - rtGradle.deployer repo: ARTIFACTORY_LOCAL_RELEASE_REPO, server: server - rtGradle.resolver repo: ARTIFACTORY_VIRTUAL_RELEASE_REPO, server: server - rtGradle.deployer.deployArtifacts = false // Disable artifacts deployment during Gradle run - - buildInfo = Artifactory.newBuildInfo() - } - - stage ('Test') { - rtGradle.run rootDir: 'gradle-examples/gradle-example-ci-server/', tasks: 'clean test' - } - - stage ('Deploy') { - rtGradle.run rootDir: 'gradle-examples/gradle-example-ci-server/', tasks: 'artifactoryPublish', buildInfo: buildInfo - rtGradle.deployer.deployArtifacts buildInfo - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} - diff --git a/jenkins-examples/pipeline-examples/scripted-examples/gradle-example-ci-server/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/gradle-example-ci-server/Jenkinsfile deleted file mode 100755 index 1b09c9be2e..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/gradle-example-ci-server/Jenkinsfile +++ /dev/null @@ -1,26 +0,0 @@ -node { - def server - def rtGradle = Artifactory.newGradleBuild() - def buildInfo = Artifactory.newBuildInfo() - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - server = Artifactory.server SERVER_ID - - rtGradle.tool = GRADLE_TOOL // Tool name from Jenkins configuration - rtGradle.deployer repo: ARTIFACTORY_LOCAL_RELEASE_REPO, server: server - rtGradle.resolver repo: ARTIFACTORY_VIRTUAL_RELEASE_REPO, server: server - } - - stage ('Exec Gradle') { - rtGradle.run rootDir: "gradle-examples/gradle-example-ci-server/", tasks: 'clean artifactoryPublish', buildInfo: buildInfo - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} diff --git a/jenkins-examples/pipeline-examples/scripted-examples/gradle-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/gradle-example/Jenkinsfile deleted file mode 100755 index fd52e9ad34..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/gradle-example/Jenkinsfile +++ /dev/null @@ -1,43 +0,0 @@ -node { - def server - def rtGradle = Artifactory.newGradleBuild() - def buildInfo = Artifactory.newBuildInfo() - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - server = Artifactory.server SERVER_ID - - rtGradle.tool = GRADLE_TOOL // Tool name from Jenkins configuration - rtGradle.deployer repo: ARTIFACTORY_LOCAL_SNAPSHOT_REPO, server: server - rtGradle.resolver repo: ARTIFACTORY_VIRTUAL_RELEASE_REPO, server: server - } - - withEnv (['DONT_COLLECT=FOO']) { - stage ('Config Build Info') { - buildInfo.env.capture = true - buildInfo.env.filter.addInclude ("*") - buildInfo.env.filter.addExclude ("DONT_COLLECT*") - } - - stage ('Extra gradle configurations') { - rtGradle.deployer.artifactDeploymentPatterns.addExclude ("*.war") - rtGradle.usesPlugin = true // Artifactory plugin already defined in build script - rtGradle.useWrapper = true - } - - stage ('Exec Gradle') { - rtGradle.run rootDir: "gradle-examples/gradle-example-publish/", tasks: 'clean artifactoryPublish', buildInfo: buildInfo - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } - } -} - - - diff --git a/jenkins-examples/pipeline-examples/scripted-examples/interactive-promotion-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/interactive-promotion-example/Jenkinsfile deleted file mode 100755 index 18f101253a..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/interactive-promotion-example/Jenkinsfile +++ /dev/null @@ -1,54 +0,0 @@ -node { - stage 'Build' - git url: 'https://github.com/jfrog/project-examples.git' - - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - def server = Artifactory.server SERVER_ID - - // Create the upload spec. - def uploadSpec = readFile 'jenkins-examples/pipeline-examples/resources/props-upload.json' - - // Upload to Artifactory. - def buildInfo1 = server.upload spec: uploadSpec - - // Publish the build to Artifactory - server.publishBuildInfo buildInfo1 - - // Create the download spec. - def downloadSpec = readFile 'jenkins-examples/pipeline-examples/resources/props-download.json' - - // Download from Artifactory. - def buildInfo2 = server.download spec: downloadSpec - - // Publish the build to Artifactory - server.publishBuildInfo buildInfo2 - - stage 'Promotion' - def promotionConfig1 = [ - //Mandatory parameters - 'buildName' : buildInfo1.name, - 'buildNumber' : buildInfo1.number, - - //Optional parameters - 'targetRepo' : ARTIFACTORY_LOCAL_RELEASE_REPO, - 'comment' : 'this is the promotion comment', - 'sourceRepo' : ARTIFACTORY_LOCAL_SNAPSHOT_REPO, - 'status' : 'Released', - 'includeDependencies': true, - 'failFast' : true, - 'copy' : true - ] - - // Promote build 1 - Artifactory.addInteractivePromotion server: server, promotionConfig: promotionConfig1, displayName: "Promote me please" - - def promotionConfig2 = [ - //Mandatory parameters - 'buildName' : buildInfo2.name, - 'buildNumber' : buildInfo2.number, - 'targetRepo' : ARTIFACTORY_LOCAL_RELEASE_REPO - ] - - // Promote build 2 - Artifactory.addInteractivePromotion server: server, promotionConfig: promotionConfig2 -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/issues-collection-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/issues-collection-example/Jenkinsfile deleted file mode 100644 index 62e4ab1034..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/issues-collection-example/Jenkinsfile +++ /dev/null @@ -1,26 +0,0 @@ -node { - def server - buildInfo = Artifactory.newBuildInfo() - - stage ('Build') { - git url: 'https://github.com/jfrog/jenkins-artifactory-plugin.git' - server = Artifactory.server SERVER_ID - - issuesCollectionConfig = """{ - "version": 1, - "issues": { - "trackerName": "JIRA", - "regexp": "(.+-[0-9]+)\\s-\\s(.+)", - "keyGroupIndex": 1, - "summaryGroupIndex": 2, - "trackerUrl": "http://my-jira.com/issues", - "aggregate": "true", - "aggregationStatus": "RELEASED" - } - }""" - - buildInfo.issues.collect(server, issuesCollectionConfig) - - server.publishBuildInfo buildInfo - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/jfrog-distribution-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/jfrog-distribution-example/Jenkinsfile deleted file mode 100644 index 50b85c918a..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/jfrog-distribution-example/Jenkinsfile +++ /dev/null @@ -1,61 +0,0 @@ -node { - def jfrogInstance = JFrog.instance SERVER_ID - def rtServer = jfrogInstance.artifactory - def dsServer = jfrogInstance.distribution - def releaseBundleName = "example-release-bundle" - def releaseBundleVersion = "1" - def releaseBundleSpec = """{ - "files": [ - { - "pattern": "libs-release-local/ArtifactoryPipeline.zip" - } - ] - }""" - def distributionRules = """{ - "distribution_rules": [ - { - "site_name": "*", - "city_name": "*", - "country_codes": ["*"] - } - ] - }""" - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ("Upload file") { - def uploadSpec = """{ - "files": [ - { - "pattern": "jenkins-examples/pipeline-examples/resources/ArtifactoryPipeline.zip", - "target": "libs-release-local" - } - ] - }""" - rtServer.upload spec: uploadSpec - } - - stage ("Create release bundle") { - dsServer.createReleaseBundle name: releaseBundleName, version: releaseBundleVersion, spec: releaseBundleSpec - } - - stage ("Update release bundle") { - dsServer.updateReleaseBundle name: releaseBundleName, version: releaseBundleVersion, spec: releaseBundleSpec, description: "Update a release bundle" - } - - // Optional - this step can be achieved also by providing "signImmediately: true" to dsUpdateReleaseBundle step - stage ("Sign release bundle") { - dsServer.signReleaseBundle name: releaseBundleName, version: releaseBundleVersion - } - - stage ("Distribute release bundle") { - dsServer.distributeReleaseBundle name: releaseBundleName, version: releaseBundleVersion, distRules: distributionRules, sync: true - } - - stage ("Delete release bundle") { - dsServer.deleteReleaseBundle name: releaseBundleName, version: releaseBundleVersion, distRules: distributionRules, sync: true, deleteFromDist: true - } - -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/kaniko-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/kaniko-example/Jenkinsfile deleted file mode 100644 index 13b9d31db3..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/kaniko-example/Jenkinsfile +++ /dev/null @@ -1,42 +0,0 @@ -node { - def server - def rtDocker - def buildInfo - - cleanWs() - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - // Obtain a JFrog instance, defined in Jenkins --> Manage Jenkins --> Configure System: - def jfrogInstance = JFrog.instance SERVER_ID - rtServer = jfrogInstance.artifactory - - rtDocker = Artifactory.docker server: rtServer - buildInfo = Artifactory.newBuildInfo() - } - - dir ('jenkins-examples/pipeline-examples/resources/kaniko') { - stage ('Exec Kaniko') { - withCredentials([usernamePassword(credentialsId: CREDENTIALS, usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) { - try { - sh ''' - eval "echo \"$( kaniko-config.json - docker run --rm -v ${PWD}:/workspace -v ${PWD}/kaniko-config.json:/kaniko/.docker/config.json:ro gcr.io/kaniko-project/executor:latest --dockerfile=Dockerfile --destination=${ARTIFACTORY_DOCKER_REGISTRY}/artifactory-kaniko-example:latest --image-name-with-digest-file=image-file - ''' - } finally { - sh 'rm kaniko-config.json' - } - } - } - - stage ('Run create Docker build') { - rtDocker.createDockerBuild sourceRepo: ARTIFACTORY_DOCKER_REPO, kanikoImageFile: "image-file", buildInfo: buildInfo - } - } - - stage ('Publish build info') { - rtServer.publishBuildInfo buildInfo - } -} diff --git a/jenkins-examples/pipeline-examples/scripted-examples/kaniko-example/README.md b/jenkins-examples/pipeline-examples/scripted-examples/kaniko-example/README.md deleted file mode 100644 index 1a81557f93..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/kaniko-example/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Kaniko Example - -## Prerequisites - -* Make sure to have the following job parameters configured: - * `SERVER_ID` - JFrog instance ID, defined in Jenkins --> Manage Jenkins --> Configure System - * `CREDENTIALS` - Credentials parameter type with username and password - * `ARTIFACTORY_DOCKER_REPO` - Artifactory virtual or remote docker repository (i.e. docker-virtual) - * `ARTIFACTORY_DOCKER_REGISTRY` - Artifactory docker registry (i.e. acme-docker-virtual.jfrog.io) \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/maven-container-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/maven-container-example/Jenkinsfile deleted file mode 100644 index 6e22449fec..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/maven-container-example/Jenkinsfile +++ /dev/null @@ -1,32 +0,0 @@ -node { - def server - def rtMaven - def buildInfo - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - server = Artifactory.server SERVER_ID - - rtMaven = Artifactory.newMavenBuild() - rtMaven.tool = CONTAINER_MAVEN_TOOL // Tool name from Jenkins configuration - rtMaven.deployer releaseRepo: ARTIFACTORY_LOCAL_RELEASE_REPO, snapshotRepo:ARTIFACTORY_LOCAL_SNAPSHOT_REPO, server: server - rtMaven.resolver releaseRepo: ARTIFACTORY_VIRTUAL_RELEASE_REPO, snapshotRepo:ARTIFACTORY_VIRTUAL_SNAPSHOT_REPO, server: server - buildInfo = Artifactory.newBuildInfo() - } - - stage ('Exec Maven') { - docker.image('maven:3.6.1-jdk-8-slim').inside { - withEnv(['JAVA_HOME=/usr/local/openjdk-8']) { // Java home of the container - rtMaven.run pom: 'maven-examples/maven-example/pom.xml', goals: 'clean install', buildInfo: buildInfo - } - } - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/maven-container-example/README.md b/jenkins-examples/pipeline-examples/scripted-examples/maven-container-example/README.md deleted file mode 100644 index f11ec40e7a..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/maven-container-example/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Maven Container Example -## Prerequisites -* Make sure that Java and Maven installed inside your Docker container. -* In order to use Artifactory integration with Docker containers, Maven and Java installations paths should be set by one of the following: - * Option 1: In Jenkins Manage, configure a new Maven tool. - * Use `MAVEN_HOME` as configured in the container. In our example use `/usr/share/maven`. - * Uncheck `Install automatically`. - * Add the configured Maven tool name to the pipeline script: - * rtMaven.tool = CONTAINER_MAVEN_TOOL - * Add `JAVA_HOME` environment variable to the pipeline script. - * withEnv(['JAVA_HOME=/usr/local/openjdk-8']) { // Java home of the container - rtMaven.run pom: 'maven-examples/maven-example/pom.xml', goals: 'clean install', buildInfo: buildInfo - } - * Option 2: Set `JAVA_HOME` and `MAVEN_HOME` environment variables as configured in the container. - * withEnv(['JAVA_HOME=/usr/local/openjdk-8', 'MAVEN_HOME=/usr/share/maven']) { - rtMaven.run pom: 'maven-examples/maven-example/pom.xml', goals: 'clean install', buildInfo: buildInfo - } \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/maven-deploy-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/maven-deploy-example/Jenkinsfile deleted file mode 100644 index caf9446334..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/maven-deploy-example/Jenkinsfile +++ /dev/null @@ -1,39 +0,0 @@ -node { - def server - def buildInfo - def rtMaven - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - server = Artifactory.server SERVER_ID - - rtMaven = Artifactory.newMavenBuild() - rtMaven.tool = MAVEN_TOOL // Tool name from Jenkins configuration - rtMaven.deployer releaseRepo: ARTIFACTORY_LOCAL_RELEASE_REPO, snapshotRepo: ARTIFACTORY_LOCAL_SNAPSHOT_REPO, server: server - rtMaven.resolver releaseRepo: ARTIFACTORY_VIRTUAL_RELEASE_REPO, snapshotRepo: ARTIFACTORY_VIRTUAL_SNAPSHOT_REPO, server: server - rtMaven.deployer.deployArtifacts = false // Disable artifacts deployment during Maven run - - buildInfo = Artifactory.newBuildInfo() - } - - stage ('Test') { - rtMaven.run pom: 'maven-examples/maven-example/pom.xml', goals: 'clean test' - } - - stage ('Install') { - rtMaven.run pom: 'maven-examples/maven-example/pom.xml', goals: 'install', buildInfo: buildInfo - } - - stage ('Deploy') { - rtMaven.deployer.deployArtifacts buildInfo - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} - diff --git a/jenkins-examples/pipeline-examples/scripted-examples/maven-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/maven-example/Jenkinsfile deleted file mode 100755 index 01a1ccc750..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/maven-example/Jenkinsfile +++ /dev/null @@ -1,28 +0,0 @@ -node { - def server - def rtMaven = Artifactory.newMavenBuild() - def buildInfo - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - server = Artifactory.server SERVER_ID - - // Tool name from Jenkins configuration - rtMaven.tool = MAVEN_TOOL - rtMaven.deployer releaseRepo: ARTIFACTORY_LOCAL_RELEASE_REPO, snapshotRepo: ARTIFACTORY_LOCAL_SNAPSHOT_REPO, server: server - rtMaven.resolver releaseRepo: ARTIFACTORY_VIRTUAL_RELEASE_REPO, snapshotRepo: ARTIFACTORY_VIRTUAL_SNAPSHOT_REPO, server: server - buildInfo = Artifactory.newBuildInfo() - } - - stage ('Exec Maven') { - rtMaven.run pom: 'maven-examples/maven-example/pom.xml', goals: 'clean install', buildInfo: buildInfo - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/maven-jib-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/maven-jib-example/Jenkinsfile deleted file mode 100755 index ee97eb8e54..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/maven-jib-example/Jenkinsfile +++ /dev/null @@ -1,37 +0,0 @@ -node { - def server - def rtMaven = Artifactory.newMavenBuild() - def rtDocker - def buildInfo - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - def jfrogInstance = JFrog.instance SERVER_ID - rtServer = jfrogInstance.artifactory - rtDocker = Artifactory.docker server: rtServer - - // Tool name from Jenkins configuration - rtMaven.tool = MAVEN_TOOL - rtMaven.deployer releaseRepo: ARTIFACTORY_LOCAL_RELEASE_REPO, snapshotRepo: ARTIFACTORY_LOCAL_SNAPSHOT_REPO, server: rtServer - rtMaven.resolver releaseRepo: ARTIFACTORY_VIRTUAL_RELEASE_REPO, snapshotRepo: ARTIFACTORY_VIRTUAL_SNAPSHOT_REPO, server: rtServer - - buildInfo = Artifactory.newBuildInfo() - } - - stage ('Exec Maven') { - withCredentials([usernamePassword(credentialsId: CREDENTIALS, usernameVariable: 'ARTIFACTORY_USERNAME', passwordVariable: 'ARTIFACTORY_PASSWORD')]) { - rtMaven.run pom: 'maven-examples/maven-jib-example/pom.xml', goals: 'clean install jib:build -B', buildInfo: buildInfo - } - } - - stage ('Run create Docker build') { - rtDocker.createDockerBuild sourceRepo: ARTIFACTORY_DOCKER_REPO, jibImageFiles: "maven-examples/maven-jib-example/*/target/jib-image.json", buildInfo: buildInfo - } - - stage ('Publish build info') { - rtServer.publishBuildInfo buildInfo - } -} diff --git a/jenkins-examples/pipeline-examples/scripted-examples/maven-jib-example/README.md b/jenkins-examples/pipeline-examples/scripted-examples/maven-jib-example/README.md deleted file mode 100644 index d8b2037073..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/maven-jib-example/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Maven JIB Example - -## Prerequisites - -* Make sure to have the following job parameters configured: - * `SERVER_ID` - JFrog instance ID, defined in Jenkins --> Manage Jenkins --> Configure System - * `CREDENTIALS` - Credentials parameter type with username and password - * `ARTIFACTORY_LOCAL_RELEASE_REPO` - Artifactory local releases repository for deployment (i.e. libs-release-local) - * `ARTIFACTORY_LOCAL_SNAPSHOT_REPO` - Artifactory local snapshots repository for deployment (i.e. - libs-snapshot-local) - * `ARTIFACTORY_VIRTUAL_RELEASE_REPO` - Artifactory virtual releases repository for resolution (i.e. libs-release) - * `ARTIFACTORY_VIRTUAL_SNAPSHOT_REPO` - Artifactory virtual snapshots repository for resolution (i.e libs-snapshot) - * `ARTIFACTORY_DOCKER_REPO` - Artifactory virtual or remote docker repository (i.e. docker-virtual) - * `ARTIFACTORY_DOCKER_REGISTRY` - Artifactory docker registry (i.e. acme-docker-virtual.jfrog.io) \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/npm-container-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/npm-container-example/Jenkinsfile deleted file mode 100644 index aaf94ef283..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/npm-container-example/Jenkinsfile +++ /dev/null @@ -1,35 +0,0 @@ -node { - def server = Artifactory.server SERVER_ID - def rtNpm = Artifactory.newNpmBuild() - def dockerImage - def buildInfo - - stage('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage('Artifactory configuration') { - rtNpm.deployer repo: 'npm-local', server: server - rtNpm.resolver repo: 'npm-remote', server: server - buildInfo = Artifactory.newBuildInfo() - } - - stage('Build docker image') { - dockerImage = docker.build("java-node", "jenkins-examples/pipeline-examples/resources/npm") - } - - withEnv(['npm_config_cache=npm-cache']) { - dockerImage.inside() { - stage('Install npm') { - rtNpm.install buildInfo: buildInfo, path: 'npm-example' - } - stage('Publish npm') { - rtNpm.publish buildInfo: buildInfo, path: 'npm-example' - } - } - } - - stage('Publish build info') { - server.publishBuildInfo buildInfo - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/npm-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/npm-example/Jenkinsfile deleted file mode 100644 index ee25d6c74d..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/npm-example/Jenkinsfile +++ /dev/null @@ -1,28 +0,0 @@ -node { - def server = Artifactory.server SERVER_ID - def rtNpm = Artifactory.newNpmBuild() - def buildInfo - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - rtNpm.deployer repo: 'npm-local', server: server - rtNpm.resolver repo: 'npm-remote', server: server - rtNpm.tool = NPM_TOOL // Tool name from Jenkins configuration - buildInfo = Artifactory.newBuildInfo() - } - - stage ('Install npm') { - rtNpm.install buildInfo: buildInfo, path: 'npm-example' - } - - stage ('Publish npm') { - rtNpm.publish buildInfo: buildInfo, path: 'npm-example' - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/nuget-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/nuget-example/Jenkinsfile deleted file mode 100644 index 3407c291dd..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/nuget-example/Jenkinsfile +++ /dev/null @@ -1,22 +0,0 @@ -node { - def server = Artifactory.server SERVER_ID - def rtNuget = Artifactory.newNugetBuild() - def buildInfo - - stage ('Clone') { - git url: 'https://github.com/autofac/Examples.git' - } - - stage ('Artifactory configuration') { - rtNuget.resolver repo: 'nuget-remote', server: server - buildInfo = Artifactory.newBuildInfo() - } - - stage ('NuGet restore') { - rtNuget.run buildInfo: buildInfo, args: 'restore ./Examples.sln' - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/pip-examples/README.md b/jenkins-examples/pipeline-examples/scripted-examples/pip-examples/README.md deleted file mode 100644 index 7305539f66..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/pip-examples/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Jenkins Scripted Pipeline Examples for Pip Build - -## About the Examples - -### pip-example -This example allows running the pip-install command inside a pip virtual-environment. -Provide the virtual-environment activation command in *'virtual_env_activation'*. -If you do not wish the pip-install execution to activate a virtual-environment for you, don't use the *'envActivation'* argument in *'rtPip.install'* execution. - -### pip-plugin-example -This example demonstrates how to build your Python project with *pip* and *Artifactory*, while using the *[Pyenv Pipeline plugin](https://plugins.jenkins.io/pyenv-pipeline/)*. - -## Python Package and Create Distribution Archives Stage -This part, in both of the examples, executes after the pip-install has completed, and doesn't involve Artifactory. -This example uses 'wheel' and 'setuptools' tools in this step, you can use any other packaging tool instead. - -Refer to [Pip install with JFrog CLI example](https://github.com/jfrog/project-examples/tree/master/python-example) for information about setting the build environment. diff --git a/jenkins-examples/pipeline-examples/scripted-examples/pip-examples/pip-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/pip-examples/pip-example/Jenkinsfile deleted file mode 100644 index 2b765e7b98..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/pip-examples/pip-example/Jenkinsfile +++ /dev/null @@ -1,43 +0,0 @@ -node { - def server = Artifactory.server SERVER_ID - def rtPip = Artifactory.newPipBuild() - def buildInfo - def virtual_env_activation = "source /Users/myUser/venv-example/bin/activate" // pip virtual-environment activation command - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - rtPip.resolver repo: 'pypi-virtual', server: server - buildInfo = Artifactory.newBuildInfo() - } - - stage ('Pip install') { - rtPip.install buildInfo: buildInfo, args: "-r python-example/pip-example/requirements.txt", envActivation: virtual_env_activation - } - - stage ('Package and create distribution archives') { - sh ''' - $virtual_env_activation - cd python-example - python setup.py sdist bdist_wheel - ''' - } - - stage ('Upload packages') { - def uploadSpec = """{ - "files": [ - { - "pattern": "python-example/dist/", - "target": "pypi-virtual/" - } - ] - }""" - server.upload buildInfo: buildInfo, spec: uploadSpec - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/pip-examples/pip-plugin-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/pip-examples/pip-plugin-example/Jenkinsfile deleted file mode 100644 index ecff81ba0a..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/pip-examples/pip-plugin-example/Jenkinsfile +++ /dev/null @@ -1,45 +0,0 @@ -node { - def server = Artifactory.server SERVER_ID - def rtPip = Artifactory.newPipBuild() - def buildInfo - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Artifactory configuration') { - rtPip.resolver repo: 'pypi-virtual', server: server - buildInfo = Artifactory.newBuildInfo() - } - - withPythonEnv('/usr/local/bin/python3') { - stage ('Pip install') { - rtPip.install buildInfo: buildInfo, args: "-r python-example/pip-example/requirements.txt" - } - - stage ('Package and create distribution archives') { - sh ''' - cd python-example - pip install wheel - pip install setuptools - python setup.py sdist bdist_wheel - ''' - } - } - - stage ('Upload packages') { - def uploadSpec = """{ - "files": [ - { - "pattern": "python-example/dist/", - "target": "pypi-virtual/" - } - ] - }""" - server.upload buildInfo: buildInfo, spec: uploadSpec - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/promotion-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/promotion-example/Jenkinsfile deleted file mode 100755 index cbd907f529..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/promotion-example/Jenkinsfile +++ /dev/null @@ -1,49 +0,0 @@ -node { - def server - def uploadSpec - def buildInfo - def downloadSpec - def promotionConfig - - stage ('Build') { - git url: 'https://github.com/jfrog/project-examples.git' - - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - server = Artifactory.server SERVER_ID - - // Create the upload spec. - uploadSpec = readFile 'jenkins-examples/pipeline-examples/resources/props-upload.json' - - // Upload to Artifactory. - buildInfo = server.upload spec: uploadSpec - - // Create the download spec. - downloadSpec = readFile 'jenkins-examples/pipeline-examples/resources/props-download.json' - - // Download from Artifactory. - server.download spec: downloadSpec, buildInfo: buildInfo - - // Publish the build to Artifactory - server.publishBuildInfo buildInfo - } - - stage ('Promotion') { - promotionConfig = [ - //Mandatory parameters - 'buildName' : buildInfo.name, - 'buildNumber' : buildInfo.number, - 'targetRepo' : ARTIFACTORY_LOCAL_RELEASE_REPO, - - //Optional parameters - 'comment' : 'this is the promotion comment', - 'sourceRepo' : ARTIFACTORY_LOCAL_SNAPSHOT_REPO, - 'status' : 'Released', - 'includeDependencies': true, - 'failFast' : true, - 'copy' : true - ] - - // Promote build - server.promote promotionConfig - } -} \ No newline at end of file diff --git a/jenkins-examples/pipeline-examples/scripted-examples/props-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/props-example/Jenkinsfile deleted file mode 100755 index 721d36b74f..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/props-example/Jenkinsfile +++ /dev/null @@ -1,50 +0,0 @@ -node { - def uploadSpec - def setPropsSpec - def downloadSpec - def deletePropsSpec - def buildInfo1 - def buildInfo2 - - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - def server = Artifactory.server SERVER_ID - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Upload') { - // Read the upload spec which was downloaded from github. - uploadSpec = readFile 'jenkins-examples/pipeline-examples/resources/props-upload.json' - // Upload to Artifactory. - buildInfo1 = server.upload spec: uploadSpec - } - - stage ('Set Props') { - // Read the set-props spec. - setPropsSpec = readFile 'jenkins-examples/pipeline-examples/resources/set-props.json' - // Set properties on the matching artifacts. - server.setProps spec: setPropsSpec, props: "p3=v3", failNoOp: true - } - - stage ('Download') { - // Read the download spec. - downloadSpec = readFile 'jenkins-examples/pipeline-examples/resources/props-download.json' - // Download from Artifactory. - buildInfo2 = server.download spec: downloadSpec - } - - stage ('Publish Build Info') { - // Merge the upload and download build-info objects. - buildInfo1.append buildInfo2 - // Publish the build to Artifactory - server.publishBuildInfo buildInfo1 - } - - stage ('Delete Props') { - // Read the delete-props spec. - deletePropsSpec = readFile 'jenkins-examples/pipeline-examples/resources/delete-props.json' - // Delete properties on the matching artifacts. - server.deleteProps spec: deletePropsSpec, props: "p1,p2", failNoOp: true - } -} diff --git a/jenkins-examples/pipeline-examples/scripted-examples/props-single-file-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/props-single-file-example/Jenkinsfile deleted file mode 100755 index 56cf047343..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/props-single-file-example/Jenkinsfile +++ /dev/null @@ -1,80 +0,0 @@ -node { - def buildInfo1 - def buildInfo2 - - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - def server = Artifactory.server SERVER_ID - - stage ('Clone') { - git url: 'https://github.com/jfrog/project-examples.git' - } - - stage ('Upload') { - // Create the upload spec. - def uploadSpec = """{ - "files": [ - { - "pattern": "jenkins-examples/pipeline-examples/resources/ArtifactoryPipeline.zip", - "target": "libs-snapshot-local", - "props": "p1=v1;p2=v2" - }, - { - "pattern": "jenkins-examples/pipeline-examples/resources/ArtifactoryPipelineNoProps.zip", - "target": "libs-snapshot-local" - } - ] - }""" - // Upload to Artifactory. - buildInfo1 = server.upload spec: uploadSpec - } - - stage ('Set Props') { - // Create the set-props spec. - def setPropsSpec = """{ - "files": [ - { - "pattern": "libs-snapshot-local/*(Pipeline).zip", - "props": "p1=v1;p2=v2" - } - ] - }""" - // Set properties on the matching artifacts. - server.setProps spec: setPropsSpec, props: "p3=v3", failNoOp: true - } - - stage ('Download') { - // Create the download spec. - def downloadSpec = """{ - "files": [ - { - "pattern": "libs-snapshot-local/*(Pipeline).zip", - "target": "Bazinga/{1}/", - "props": "p1=v1;p2=v2" - } - ] - }""" - // Download from Artifactory. - buildInfo2 = server.download spec: downloadSpec - } - - stage ('Publish Build Info') { - // Merge the upload and download build-info objects. - buildInfo1.append buildInfo2 - // Publish the build to Artifactory - server.publishBuildInfo buildInfo1 - } - - stage ('Delete Props') { - // Create the delete-props spec. - def deletePropsSpec = """{ - "files": [ - { - "pattern": "libs-snapshot-local/*(Pipeline).zip", - "props": "p3=v3" - } - ] - }""" - // Delete properties on the matching artifacts. - server.deleteProps spec: deletePropsSpec, props: "p1,p2", failNoOp: true - } -} diff --git a/jenkins-examples/pipeline-examples/scripted-examples/vars-build-retention-example/Jenkinsfile b/jenkins-examples/pipeline-examples/scripted-examples/vars-build-retention-example/Jenkinsfile deleted file mode 100755 index a9e24151d8..0000000000 --- a/jenkins-examples/pipeline-examples/scripted-examples/vars-build-retention-example/Jenkinsfile +++ /dev/null @@ -1,28 +0,0 @@ -node { - // Obtain an Artifactory server instance, defined in Jenkins --> Manage Jenkins --> Configure System: - def server = Artifactory.server SERVER_ID - def buildInfo = Artifactory.newBuildInfo() - - stage ('Collect env vars') { - // By default the filter is configured to exclude "*password*,*secret*,*key*" - buildInfo.env.filter.addInclude("*") - buildInfo.env.filter.addExclude("DONT_COLLECT*") - - withEnv(['DO_COLLECT_FOO=BAR', 'DONT_COLLECT_FOO=BAR']) { - buildInfo.env.collect() - } - } - - stage ('Access build info env vars') { - echo buildInfo.env.vars['DO_COLLECT_FOO'] //BAR - echo buildInfo.env.vars['DONT_COLLECT_FOO'] //null - } - - stage ('Set build retention') { - buildInfo.retention maxBuilds: 1, maxDays: 2, doNotDiscardBuilds: ["3"], deleteBuildArtifacts: true - } - - stage ('Publish build info') { - server.publishBuildInfo buildInfo - } -} \ No newline at end of file