1
0
Fork 0

Add Basic TeamCity Phabricator Plugin

Using TeamCity plugin template create an empty client and server plugin which will report back to phabricator
This commit is contained in:
Steven Cooney 2019-05-30 13:53:15 +01:00
parent 11558ddf54
commit 0dbf491410
18 changed files with 641 additions and 0 deletions

217
.gitignore vendored Normal file
View file

@ -0,0 +1,217 @@
# Created by https://www.gitignore.io/api/java,code,windows,eclipse,intellij
# Edit at https://www.gitignore.io/?templates=java,code,windows,eclipse,intellij
### Custom ###
**/target
servers
### Code ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
### Eclipse Patch ###
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Annotation Processing
.apt_generated
.sts4-cache/
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
# JetBrains templates
**___jb_tmp___
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
.idea/sonarlint
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.gitignore.io/api/java,code,windows,eclipse,intellij

View file

@ -20,6 +20,13 @@ The plugin requires:
To deploy simply drag the contents of the folder to `src/extensions/` on the Phabricator instance and then restart the application.
### Teamcity-Phabricator-Plugin
The teamcity plugin comprises of server and agent plugins for teamcity.
#### Server
The server plugin monitors builds with the phabricator feature enabled waiting for builds to finish and notify phabricator.
## Useful Links
* https://confluence.jetbrains.com/display/TCD10/Web+UI+Extensions

View file

@ -0,0 +1,35 @@
<?xml version="1.0"?>
<assembly>
<id>plugin-agent-assembly</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<files>
<file>
<source>../phabricator-plugin-agent/teamcity-plugin.xml</source>
<outputDirectory>/</outputDirectory>
</file>
</files>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>uk.xlab.teamcity.phabricator:phabricator-plugin-agent</include>
<include>uk.xlab.teamcity.phabricator:phabricator-plugin-common</include>
</includes>
<binaries>
<outputDirectory>lib</outputDirectory>
<unpack>false</unpack>
<dependencySets>
<dependencySet>
<includes>
<include>*</include>
</includes>
</dependencySet>
</dependencySets>
</binaries>
</moduleSet>
</moduleSets>
</assembly>

View file

@ -0,0 +1,38 @@
<?xml version="1.0"?>
<assembly>
<id>plugin-assembly</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<files>
<file>
<source>target/teamcity-plugin.xml</source>
<outputDirectory>/</outputDirectory>
</file>
<file>
<source>target/phabricator-plugin-agent.zip</source>
<outputDirectory>agent</outputDirectory>
</file>
</files>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>uk.xlab.teamcity.phabricator:phabricator-plugin-server</include>
<include>uk.xlab.teamcity.phabricator:phabricator-plugin-common</include>
</includes>
<binaries>
<outputDirectory>server</outputDirectory>
<unpack>false</unpack>
<dependencySets>
<dependencySet>
<includes>
<include>*</include>
</includes>
</dependencySet>
</dependencySets>
</binaries>
</moduleSet>
</moduleSets>
</assembly>

View file

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<project 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>phabricator-plugin</artifactId>
<groupId>uk.xlab.teamcity.phabricator</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>build</artifactId>
<packaging>pom</packaging>
<properties>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<teamcity.phabricator-plugin.plugin.version>snapshot-${maven.build.timestamp}</teamcity.phabricator-plugin.plugin.version>
<teamcity.phabricator-plugin.plugin.vendorName>Plugin vendor name</teamcity.phabricator-plugin.plugin.vendorName>
<teamcity.phabricator-plugin.plugin.vendorUrl>Plugin vendor URL</teamcity.phabricator-plugin.plugin.vendorUrl>
</properties>
<dependencies>
<dependency>
<groupId>uk.xlab.teamcity.phabricator</groupId>
<artifactId>phabricator-plugin-agent</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>uk.xlab.teamcity.phabricator</groupId>
<artifactId>phabricator-plugin-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>uk.xlab.teamcity.phabricator</groupId>
<artifactId>phabricator-plugin-server</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>${basedir}/../teamcity-plugin.xml</file>
<outputFile>${basedir}/target/teamcity-plugin.xml</outputFile>
<replacements>
<replacement>
<token>@Version@</token>
<value>${teamcity.phabricator-plugin.plugin.version}</value>
</replacement>
<replacement>
<token>@VendorName@</token>
<value>${teamcity.phabricator-plugin.plugin.vendorName}</value>
</replacement>
<replacement>
<token>@VendorURL@</token>
<value>${teamcity.phabricator-plugin.plugin.vendorUrl}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>make-agent-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>phabricator-plugin-agent</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>plugin-agent-assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>phabricator-plugin</finalName>
<outputDirectory>${project.parent.build.directory}</outputDirectory>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>plugin-assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>phabricator-plugin</artifactId>
<groupId>uk.xlab.teamcity.phabricator</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>phabricator-plugin-agent</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>uk.xlab.teamcity.phabricator</groupId>
<artifactId>phabricator-plugin-common</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>agent-api</artifactId>
<version>${teamcity-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>tests-support</artifactId>
<version>${teamcity-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,4 @@
package uk.xlab.teamcity.phabricator;
public class AppAgent {
}

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
default-autowire="constructor">
</beans>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<teamcity-agent-plugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:shemas-jetbrains-com:teamcity-agent-plugin-v1-xml">
<plugin-deployment use-separate-classloader="true"/>
</teamcity-agent-plugin>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>phabricator-plugin</artifactId>
<groupId>uk.xlab.teamcity.phabricator</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>phabricator-plugin-common</artifactId>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,4 @@
package uk.xlab.teamcity.phabricator;
public class AppCommon {
}

View file

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<project 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>phabricator-plugin</artifactId>
<groupId>uk.xlab.teamcity.phabricator</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>phabricator-plugin-server</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>uk.xlab.teamcity.phabricator</groupId>
<artifactId>phabricator-plugin-common</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>server-api</artifactId>
<version>${teamcity-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>server-web-api</artifactId>
<version>${teamcity-version}</version>
<type>war</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>tests-support</artifactId>
<version>${teamcity-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,4 @@
package uk.xlab.teamcity.phabricator;
public class AppServer {
}

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
default-autowire="constructor">
</beans>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>uk.xlab.teamcity.phabricator</groupId>
<artifactId>phabricator-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<teamcity-version>2019.1</teamcity-version>
</properties>
<repositories>
<repository>
<id>JetBrains</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>JetBrains</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>teamcity-sdk-maven-plugin</artifactId>
<version>0.4</version>
<configuration>
<!-- <teamcityDir>/path/to/tc/distro</teamcityDir> -->
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>teamcity-sdk-maven-plugin</artifactId>
<version>0.4</version>
<configuration>
<!-- <teamcityDir>/path/to/tc/distro</teamcityDir> -->
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<modules>
<module>phabricator-plugin-server</module>
<module>phabricator-plugin-agent</module>
<module>phabricator-plugin-common</module>
<module>build</module>
</modules>
</project>

View file

@ -0,0 +1,13 @@
TeamCity plugin
This is an empty project to develop TeamCity plugin.
1. Implement
This project contains 3 modules: '<artifactId>-server', '<artifactId>-agent' and '<artifactId>-common'. They will contain code for server and agent parts of your plugin and a common part, available for both (agent and server). When implementing components for server and agent parts, do not forget to update spring context files under 'main/resources/META-INF'. Otherwise your compoment may be not loaded. See TeamCity documentation for details on plugin development.
2. Build
Issue 'mvn package' command from the root project to build your plugin. Resulting package <artifactId>.zip will be placed in 'target' directory.
3. Install
To install the plugin, put zip archive to 'plugins' dir under TeamCity data directory. If you only changed agent-side code of your plugin, the upgrade will be perfomed 'on the fly' (agents will upgrade when idle). If common or server-side code has changed, restart the server.

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<teamcity-plugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:schemas-jetbrains-com:teamcity-plugin-v1-xml">
<info>
<name>phabricator-plugin</name>
<display-name>phabricator-plugin</display-name>
<version>@Version@</version>
<description>Plugin description</description>
<download-url>Plugin download URL</download-url>
<email>Plugin author e-mail</email>
<vendor>
<name>@VendorName@</name>
<url>@VendorURL@</url>
<logo>Plugin vendor logo URL</logo>
</vendor>
</info>
<deployment use-separate-classloader="true"/>
</teamcity-plugin>