Artifactory Integration

JFrog Pipelines Documentation

Products
JFrog Pipelines
Content Type
User Guide
ft:sourceType
Paligo

Note

Artifactory Integration will be deprecated soon!

Artifactory Integration will be deprecated as announced in Artifactory version 7.47.10, hence we recommend migrating from Artifactory Integration to JFrog Platform Access Token Integration. Refer to Migrating to JFrog Platform Access Token Integration (Existing Artifactory Integration).

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 Artifactory 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.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.

Migrating to JFrog Platform Access Token Integration (Existing Artifactory Integration)

Pipelines is leveraging JFrog Platform Access Token Integration to integrate Artifactory by incorporating Artifactory URL to enhance Artifactory utilization through PAT.

Edit the existing Artifactory Integration to migrate to the JFrog Platform Access Token Integration. On successful migration, existing pipelines definition such as, steps and resources work as expected (the name of the integration remains the same thus avoiding any need for a change).

To migrate from Artifactory Integration to JFrog Platform Access Token Integration, follow these steps:

  1. Go to Administration | Pipelines | Integrations.

  2. Click Actions icon in line with the Integration you want to migrate to JFrog Platform Access Token Integration, and then click Edit.

  3. Click Migrate.

  4. Enter Platform Access Token, and then click Migrate.

PATMigration.gif

Usage

With native steps: An Artifactory integration or JFrog Platform Access Token integration is mandatory in the integrations section of the following native steps:

In resources: An Artifactory integration or JFrog Platform Access Token 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