-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref(12): Jenkins on Docker and CasC configuration
- Loading branch information
1 parent
16542d8
commit 6f6b222
Showing
2 changed files
with
68 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,70 @@ | ||
# Automate Jenkins Installation on Docker for Testing | ||
# Automated Jenkins Installation on Docker for Testing with Kubernetes Integration | ||
|
||
## Prerequisites | ||
|
||
- Docker must be installed. | ||
- Kubernetes must be installed. | ||
|
||
## Installation | ||
|
||
To set up a new Jenkins instance, execute the following command: | ||
```bash | ||
./test/jenkins/install.sh | ||
``` | ||
|
||
## Testing | ||
|
||
Follow these steps to test the Kubernetes integration: | ||
|
||
1. Create a pipeline named `test-kubernetes-agent`. | ||
2. Insert the provided pipeline definition script: | ||
|
||
```groovy | ||
pipeline { | ||
agent { | ||
kubernetes { | ||
yaml ''' | ||
apiVersion: v1 | ||
kind: Pod | ||
spec: | ||
containers: | ||
- name: maven | ||
image: maven:alpine | ||
command: | ||
- cat | ||
tty: true | ||
- name: node | ||
image: node:16-alpine3.12 | ||
command: | ||
- cat | ||
tty: true | ||
''' | ||
} | ||
} | ||
stages { | ||
stage('Run maven') { | ||
steps { | ||
container('maven') { | ||
sh 'mvn -version' | ||
} | ||
container('node') { | ||
sh 'npm version' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
3. Execute the pipeline; two agents should be deployed on the Kubernetes cluster. | ||
|
||
## References | ||
|
||
- https://www.digitalocean.com/community/tutorials/how-to-automate-jenkins-setup-with-docker-and-jenkins-configuration-as-code | ||
- https://github.com/abrahamNtd/poc-jenkins-jcasc | ||
- https://github.com/jenkinsci/configuration-as-code-plugin/tree/master/demos | ||
- https://www.youtube.com/watch?v=ZXaorni-icg | ||
- [Automating Jenkins Setup with Docker and Jenkins Configuration as Code](https://www.digitalocean.com/community/tutorials/how-to-automate-jenkins-setup-with-docker-and-jenkins-configuration-as-code) | ||
- [GitHub - Jenkins Configuration as Code Plugin Demos](https://github.com/jenkinsci/configuration-as-code-plugin/tree/master/demos) | ||
- [YouTube - Automated Jenkins Setup using Docker and Configuration as Code](https://www.youtube.com/watch?v=ZXaorni-icg) | ||
- [GitHub Gist - Kubernetes Cluster Info Command](https://gist.github.com/darinpope/67c297b3ccc04c17991b22e1422df45a) | ||
|
||
## Commands | ||
## Useful Commands | ||
|
||
- `kubectl cluster-info`: get infos on kubernetes cluster almost the Kubernetes control plane address: https://kubernetes.docker.internal:6443 | ||
- `kubectl cluster-info`: Retrieve information about the Kubernetes cluster, including the Kubernetes control plane address (e.g., https://kubernetes.docker.internal:6443). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters