https://github.com/yandex-qatools/teamcity-openstack-plugin
Teamcity plugin to add openstack integration
https://github.com/yandex-qatools/teamcity-openstack-plugin
Last synced: 5 months ago
JSON representation
Teamcity plugin to add openstack integration
- Host: GitHub
- URL: https://github.com/yandex-qatools/teamcity-openstack-plugin
- Owner: yandex-qatools
- License: other
- Created: 2014-07-30T11:20:25.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2022-12-14T20:53:52.000Z (almost 3 years ago)
- Last Synced: 2025-04-08T15:49:36.698Z (6 months ago)
- Language: Java
- Homepage:
- Size: 209 KB
- Stars: 25
- Watchers: 9
- Forks: 24
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://teamcity.jetbrains.com/viewType.html?buildTypeId=TeamCityThirdPartyPlugins_OpenStackCloudSupport_BuildSnapshotIntegration) [](https://sonarcloud.io/dashboard?id=jetbrains.buildServer.clouds:cloud-openstack)
# TeamCity Cloud Openstack plugin
## Download
| Releases | Snapshot (last) | Compatibility |
|---|---|---|
| [Download](https://teamcity.jetbrains.com/viewType.html?buildTypeId=TeamCityThirdPartyPlugins_OpenStackCloudSupport_Release) | [Download](https://teamcity.jetbrains.com/repository/download/TeamCityThirdPartyPlugins_OpenStackCloudSupport_BuildSnapshotIntegration/.lastSuccessful/cloud-openstack.zip?guest=1) | TeamCity 10+ |## Agent Configuration
1. create one or more Openstack machines
2. install a standard TeamCity build agent on them, you only need to fill TEAMCITY_SERVER_URL
WARNING: you shouldn't start build agent while preparing image
3. create images from machines with installed agent.## Server Configuration
Fill cloud config with your openstack-instance parameters.
Configuration example:
Once you have created a cloud profile in TeamCity with one or several images, TeamCity does a test start for all the new images to discover the environment of the build agents configured on them.
If for a queued build there are no regular non-cloud agents available, TeamCity will find a matching cloud image with a compatible agent and start a new instance for the image. After that, a virtual agent acts as a regular agent.
You can specify idle time on the agent cloud profile, after which the instance should be terminated or stopped, in case you have an EBS-based instance.
### Agent images YAML parameters
| **Property** | **Required** | **Description** |
|---------------------|--------------|-----------------|
| *image* | true | [Image](https://docs.openstack.org/glance/latest/admin/manage-images.html), ex: `ubuntu_16.04` |
| *flavor* | true | [Flavor](https://docs.openstack.org/horizon/latest/admin/manage-flavors.html), ex: `m1.medium` |
| *network* | true | [Network](https://developer.openstack.org/api-ref/network/v2/index.html#general-api-overview), ex: `VLAN` |
| *security_group* | true | [Security group](https://docs.openstack.org/nova/latest/admin/security-groups.html), ex: `default` |
| *key_pair* | false | [Key pair](https://docs.openstack.org/horizon/latest/user/configure-access-and-security-for-instances.html), ex: `my-key` ; required for SSH connection on created instances (like TeamCity Agent Push feature) |
| *auto_floating_ip* | false | Boolean (`false` by default) for [floating ip](https://docs.openstack.org/ocata/user-guide/cli-manage-ip-addresses.html) association ; first from pool used |
| *user_script* | false | Script executed on instance start |
| *availability_zone* | false | Region for server instance (if not the global configured)
### OpenStack v2 Identity
The *Identity* defines the tenant/project and username, like: `tenant:user`
### OpenStack v3 Identity
The *Identity* defines at minimum the *tenant* and *user* informations, but could in addition defines the *domain(s)* of each items. In this case, only [project-scope](https://docs.openstack.org/keystone/queens/api_curl_examples.html#project-scoped) is supported.
The Identity is a 2-4 blocks string in this order: `[domain_tenant:]tenant:[domain_user:]user` (Warning: Priority given to *domain_user* for a 3 blocks strings).
#### Samples
Below some samples from *Identity* field to JSon produced on https://openstack.hostname.com/v3/auth/tokens URL.
##### myTenant:foo
```
{"auth":{"identity":{"methods":["password"],"password":{"user":{"name":"foo","domain":{},"password":"***"}}},"scope":{"project":{"name":"myTenant","domain":{}}}}}
```
##### myTenant:ldap:foo
NB: *domain_user* is used for both domains.
```
{"auth":{"identity":{"methods":["password"],"password":{"user":{"name":"foo","domain":{"name":"ldap"},"password":"***"}}},"scope":{"project":{"name":"myTenant","domain":{"name":"ldap"}}}}}
```
##### myTenantDomain:myTenant:ldap:foo
```
{"auth":{"identity":{"methods":["password"],"password":{"user":{"name":"foo","domain":{"name":"ldap"},"password":"***"}}},"scope":{"project":{"name":"myTenant","domain":{"name":"myTenantDomain"}}}}}
```
### Update status and restore instances delays
Some properties can be overridden to customize default plugin behavior, in `internal.properties` or TeamCity UI (*Administration > Diagnostics > Internal Properties*).
```
# Delay (in seconds) to execute recurrent instances update status
openstack.status.delay = 10
# Delay (in seconds) to execute first instances update status, after image profile creation or update
openstack.status.initial = 5
# Delay (in seconds) to execute restore instances, after image profile creation or update
openstack.restore.delay = 1
```
## Usage
Use Openstack virtual agents as regular build agents
### Metadata disable
With this plugin, any TeamCity agent on an Openstack virtual machine retrieves its information from `http://169.254.169.254/openstack/latest/meta_data.json` (uuid, name, user datas).
If you want disable this metadata usage, please add in agent configuration file (`buildAgent.properties`):
```
clouds.openstack.metadata.disable = true
```
This usage is mainly designed for instantiate some TeamCity agent(s) on an Openstack virtual machine as a classic way (name defined in configuration file, ...), without they are in cloud profile.
## Build and Tests
1. clone current repository to your local computer
2. Provides 4 test files in *server* classpath (ex: `cloud-openstack-server/src/test/resources`) with content:
```
# File: test.v3.properties
test.url=https://openstack.company.com/v3
test.identity=domain_tenant:tenant:domain_user:user
test.password=foobar
test.region=region1
```
```
# File: test.v3.yml
openstack-test-teamcity-plugin:
image: anyImage
flavor: m1.small
network: networkProviderName
security_group: default
key_pair: yourKey
```
```
# File: test.v2.properties
test.url=https://openstack.company.com/v2.0
test.identity=tenant:user
test.password=foobar
test.region=region1
```
```
# File: test.v2.yml
openstack-test-teamcity-plugin:
image: anyImage
flavor: m1.small
network: networkProviderName
security_group: default
key_pair: yourKey
```
3. run `mvn clean package` (if OpenStack test endpoint requires trustStore certificate not in JVM used for test, add `-Djavax.net.ssl.trustStore=/path/to/cacerts`)
4. install resulted *cloud-openstack.zip* plugin file to TeamCity server
## Release process
Execute locally:
```
# git clone and provide test files (see previous "Build and Tests" section)
git fetch origin
git reset --hard origin/master
mvn -B clean release:clean release:prepare -Dusername=yourGitHubLogin -Dpassword=yourGitHubPasswordOrToken
```
And TeamCity [Release build](https://teamcity.jetbrains.com/viewType.html?buildTypeId=TeamCityThirdPartyPlugins_OpenStackCloudSupport_Release) will be executed.