我正在尝试从git获取一个项目,并将其传递给下一个Put方法以运行脚本。但是git资源不可用于下一个put方法。不知道我是否缺少一些基本的知识,但是对于菜鸟CI-CD知识的新手,无法找出确切的问题。这是我的大厅管道:
---
resource_types:
- name: ssh
type: docker-image
source:
repository: quay.io/henry40408/concourse-ssh-resource
resources:
- name: rdt-blr-oc-1
type: ssh
source:
host: 10.xx.xx.xx
user: user1
password: password1
- name: commit-etc
type: git
icon: gitlab
source:
uri: https://gitlab.com/etc.git
username: ((ci_user))
password: ((ci_user_password))
branch: master
jobs:
- name: run_file_to_remote_host
serial: true
public: true
plan:
- get: commit-etc
trigger: false
inputs: commit-etc
- put: rdt-blr-oc-1
params:
interpreter: /bin/sh
path:
inputs:
- name: commit-etc
outputs:
- name: commit-etc
script: |
hostname;
HOSTNAME=`hostname`
echo "Create Unique directory. "
ls commit-vcode-etc // This directory is not available as failed to find this directory.
查看您的管道和说明,看起来put
操作似乎不是最能满足您所尝试做的事情的。 put
将推送给定资源,在git资源的情况下,它将进行提交。但是,您正在尝试运行脚本以列出commit-etc资源的内容。
要实现这一点,您需要将其作为任务步骤(https://concourse-ci.org/tasks.html)运行,该步骤将commit-etc资源作为输入。例如:
jobs:
- name: run_file_to_remote_host
serial: true
public: true
plan:
- get: commit-etc
trigger: false
- task: rdt-blr-oc-1
config:
platform: linux
image: my-image #the image you'll use the run the script
inputs:
- name: commit-etc
run:
path: /bin/sh
args:
- |
hostname;
HOSTNAME=`hostname`
echo "Create Unique directory. "
ls commit-etc // This directory is not available as failed to find this directory.
这将采用从get
步骤中检索到的资源,并运行概述的脚本。此资源有助于您掌握Concourse的基础知识以及一切如何融合:https://concoursetutorial.com