Bitbucket Pipeline

From Chorke Wiki
(Redirected from Bitbucket Pipelines)
Jump to navigation Jump to search

Images for Pipelines

https://hub.docker.com/_/maven
3.3.3-jdk-7, 3.3.3-jdk-8, 3.3.3-jdk-9
3.3.9-jdk-7, 3.3.9-jdk-7-alpine
3.3.9-jdk-8, 3.3.9-jdk-8-alpine

Maven JDK Pipelines

# @web       http://chorke.org
# @vendor    Chorke, Inc.
# @version   0.0.00
# @since     0.0.00
image: maven:3.3.9-jdk-7
pipelines:
  branches:
    master:
      - step:
          name: Deploy Releases Base Artifact
          caches:
            - maven
          script:
            - bash <(curl -s 'http://cdn.chorke.org/repo/mvn/settings.sh.txt')
            - cat $HOME/.m2/settings.xml
            - cat /usr/share/maven/conf/settings.xml
            - mvn clean deploy -N -Djava.net.preferIPv4Stack=true

Maven Local Settings

<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <servers>
    <server>
      <id>chorke.releases</id>
      <configuration>
        <httpHeaders>
          <property>
            <name>Authorization</name>
            <value>${env.CKI_HTTP_BASIC_AUTH}</value>
          </property>
        </httpHeaders>
      </configuration>
    </server>
    <server>
      <id>chorke.snapshots</id>
      <configuration>
        <httpHeaders>
          <property>
            <name>Authorization</name>
            <value>${env.CKI_HTTP_BASIC_AUTH}</value>
          </property>
        </httpHeaders>
      </configuration>
    </server>
    <server>
      <id>chorke.releases.ftp</id>
      <username>releases@chorke.com</username>
      <password>${env.CKI_SFTP_RELEA_PASS}</password>
    </server>
    <server>
      <id>chorke.snapshots.ftp</id>
      <username>snapshots@chorke.com</username>
      <password>${env.CKI_SFTP_SNAPS_PASS}</password>
    </server>
    <server>
      <id>chorke.webstart.ftp</id>
      <username>javaws@chorke.com</username>
      <password>${env.CKI_SFTP_JAVAW_PASS}</password>
    </server>
  </servers>
</settings>

Maven Global Settings

#!/bin/bash
: '
 @author   "Chorke, Inc."<devs@chorke.org>
 @web       http://chorke.org
 @vendor    Chorke, Inc.
 @version   0.0.00
 @since     0.0.00
'

CKI_M2_SETTING_CONF='/usr/share/maven/conf/settings.xml'
CKI_M2_MIRRORS_FIND="  </mirrors>"
CKI_M2_MIRRORS_FILL="\
    <mirror>\n\
      <id>chorke.snapshots</id>\n\
      <name>chorke.snapshots</name>\n\
      <mirrorOf>flyway-repo-private</mirrorOf>\n\
      <url>http://mvn.chorke.org/m2/snapshots</url>\n\
    </mirror>\n\
    <mirror>\n\
      <id>chorke.releases</id>\n\
      <name>chorke.releases</name>\n\
      <mirrorOf>flyway-repo-private</mirrorOf>\n\
      <url>http://mvn.chorke.org/m2/releases/</url>\n\
    </mirror>\n\
  </mirrors>"

CKI_M2_PROFILE_FIND="  </profiles>"
CKI_M2_PROFILE_FILL="\
    <profile>\n\
      <id>central</id>\n\
      <repositories>\n\
        <repository>\n\
          <id>central</id>\n\
          <name>Maven Repository Switchboard</name>\n\
          <url>http://repo1.maven.org/maven2</url>\n\
          <snapshots><enabled>false</enabled></snapshots>\n\
        </repository>\n\
      </repositories>\n\
      <pluginRepositories>\n\
        <pluginRepository>\n\
          <id>central</id>\n\
          <name>Maven Plugin Repository</name>\n\
          <url>http://repo1.maven.org/maven2</url>\n\
          <snapshots><enabled>false</enabled></snapshots>\n\
          <releases><updatePolicy>never</updatePolicy></releases>\n\
        </pluginRepository>\n\
      </pluginRepositories>\n\
    </profile>\n\
    <profile>\n\
      <id>apache</id>\n\
      <repositories>\n\
        <repository>\n\
          <id>apache</id>\n\
          <url>https://repository.apache.org/content/repositories/releases</url>\n\
          <snapshots><enabled>false</enabled></snapshots>\n\
        </repository>\n\
      </repositories>\n\
      <pluginRepositories>\n\
        <pluginRepository>\n\
          <id>apache</id>\n\
          <url>https://repository.apache.org/content/repositories/releases</url>\n\
          <snapshots><enabled>false</enabled></snapshots>\n\
        </pluginRepository>\n\
      </pluginRepositories>\n\
    </profile>\n\
    <profile>\n\
      <id>spring</id>\n\
      <repositories>\n\
        <repository>\n\
          <id>spring-releases</id>\n\
          <url>http://repo.spring.io/release</url>\n\
          <snapshots><enabled>false</enabled></snapshots>\n\
        </repository>\n\
      </repositories>\n\
      <pluginRepositories>\n\
        <pluginRepository>\n\
          <id>spring-releases</id>\n\
          <url>http://repo.spring.io/release</url>\n\
          <snapshots><enabled>false</enabled></snapshots>\n\
        </pluginRepository>\n\
      </pluginRepositories>\n\
    </profile>\n\
    <profile>\n\
      <id>jboss</id>\n\
      <repositories>\n\
        <repository>\n\
          <id>jboss.public</id>\n\
          <url>http://repository.jboss.org/nexus/content/groups/public</url>\n\
          <snapshots><enabled>false</enabled></snapshots>\n\
        </repository>\n\
        <repository>\n\
          <id>jboss.fuse</id>\n\
          <url>http://repo.fusesource.com/nexus/content/groups/public/</url>\n\
          <snapshots><enabled>false</enabled></snapshots>\n\
        </repository>\n\
      </repositories>\n\
      <pluginRepositories>\n\
        <pluginRepository>\n\
          <id>jboss.public</id>\n\
          <url>http://repository.jboss.org/nexus/content/groups/public</url>\n\
          <snapshots><enabled>false</enabled></snapshots>\n\
        </pluginRepository>\n\
        <pluginRepository>\n\
          <id>jboss.fuse</id>\n\
          <url>http://repo.fusesource.com/nexus/content/groups/public/</url>\n\
          <snapshots><enabled>false</enabled></snapshots>\n\
        </pluginRepository>\n\
      </pluginRepositories>\n\
    </profile>\n\
  </profiles>"

CKI_M2_ACTIVES_FIND="</settings>"
CKI_M2_ACTIVES_FILL="\
  <activeProfiles>\n\
    <activeProfile>central</activeProfile>\n\
    <activeProfile>apache</activeProfile>\n\
    <activeProfile>spring</activeProfile>\n\
  </activeProfiles>\n\
</settings>"

sed -i "s|$CKI_M2_MIRRORS_FIND|$CKI_M2_MIRRORS_FILL|" "$CKI_M2_SETTING_CONF"
sed -i "s|$CKI_M2_PROFILE_FIND|$CKI_M2_PROFILE_FILL|" "$CKI_M2_SETTING_CONF"
sed -i "s|$CKI_M2_ACTIVES_FIND|$CKI_M2_ACTIVES_FILL|" "$CKI_M2_SETTING_CONF"

curl -o $HOME/.m2/settings.xml -s 'http://cdn.chorke.org/repo/mvn/settings.xml'
#bash <(curl -s 'http://cdn.chorke.org/repo/mvn/settings.sh.txt')

References