Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken ElasticAgent support (v4 vs v5 EA API) #65

Open
leprechaun opened this issue Sep 1, 2019 · 1 comment
Open

Broken ElasticAgent support (v4 vs v5 EA API) #65

leprechaun opened this issue Sep 1, 2019 · 1 comment

Comments

@leprechaun
Copy link

Howdy,

Seems like the XML config format for ElasticAgents has changed with the release of 19.3.

What used to be ...

<elastic>
  <profiles>
    <profile  id="docker.unit-test" pluginId="cd.go.contrib.elastic-agent.docker">
      <property>
        <!--
          The plugin currently only supports the `Image` property,
          which allows you to select the docker image that the build should run with
        -->
        <key>Image</key>
        <value>gocdcontrib/ubuntu-docker-elastic-agent</value>
      </property>
    </profile>
  </profiles>
</elastic>

is now

  <elastic>
    <agentProfiles>
      <agentProfile id="some-id" clusterProfileId="some-cluster-profile">
        <property>
          <key>PodSpecType</key>
          <value>yaml</value>
        </property>
        <property>
          <key>Privileged</key>
          <value>true</value>
        </property>
        <property>
          <key>Image</key>
          <value>gocd/gocd-agent-docker-dind:v19.7.0</value>
        </property>
        <property>
          <key>PodConfiguration</key>
          <value>apiVersion: v1
kind: Pod
metadata:
  name: gocd-agent-{{ POD_POSTFIX }}
  labels:
    app: web
spec:
  serviceAccountName: default
  containers:
    - name: gocd-agent-container-{{ CONTAINER_POSTFIX }}
      image: gocd/gocd-agent-docker-dind:v19.7.0
      securityContext:
        privileged: true</value>
        </property>
      </agentProfile>
    </agentProfiles>
    <clusterProfiles>
      <clusterProfile id="some-cluster-profile pluginId="cd.go.contrib.elasticagent.kubernetes">
        <property>
          <key>go_server_url</key>
          <value>https://gocd-server:8154/go</value>
        </property>
        <property>
          <key>kubernetes_cluster_url</key>
          <value>https://10.96.0.1:443</value>
        </property>
        <property>
          <key>security_token</key>
          <encryptedValue>AES:SOMEREALLYLONGSTRINGYAY!!!!!1one</encryptedValue>
        </property>
        <property>
          <key>namespace</key>
          <value>ci</value>
        </property>
      </clusterProfile>
    </clusterProfiles>
  </elastic>

If I understood correctly, the higher level stanza (AgentProfiles, ClusterProfiles), are dependent on the GoCD version (and elastic agent API version, eg, v5) ... the exact confg of agent profile are dependent on the version the agent plugin (eg, kubernetes) ... which gomatic doesn't specifically care about.

So, I think this is mostly a question of detecting the GoCD server version, and using the right format. Agent specifics remain a user issue.

@arvindsv
Copy link

I really think gomatic should just use these migrations (appropriate ones based on a server version): https://github.com/gocd/gocd/tree/master/config/config-server/src/main/resources/upgrades

Then, any changes in GoCD's config will never matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants