Skip to content
This repository has been archived by the owner on Jul 4, 2018. It is now read-only.

Changes required to run the mavenCanaryRelease script with fmp-v3 #161

Open
KurtStam opened this issue Sep 14, 2016 · 0 comments
Open

Changes required to run the mavenCanaryRelease script with fmp-v3 #161

KurtStam opened this issue Sep 14, 2016 · 0 comments

Comments

@KurtStam
Copy link
Member

  1. On a single node deployment the build needs to be tagged, with the local docker registry prefix. This so the pod deployment can download the image from the local cache.

https://github.com/rawlingsj/jenkins-pipeline-library/blob/master/vars/mavenCanaryRelease.groovy#L24

Model m = readMavenPom file: 'pom.xml'
        def groupId = m.groupId.split( '\\.' )
        def user = groupId[groupId.size()-1].trim()
        def artifactId = m.artifactId

        kubernetes.image().withName("${user}/${artifactId}:${config.version}").tag().inRepository("${env.FABRIC8_DOCKER_REGISTRY_SERVICE_HOST}:${env.FABRIC8_DOCKER_REGISTRY_SERVICE_PORT}/${user}/${artifactId}").withTag("${config.version}")
  1. Note that the pipeline now assumed fmp-3, so your project needs to be converted to use this version of the plugin. Upgrade to the latest fmp-2 plugin and run

mvn install fabric8:migrate

  1. For the tag in step 1 to work it is assumed the image name of the form group/artifact:version. So upgrade your pom so the image name is defined as
    ...
        <images>
            <image>
              <name>%g/%a:%v</name>
              <build>

...

  1. remove any image name definition in the src/main/fabric8/deployment.yml
  2. remote a docker.image property if you have one defined in your pom properties.

Try deploying your project to f8 using

mvn fabric8:run

  1. I had to remove the labels mention in my src/main/fabric8/deployment.yml as they did not line up. Which prevented pod to be spun up.

Warning DeploymentCreationFailed Couldn't deploy version 1: ReplicationController "hellokurt-1" is invalid: spec.template.metadata.labels: Invalid value: {"container":"test","deployment":"hellokurt-1","deploymentconfig":"hellokurt","group":"io.kurt","project":"hellokurt","provider":"fabric8","version":"0.0.1-SNAPSHOT"}: selector does not match template labels

The fmp build step should probably have thrown a validation error if labels don't match up and not finish successfully.

  1. Finally my fabric8 console had the production namespace defined as 'default-prod' while my job got deployed to default-production. I had to fix the reference in the 'Environments' tab in the fabric8-console. Then prod deployment were displayed in dashboard.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant