{"id":20113251,"url":"https://github.com/cloudacademy/jenkins-cicd-intro","last_synced_at":"2025-10-06T02:10:42.712Z","repository":{"id":62396961,"uuid":"309545416","full_name":"cloudacademy/jenkins-cicd-intro","owner":"cloudacademy","description":"Jenkins CICD Introduction Demo Code and Configs","archived":false,"fork":false,"pushed_at":"2020-11-03T05:25:33.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":27,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-06T11:35:35.192Z","etag":null,"topics":["cicd","cloudacademy","devops","jenkins","pipeline"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudacademy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-03T02:02:31.000Z","updated_at":"2024-09-10T03:13:41.000Z","dependencies_parsed_at":"2022-11-01T06:00:42.331Z","dependency_job_id":null,"html_url":"https://github.com/cloudacademy/jenkins-cicd-intro","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cloudacademy/jenkins-cicd-intro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fjenkins-cicd-intro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fjenkins-cicd-intro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fjenkins-cicd-intro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fjenkins-cicd-intro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudacademy","download_url":"https://codeload.github.com/cloudacademy/jenkins-cicd-intro/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fjenkins-cicd-intro/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263636464,"owners_count":23492267,"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":["cicd","cloudacademy","devops","jenkins","pipeline"],"created_at":"2024-11-13T18:23:35.448Z","updated_at":"2025-10-06T02:10:37.680Z","avatar_url":"https://github.com/cloudacademy.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jenkins CICD Introduction Demo Code and Configs\n\nContains Jenkins code and configuration examples as used within the [Introduction to CI/CD with Jenkins](https://cloudacademy.com/course/jenkins-cicd/build-pipelines-declarative) course.\n\n## Demo 4: Install Jenkins - EC2 Ubuntu\n\nInstall intructions for Ubuntu 18.04\n\n```\nsudo -s\napt-get update\napt-get install -y openjdk-8-jdk\njava -version\nwget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -\nsh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ \u003e /etc/apt/sources.list.d/jenkins.list'\napt-get update\napt-get install -y jenkins\n```\n\n```\nsystemctl status jenkins\nps -ef | grep jenkins  \nufw status\nufw allow 8080\n```\n\n```\ncat /var/lib/jenkins/secrets/initialAdminPassword\n```\n\n## Demo 5: Install Jenkins - Docker Compose\n\n```\nmkdir jenkins-docker\ncd jenkins-docker\n```\n\n```\ndocker network create -d bridge devnetwork\n```\n\ndocker-compose.yml\n\n```\nversion: \"3.5\"\nservices:\n    jenkins:\n        container_name: jenkins-docker\n        image: jenkins/jenkins:lts\n        ports:\n            - 8080:8080\n        networks:\n            - devnetwork\nnetworks:\n    devnetwork:\n        name: devnetwork\n```\n\n```\ndocker-compose config\n```\n\n```\ndocker-compose up -d \u0026\u0026 docker-compose logs -f\n```\n\n```\ndocker ps\n```\n\n```\ndocker exec -it jenkins-docker bash\n```\n\n```\ndocker exec -it jenkins-docker /var/lib/jenkins_home/secrets/initialAdminPassword \n```\n\n## Demo 6: Create Basic Freestyle Project\n\nUI instructions only\n\n## Demo 7: Create Basic Freestyle Project\n\nUI instructions only\n\n## Demo 8: Building a GitHub Stored Project\n\nRefs\nhttps://github.com/cloudacademy/react-webapp\n\nNotes: \n* this demo assumes ```yarn``` (1.22.x) and ```node``` (8.x) have already been installed and is available on the host that the Jenkins service is running on.\n* ```node``` version 8.x is required for the ```yarn build``` to complete successfully\n\n### Install and Setup yarn and node locally (MacOS)\n\nIf you are running Jenkins locally on MacOS then perform the following instructions to install ```yarn``` and ```node```\n\n```\nbrew install yarn\nyarn --version\nwhich yarn\n```\n\n```\nbrew install n\nsudo n 8.10.0\nnode --version\nwhich node\n```\n\n### Jenkins Script\n\nUpdate the PATH and preappend ```/usr/local/bin``` to it - so that ```yarn``` can be found by the Jenkins service when the build is executed\n\n```\nPATH=/usr/local/bin:$PATH\necho $PATH\nyarn --version\nnode --version\nyarn install\nyarn build\nls -la\necho finished!!\n```\n\n## Demo 9: Build Triggers with GitHub Hooks\n\nDocumentation\nhttps://api.github.com/meta\n\nRefs\nhttps://github.com/cloudacademy/react-webapp\n\n## Demo 13: Build Pipelines - Maven\n\nUses provided sample pipeline within the Jenkins UI\n\n## Demo 14: Build Pipelines - Scripted\n\n```\ndef int fibonacci(int n){\n    n \u003c 2 ? n : fibonacci(n-1) + fibonacci(n-2)\n}\n\nnode{\n    def workspace = pwd()\n    echo \"workspace = ${workspace}\"\n\n    def nine = 9\n    def ten = nine + 1\n\n    stage('Calculate'){\n        try{\n            if(ten \u003e nine){\n                echo \"${fibonacci(ten)}\"\n                sh returnStdout: true, script: 'script-which-doesnt-exist.sh'\n            }\n        }\n        catch(exc){\n            echo \"some exception just happened!!\" \n        }\n\n    }\n}\n```\n\n## Demo 15: Build Pipelines - Gradle\n\nRefs\nhttps://github.com/cloudacademy/devops-webapp\n\nWebsite\nhttps://crontab.guru/\n\n```\nH/5 * * * *\n```\n\n```\n//START-OF-SCRIPT\nnode {\n    def GRADLE_HOME = tool name: 'gradle-4.10.2', type: 'hudson.plugins.gradle.GradleInstallation'\n    sh \"${GRADLE_HOME}/bin/gradle tasks\"\n\n    stage('Clone') {\n        git url: 'https://github.com/cloudacademy/devops-webapp.git'\n    }\n\n    stage('Build') {\n        sh \"${GRADLE_HOME}/bin/gradle build\"\n    }\n\n    stage('Archive') {\n        archiveArtifacts 'build/libs/*.war'\n    }\n}\n//END-OF-SCRIPT\n```\n\n```\nsudo apt-get install -y tree\ncd /var/lib/jenkins/workspace/BuildJob6\nls -la\ncd build\ntree\n```\n\n====================\n\n## Demo 16: Build Pipelines - Declarative\n\nRefs\nhttps://github.com/cloudacademy/devops-webapp\n\n```\npipeline {\n    agent {\n        label 'master'\n    }\n    tools {\n        gradle 'gradle-4.10.2'\n    }\n    environment {\n        VERSION = \"jellybean\"\n    }\n    stages{\n        stage('Checkout') {\n            steps {\n                checkout([$class: 'GitSCM',\n                    branches: [[name: 'master']],\n                    extenstions: [[$class: 'WipeWorkspace']],\n                    userRemoteConfigs: [[url: 'https://github.com/cloudacademy/devops-webapp.git']]\n\n                ])\n            }\n        }\n        stage('Details') {\n            steps {\n                echo \"Running ${env.BUILD_ID} on ${env.JENKINS_URL}\"\n                echo \"${env.VERSION}\"\n            }\n\n            when {\n                environment name: 'VERSION', value: 'jellybean'\n            }\n        }\n        stage('Build') {\n            steps {\n                sh \"gradle build\"\n            }\n        }\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudacademy%2Fjenkins-cicd-intro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudacademy%2Fjenkins-cicd-intro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudacademy%2Fjenkins-cicd-intro/lists"}