The deployment system can also be used to provision a continuous integration environment. This includes a Jenkins CI server and a minimal set of Lasair components, such as a database and Kafka broker, that some of the integration tests will interact with.
To set up a basic CI server using a single instance:
-
Create an OpenStack instance (allow a reasonable ammount of memory and plenty of disk). Allocate a floating IP. Allocate and attach an additional volume for Kafka.
-
Configure DNS if required. Configure security groups to allow incoming traffic on port 80 and 443.
-
Install Ansible.
-
Clone this repository.
-
There are some configuration parameters in jenkins.yaml that you may need to edit.
-
Run the ci-init playbook to do some preliminary setup:
$ ansible-playbook ci-init.yaml
- Run the jenkins playbook to deploy a CI environment and Jenkins server:
$ ansible-playbook jenkins.yaml
-
Go to the to URL of your Jenkins server, e.g.
https://lasair-jenkins.lsst.ac.uk
-
Enter the one time password.
-
Install the suggested plugins when prompted.
-
Create an admin user when prompted.
-
Set the URL when prompted.
-
In Manage Jenkins | Configure System set the number of executors to 1 (integration tests will fail if two try to talk to Kafka at once).
- Docker
- Docker pipeline
- GitHub
In the Jenkins UI:
-
Create a new job.
-
Select "Multibranch pipeline".
-
Add GitHub credentials (create an access token in GitHub and use that).
-
Add the repository HTTPS URL, e.g.
https://github.com/lsst-uk/lasair4.git
-
Add the Clean after checkout behaviour.
-
In the Script Path, enter
tests/JenkinsFile
-
Go to the GitHub project. Click on the "Settings tab", then "Webhooks", the "Add Webhook".
-
The "Payload URL" is the URL of the Jenkins server plus "github-webhook/", e.g.
https://lasair-jenkins.lsst.ac.uk/github-webhook/
. Note the trailing slash. The "Content Type" should beapplication/json
. Other options and be left as default. -
Go back to Jenkins and trigger a manual build.
The job should now be configured to run whenever a push is made to the
Copyright 2022 The University of Edinburgh and Queen's University Belfast
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this code except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.