gocd-contrib / gomatic

A Python API for configuring GoCD
https://pypi.python.org/pypi/gomatic
MIT License
142 stars 59 forks source link

Support for external artifacts #67

Closed grawert closed 5 years ago

grawert commented 5 years ago

External artifacts differ from Build and Test artifacts in not having a src field. Instead an id and storeId field is present. In addition to that, a list of key-value properties is present, containing the plugin specific configuration.

An example XML configuration for docker-registry-plugin looks like this:

<artifact type="external" id="docker-image" storeId="docker-registry">
  <configuration>
    <property>
      <key>Image</key>
      <value />
    </property>   
    <property>
      <key>Tag</key>
      <value />
    </property>   
    <property>    
      <key>BuildFile</key>
      <value>buildfile.json</value>
    </property>   
  </configuration>
</artifact>

The fetch task for a docker-registry artifact looks like this:

<fetchartifact artifactOrigin="external" artifactId="docker-image" pipeline="build-docker-image" stage="build" job="build">
  <configuration>
    <property>
      <key>EnvironmentVariablePrefix</key>
      <value>DOCKERIZED_APP</value>
    </property>
    <property>
      <key>SkipImagePulling</key>
      <value>true</value>
    </property>
  </configuration>
  <runif status="passed" />
</fetchartifact>

The artifact store configuration looks like this:

 <artifactStores>
    <artifactStore id="docker-registry" pluginId="cd.go.artifact.docker.registry">
      <property>
        <key>RegistryType</key>
        <value>other</value>
      </property>
      <property>
        <key>RegistryURL</key>
        <value>private-registry:5000</value>
      </property>
      <property>
        <key>RegistryID</key>
        <value />
      </property>
      <property>
        <key>AWSAccessKeyId</key>
        <encryptedValue />
      </property>
      <property>
        <key>AWSSecretAccessKey</key>
        <encryptedValue />
      </property>
      <property>
        <key>AWSRegion</key>
        <value />
      </property>
      <property>
        <key>Username</key>
        <value>gomatic</value>
      </property>
      <property>
        <key>Password</key>
        <encryptedValue>secret</encryptedValue>
      </property>
    </artifactStore>
  </artifactStores>
grawert commented 5 years ago

PR #68

grawert commented 5 years ago

68 merged. Closing.