How to configure a custom resource type in a concourse pipeline?

不想你离开。 提交于 2019-12-11 15:29:04

问题


I've already done a google search to find a way to setup a custom resource in concourse pipeline but the answers/documentation do not work.

Can someone provide a working example of custom resource type that is pulled from a local registry and used in a build plan?

For example, say I were to clone the git resource and slightly modify it and pushed it to my local registry. The git resource image would be name: localhost:5000/local_git:latest

How would you be able to use this custom resource (local_git:latest) in a pipeline definition?


回答1:


There are two main settings to consider here when running a local registry:

  1. Must use insecure_registries:

    insecure_registries: ["my.local.registry:8080"]

  2. If you are running your registry in "localhost", you shouldn't use localhost as the address for your registry, if you do, the docker image will try to resolve to the localhost of the docker image instead of your local machine, in order to avoid this problem, use the IP address of your local machine. (DON'T use 127.0.0.1)




回答2:


You can define your custom resource type in your pipeline under the resource_types key in the pipeline yml.

Eg:

resource_types:
  - name: custom-git
    type: docker-image
    source:
      repository: localhost:5000/local_git

An important note is that custom resource type images are fetched in a manner identical to using a base resource in your pipeline, so for your case of a private Docker registry, you will just need to configure the necessary source: on the docker-image resource (See the docs for the docker-image-resource)

You can then use the type for resources as you would any of the base types:

resources:
  - name: some-custom-git-resource
    type: custom-git
    source: ...

Note the type: key of the resource matches the name: on the resource type.

Take a look at the Concourse Documentation for Configuring Resource Types for more information on how to use custom types in your pipeline.



来源:https://stackoverflow.com/questions/46417557/how-to-configure-a-custom-resource-type-in-a-concourse-pipeline

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!