Use File Specs In Your CI/CD To Get Full Control of Your Artifacts

您所在的位置:网站首页 filefilespattern Use File Specs In Your CI/CD To Get Full Control of Your Artifacts

Use File Specs In Your CI/CD To Get Full Control of Your Artifacts

2024-07-14 13:22:40| 来源: 网络整理| 查看: 265

Getting creative with how you manage your artifacts in JFrog Artifactory? It’s time to get familiar with File Specs.

File specs allow you to specify the files you want to upload and download to and from Artifactory with a simple configuration. With only 2 mandatory fields, source (referred to as pattern) and target, you can find the artifacts you need according to the specifications that you define. Advanced users can also benefit from the power of regex and AQL to define file source patterns and targets when uploading and downloading artifacts. You can also use placeholders to determine the name of the artifact once downloaded or uploaded. The possibilities are endless.

What’s even better is that you can actually define a single File Spec that can be used with your favorite CI server, including Jenkins, TeamCity and Bamboo. You can even use file specs with cloud CI servers, such as Travis-CI and Circle CI, using JFrog CLI!

Let’s get started with some interesting examples that implement these functionalities.

Jenkins

File specs are supported for both generic and pipeline Jenkins jobs using the Jenkins Artifactory plugin. Below is an example script showing how to upload a file to Artifactory in a Jenkins pipeline job.

Notice the regex defined in the pattern field below specifies to upload all files from the “jenkins-pipeline-examples/resources/” directory that match the “.*A[A-z]tifactory.*.zip” or “.*(A|a)rtifactory.*.zip” patterns.

For example: “ArtifactoryPipeline.zip” and “ArtifactoryPipelineNoProps.zip”.

def uploadSpec = """{    "files": [        {          "pattern": "jenkins-pipeline-examples/resources/.*A[A-z]tifactory.*.zip",          "target": "libs-snapshot-local/",          "regexp": "true"        },        {          "pattern": "jenkins-pipeline-examples/resources/.*(A|a)rtifactory.*.zip",          "target": "libs-snapshot-local/",          "regexp": "true"        }    ] }""" server.upload spec: uploadSpec, buildInfo: buildInfo

In generic jobs, there are two ways to define your file spec: load the spec from a file, or save it as text in your job configuration.

Defining file spec in a file

To specify a JSON file as the file spec source simply add the path to the file, relative to the workspace. In the example below, “props-download.json” will be used.

Download Spec Source Jenkins Example

Defining file spec in the job configuration

Download Spec Source File Jenkins Example

TeamCity

The TeamCity Artifactory plugin also allows you to specify download and upload spec sources in generic run types. Just as in Jenkins, you can also choose between ‘File’ and ‘Job configuration’. Generic run types that can be used include Command line, Powershell, MSbuild and more.

TeamCity Artifactory Plugin

Bamboo

There are 2 separate generic jobs, deploy and resolve, that are used to upload and download files from Artifactory using the Bamboo Artifactory plugin. Just as in the previous CI servers, the option to choose either a file or job configuration as a spec source is also available here. Below are examples for each.

To upload files to Artifactory create an “Artifactory generic Deploy” task. Fill in the details and select the “Specs” option under “upload by”.

Bamboo Upload Example

To download files from Artifactory create an “Artifactory Generic Resolve” task, respectively.

Bamboo Download Example

JFrog CLI

The JFrog CLI supports file specs, with its download, upload, search, move, copy and delete commands. Simply create a JSON file with the spec and attach it to the command using the –spec option. For example:

jfrog rt u –spec /path/to/spec/upload_spec.json. jfrog rt dl –spec /path/to/spec/download_spec.json. jfrog rt mv –spec /path/to/spec/move_spec.json. jfrog rt cp –spec /path/to/spec/copy_spec.json. jfrog rt del –spec /path/to/spec/delete_spec.json. jfrog rt s –spec /path/to/specs/search_spec.json. Summarizing All This Greatness

Now it’s your turn to take advantage of this powerful File Spec feature, and benefit from a simple and universal way to manage your files. Start by trying it out with some of our examples, and then use it with all your favorite CI servers.

Jenkins Artifactory plugin TeamCity Artifactory plugin Bamboo Artifactory plugin JFrog CLI


【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭