Jenkins is a tool for automating build, testing and deployment of projects. To acquire access to it create a ticket in helpdesk containing:
The system is available at https://jenkins.wmi.amu.edu.pl. Domain credentials are used (like in the laboratories).
It's possible to link Jenkins with our Git system. In order to achieve this both Jenkins and the repository has to be configured.
very long string
adres SSH repozytorium
(e.g. git@git.wmi.amu.edu.pl:s123456/project.git)HTTPS repository address
(without the ending '.git') (e.g. https://git.wmi.amu.edu.pl/s123456/project)In the Git repository configuration:
https://jenkins.wmi.amu.edu.pl/gogs-webhook/?job=PIPELINE-NAME
(e.g. https://jenkins.wmi.amu.edu.pl/gogs-webhook/?job=s123456-project)very long string from Jenkins configuration
jenkins
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOuVvhUjr+UosOx3IEBUi0IfV8Erv2OL3Er5pUHbjxNo
It's possible to add SSH connection support from the Jenkins pipeline. A common usage would be copying of a built and tested application version, and performing actions on the remote server, for example restarting the WWW service.
The public SSH key used by Jenkins for external SSH connections:
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKRso2eJ1wXHqD83Ii8Qem0kDWY5sCFVS6OczBpOPT+66nvOt5Z0VNajjZLkA5BXh0ZoZ+RqDQdi4JMndPvcEwY= jenkins-ssh-external
To activate the SSH function create a ticket in helpdesk containing:
You will receive a SSH configuration name that will be required in the project Jenkinsfile
in accordance to the codumentation.
Jenkinsfile
implementationThe section below will transfer build.tar.gz
to the target SSH server:
stage('SSH-publish') {
steps {
sshPublisher(
continueOnError: false,
failOnError: true,
publishers: [
sshPublisherDesc(
configName: "CONFIGURATION_NAME_RECEIVED_FROM_HELPDESK",
transfers: [sshTransfer(sourceFiles: 'build.tar.gz')],
verbose: true
)
]
)
}
}
The section below will delete build.tar.gz
on the remote SSH server:
stage('SSH-exec') {
steps {
sshPublisher(
continueOnError: false,
failOnError: true,
publishers: [
sshPublisherDesc(
configName: "CONFIGURATION_NAME_RECEIVED_FROM_HELPDESK",
transfers: [sshTransfer(execCommand: 'rm build.tar.gz')],
verbose: true
)
]
)
}
}