Artifactory Integration

JFrog Pipelines Documentation

ft:sourceType
Paligo

The Artifactory Integration connects your JFrog Pipeline Automation platform to an installation of Artifactory to push artifacts including Docker images, and maintain build information.

Creating an Integration

Add this integration by following steps on the Managing Pipelines Integrations page.

Here is the information you need to create this integration:

  • Name -- Choose a friendly name for the integration

  • Artifactory URL -- The Artifactory URL is automatically added for the user adding the integration. If required, you can manually enter the HTTP Endpoint (URL) for your JFrog Artifactory.

  • User -- The Artifactory username is automatically added for the user adding the integration. If required, you can manually enter the username for your JFrog Artifactory.

  • API key -- Your Artifactory API Key.Introduction to the User Profile

    Click Get API Key to automatically fetch API key for the user adding the integration. If the API key does not exist, a new one is generated. If required, you can manually enter the API key for your JFrog Artifactory.

Usage

With native steps: An Artifactory integration is mandatory in the integrations section of the following native steps:

In resources: An Artifactory integration must/may be used in the following resources:

Mandatory

Optional

Default Environment Variables

When you add this integration directly to a step, a set of environment variables is automatically made available.

Environment variable

Description

int_<integration_name>_url

URL of Artifactory

int_<integration_name>_user

Username supplied in the integration

int_<integration_name>_apikey

Access token supplied in the integration

When you create an Aql, BuildInfo, or FileSpec resource with this integration, a set of environment variables is automatically made available in steps using that resource.

Environment variable

Description

res_<resource_name>_sourceArtifactory_url

URL of Artifactory

res_<resource_name>_sourceArtifactory_user

Username supplied in the integration

res_<resource_name>_sourceArtifactory_apikey

Access token supplied in the integration

When you create an Image resource with this integration, a set of environment variables is automatically made available in steps using that resource.

Environment variable

Description

res_<resource_name>_registry_url

URL of Artifactory

res_<resource_name>_registry_user

Username supplied in the integration

res_<resource_name>_registry_apikey

Access token supplied in the integration

When you create a RemoteFile resource with this integration, a set of environment variables is automatically made available in steps using that resource.

Environment variable

Description

res_<resource_name>_source_url

URL of Artifactory

res_<resource_name>_source_user

Username supplied in the integration

res_<resource_name>_source_apikey

Access token supplied in the integration

Examples

The following example creates a Docker image that is published to Artifactory. It assumes that an Artifactory integration named myArtifactory has been created.

template: true   # required for local templates
valuesFilePath: ./values.yml

resources:
  - name: dbp_repo
    type: GitRepo
    configuration:
      gitProvider: {{ .Values.gitIntegration }}                      
      path: {{ .Values.gitRepositoryPath }} 
      branches:
        include: master

  - name: dbp_image
    type: Image
    configuration:
      registry: {{ .Values.artifactoryIntegration }}
      sourceRepository:  {{ .Values.sourceRespository }}
      imageName:  {{ .Values.artifactoryUrl }}/{{ .Values.sourceRepository }}/{{ .Values.imageName }}
      imageTag: latest
      autoPull: true
      
  - name: dbp_build_info
    type: BuildInfo
    configuration:
      sourceArtifactory: {{ .Values.artifactoryIntegration }}
      buildName: dbp_build
      buildNumber: 1    

  - name: dbp_promoted_build_info
    type: BuildInfo
    configuration:
      sourceArtifactory: {{ .Values.artifactoryIntegration }}
      buildName: dbp_build
      buildNumber: 1
      

pipelines:
  - name: pipeline_dbp
    steps:
      - name: docker_build
        type: DockerBuild
        configuration:
          affinityGroup: dbp_group          # affinity group string that is the same as specified in the DockerPush step
          dockerFileLocation: .
          dockerFileName: Dockerfile
          dockerImageName:  {{ .Values.artifactoryUrl }}/{{ .Values.sourceRepository }}/{{ .Values.imageName }}
          dockerImageTag: ${run_number}
          inputResources:
            - name: dbp_repo
          integrations:
            - name: {{ .Values.artifactoryIntegration }}

      - name: docker_push
        type: DockerPush
        configuration:
          affinityGroup: dbp_group          # affinity group string that is the same as specified in the DockerBuild step
          targetRepository: docker-local
          integrations:
            - name: {{ .Values.artifactoryIntegration }}
          inputSteps:
            - name: docker_build
          outputResources:
            - name: dbp_image

      - name: publish_dbp_build
        type: PublishBuildInfo
        configuration:
          inputSteps:
            - name: docker_push
          outputResources:
            - name: dbp_build_info

      - name: promote_dbp_build
        type: PromoteBuild
        configuration:
          targetRepository: demo-pipelines
          integrations:
            - name: {{ .Values.artifactoryIntegration }}
          inputResources:
            - name: dbp_build_info
          outputResources:
            - name: dbp_promoted_build_info