{"id":15854235,"url":"https://github.com/budtmo/jenkins","last_synced_at":"2025-07-06T22:34:15.471Z","repository":{"id":110173715,"uuid":"68305265","full_name":"budtmo/jenkins","owner":"budtmo","description":"jenkins and its node in docker solution","archived":false,"fork":false,"pushed_at":"2021-08-10T08:41:34.000Z","size":384,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-07T12:29:50.189Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/budtmo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-15T15:15:18.000Z","updated_at":"2021-08-10T08:41:37.000Z","dependencies_parsed_at":"2023-04-03T11:33:12.463Z","dependency_job_id":null,"html_url":"https://github.com/budtmo/jenkins","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/budtmo%2Fjenkins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/budtmo%2Fjenkins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/budtmo%2Fjenkins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/budtmo%2Fjenkins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/budtmo","download_url":"https://codeload.github.com/budtmo/jenkins/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246696241,"owners_count":20819426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-05T19:41:15.392Z","updated_at":"2025-04-01T18:51:06.066Z","avatar_url":"https://github.com/budtmo.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"Docker Jenkins\n==============\nThis project shows how to run Jenkins master and slave(s) in Docker solution.\n\nRequirements\n------------\n1. Docker\n\nStart Jenkins Master\n--------------------\n1. Run Jenkins machine through docker-compose\n\t\n\t```\n\t$docker-compose up\n\t```\n\n2. Open ***http://docker-host-ip-address:8080*** from web browser.\n\n**If you run this docker-jenkins for the first time, please do this step to be able to create first admin account:**\n\nRead and copy the initial admin password from the logs and paste it in the Getting started page\n\nJenkins node by demand with docker\n----------------------------------\n\nYou are able to have a Jenkins slave(s) / node(s) on demand through docker.\n\n1. Enable Docker Engine API on the machine which has Docker installed. Example steps on Ubuntu 16.04:\n\n\t```\n\tsudo nano /lib/systemd/system/docker.service\n\tReplace with -\u003e ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:4243\n\tsudo systemctl daemon-reload\n\tsudo systemctl restart docker\n\tcurl http://localhost:4243/version\n\t```\n\n2. Install [Docker plugin](http://wiki.jenkins-ci.org/display/JENKINS/Docker+Plugin) in Jenkins (under Manage Jenkins -\u003e Manage Plugins)\n\n3. Configure the connection between jenkins master and Docker machine (under Manage Jenkins -\u003e Configure System -\u003e Cloud). Sample configuration:\n\n\t```\n\tName: cloud1\n\tDocker Host URI: tcp://xxx.xxx.xxx.xxx:xxx\n\tEnabled: true\n\t```\n\n4. Configure Docker agent template in the same page. Sample configuration:\n\t\n\t```\n\tLabel: java\n\tEnabled: true\n\tName: docker-openjdk\n\tDockerImage: openjdk\n\tConnect method: Attach Docker container\n\tPull strategy: Pull all images every time\n\t```\n\n5. Based on above configuration, you can create a job with option \"Restrict where this project can be run: java\"\n\nJenkins node by demand with kubernetes\n--------------------------------------\n\nYou are able to have a Jenkins slave(s) / node(s) on demand through kubernetes but you need to have kubernetes cluster ready before.\n\n1. You need to create jenkins namespace and needed components like ServiceAccount and RoleBinding (run the following command on k8s master node), you need to run [jenkins-cluster.yml](jenkins-cluster.yml)\n\t\n\t```\n\tkubectl apply -f my-jenkins.yml\n\t```\n\n\n2. Copy token of created service account:\n\t\n\t```\n\tkubectl describe secret $(kubectl describe serviceaccount jenkins-user --namespace=jenkins-cluster | grep Token | awk '{print $2}') --namespace=jenkins-cluster\n\t```\n\n3. Get the url of kubernetes master (you need to run the command on k8s master node): \n\n\t```\n\tkubectl cluster-info\n\t```\n\n4. Install [Kubernetes plugin](https://plugins.jenkins.io/kubernetes/)\n\n5. Create secret text by going to manage jenkins -\u003e manage credentials -\u003e press one item of the \"store\" e.g. \"jenkins\" -\u003e \"global credentials\" -\u003e \"add credentials\" -\u003e choose \"system\" and paste the output from step 2 to \"secret\" field\n\n6. Configure the connection between jenkins master and kubernetes cluster (under Manage Jenkins -\u003e Configure System -\u003e Cloud). Sample configuration:\n\t\n\t```\n\tName: team-k8s\n\tKubernetes cluster: https://xx.xx.xx.xx:6443 (you get this from step 2)\n\tDisable https certificate check: marked\n\tKubernetes Namespace: jenkins-cluster\n\tCredentials: xxx (choose the credentials id from step 4)\n\tDirect Connection: marked\n\n\tand press \"Test Connection\"\n\n\t```\n\n7. Continue to configure the Pod template (it is on the same page) if the connection is successfull:\n\n\t```\n\tName: k8s-java-openjdk\n\tNamespace: jenkins-cluster\n\tLabel: k8s-java-pod\n\tContainers:\n\t\tName: k8s-java-container\n\t\tDocker image: openjdk\n\tImagePullSecrets:\n\t\tName: xxx (optional)\n\tNode Selector: kubernetes.io/hostname=node1 -\u003e you can get through kubectl get node --show-labels\n\t```\n\n8. On pipeline script you need to specify the node and the container name, example:\n\n\t```\n\tnode('k8s-java-pod') {\n\t\t// do something if needed\n\n\t\tconainer('k8s-java-container') {\n\t\t\t// do something here\n\t\t}\n\t}\n\t```\n\n\n\nAdditional information\n----------------------\n\n1. [List of Docker images](node) that can be used as Jenkins slave / node\n\n2. [Sample of using in Jenkins pipeline](pipeline)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbudtmo%2Fjenkins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbudtmo%2Fjenkins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbudtmo%2Fjenkins/lists"}