diff --git a/15Nov24.md b/15Nov24.md new file mode 100644 index 00000000..ed90e6f3 --- /dev/null +++ b/15Nov24.md @@ -0,0 +1,2 @@ +*test 15Nov24** +webhook test diff --git a/README.md b/README.md index b8ad8a94..4a053217 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ +filename: README.md + Example Voting App ========= +This is a sample voting app. + Getting started --------------- @@ -57,4 +61,8 @@ Architecture Note ---- -The voting application only accepts one vote per client. It does not register votes if a vote has already been submitted from a client. + + + + + diff --git a/notes_repair_16Nov24.md b/notes_repair_16Nov24.md new file mode 100644 index 00000000..987f4b52 --- /dev/null +++ b/notes_repair_16Nov24.md @@ -0,0 +1,167 @@ +Sat Nov 16 09:46:06 EST 2024 + +http://34.48.26.32:8080/job/instavote/job/worker-pipe/job/master/3/console + ``` + Started by user admin + 15:07:59 Connecting to https://api.github.com using chilikm4n/****** + Obtained worker/Jenkinsfile from f85634240458a7a200a702176755ee2149e35bd8 + org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: + WorkflowScript: 3: Invalid agent type "docker" specified. Must be one of [any, label, none] @ line 3, column 8. + docker{ + ^ + + 1 error + + at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:309) + at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1107) + at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:624) + at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602) + at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579) + at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:323) + at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:293) + at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox$Scope.parse(GroovySandbox.java:163) + at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:190) + at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:175) + at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:652) + at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:598) + at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:335) + at hudson.model.ResourceController.execute(ResourceController.java:101) + at hudson.model.Executor.run(Executor.java:442) + + GitHub has been notified of this commit’s build result + + Finished: FAILURE + + ``` +**POTENTIAL SOLUTIONS**: +https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Fix-Jenkins-Invalid-agent-type-Docker-specified-any-label-none-error + - **MAIN POINTS**: missing... + - Jenkins Docker Plugin + - Jenkins Docker Pipeline plugini + + **INSTALLED** + - [x] Docker Pipeline 580.vc0c340686b_54 + - [x] Docker plugin 1.6.2 + + [ ] resolves issue? + + [x] feature/workpipe builds (#14) + - [ ] master: fail [x] attempt: (#4) + + [?] `Jenkinsfile` "Maven" => "maven" + - [x] attempted fail (#5) + - [x] check: `docker inspect -f . maven:3.9.8-sapmachine-21` + - [x] they both failed (#16/17) complaining about "Maven" + - [ ] attempt update master: get merge first + - [16Nov24 15:45] requires a pull request; pr made + - [x] pulled images maven:3.9.8; results still show not able to do + - [ ] change Dockerfile + - [ ] change Jenkinsfile + ``` + chilikm4n/LFS261-example-voting-app.git master + Enumerating objects: 8, done. + Counting objects: 100% (8/8), done. + Delta compression using up to 2 threads + Compressing objects: 100% (6/6), done. + Writing objects: 100% (6/6), 600 bytes | 600.00 KiB/s, done. + Total 6 (delta 4), reused 0 (delta 0), pack-reused 0 + remote: Resolving deltas: 100% (4/4), completed with 2 local objects. + remote: error: GH006: Protected branch update failed for refs/heads/master. + remote: + remote: - Changes must be made through a pull request. + To https://github.com/chilikm4n/LFS261-example-voting-app.git + ! [remote rejected] master -> master (protected branch hook declined) + error: failed to push some refs to 'https://github.com/chilikm4n/LFS261-example-voting-app.git' + + ``` + +____ + + ``` + avirtualrealitystory@ci-4nov24:~/06/lfx261/15Nov24a$ sudo docker inspect -f . mav + en:3.9.8-sapmachine-21 + Error: No such object: maven:3.9.8-sapmachine-21 + + ``` +____ + + ``` + Started by user admin + 15:21:52 Connecting to https://api.github.com using chilikm4n/****** + Obtained worker/Jenkinsfile from f85634240458a7a200a702176755ee2149e35bd8 + [Pipeline] Start of Pipeline + [Pipeline] node + Running on Jenkins in /var/jenkins_home/workspace/instavote_worker-pipe_master + [Pipeline] { + [Pipeline] stage + [Pipeline] { (Declarative: Checkout SCM) + [Pipeline] checkout + The recommended git tool is: NONE + using credential 7447b235-b3ee-4c12-b034-b133cb332a41 + Cloning the remote Git repository + Cloning with configured refspecs honoured and without tags + Cloning repository https://github.com/chilikm4n/LFS261-example-voting-app.git + > git init /var/jenkins_home/workspace/instavote_worker-pipe_master # timeout=10 + Fetching upstream changes from https://github.com/chilikm4n/LFS261-example-voting-app.git + > git --version # timeout=10 + > git --version # 'git version 2.39.2' + using GIT_ASKPASS to set credentials + > git fetch --no-tags --force --progress -- https://github.com/chilikm4n/LFS261-example-voting-app.git +refs/heads/master:refs/remotes/origin/master # timeout=10 + > git config remote.origin.url https://github.com/chilikm4n/LFS261-example-voting-app.git # timeout=10 + > git config --add remote.origin.fetch +refs/heads/master:refs/remotes/origin/master # timeout=10 + Avoid second fetch + Checking out Revision f85634240458a7a200a702176755ee2149e35bd8 (master) + > git config core.sparsecheckout # timeout=10 + > git checkout -f f85634240458a7a200a702176755ee2149e35bd8 # timeout=10 + Commit message: "Merge pull request #1 from chilikm4n/readme" + First time build. Skipping changelog. + [Pipeline] } + [Pipeline] // stage + [Pipeline] withEnv + [Pipeline] { + [Pipeline] isUnix + [Pipeline] withEnv + [Pipeline] { + [Pipeline] sh + + docker inspect -f . maven:3.9.8-sapmachine-21 + + error during connect: Get "https://docker:2376/v1.47/containers/maven:3.9.8-sapmachine-21/json": dial tcp: lookup docker on 127.0.0.11:53: server misbehaving + [Pipeline] isUnix + [Pipeline] withEnv + [Pipeline] { + [Pipeline] sh + + docker pull maven:3.9.8-sapmachine-21 + error during connect: Post "https://docker:2376/v1.47/images/create?fromImage=maven&tag=3.9.8-sapmachine-21": dial tcp: lookup docker on 127.0.0.11:53: server misbehaving + [Pipeline] } + [Pipeline] // withEnv + [Pipeline] } + [Pipeline] // withEnv + [Pipeline] } + [Pipeline] // withEnv + [Pipeline] } + [Pipeline] // node + [Pipeline] stage + [Pipeline] { (Declarative: Post Actions) + [Pipeline] echo + the job is complete + [Pipeline] } + [Pipeline] // stage + [Pipeline] End of Pipeline + ERROR: script returned exit code 1 + + GitHub has been notified of this commit’s build result + + Finished: FAILURE + + ``` + + +____ ++ [x] determine where to revert back to + - lab7-1:p10 ++ [x] create repair branch ++ [x] git directory to push: this directory + - contains commits from the lab + - the only main differences between each directories were the: + - Jenkinsfile(s) + - README.md + - All other files were alike +*to the best of my knowledge* ++ [x] Jenkins setup already done ++ [x] git setup already done diff --git a/result/Jenkinsfile b/result/Jenkinsfile new file mode 100644 index 00000000..9ae542e2 --- /dev/null +++ b/result/Jenkinsfile @@ -0,0 +1,34 @@ +pipeline { + agent any + + tools{ + nodejs 'NodeJS 22.4.0' + } + + stages{ + stage(build){ + when{ + changeset "**/result**" + } + steps{ + echo 'Compiling result app..' + dir('worker'){ + sh 'npm install' + } + } + } + stage(test){ + when{ + changeset "**/result/**" + } + steps{ + echo 'Running Unit Tests on results app..' + dir('result'){ + sh 'npm install' + sh 'npm test' + } + } + } + } + +} diff --git a/worker/Dockerfile b/worker/Dockerfile index 2b152eab..250a3df5 100644 --- a/worker/Dockerfile +++ b/worker/Dockerfile @@ -1,4 +1,4 @@ -FROM maven:3.9.8-sapmachine-21 +FROM maven:3.9.8 WORKDIR /app COPY . . RUN mvn package && \ diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index b66016b2..ba59dc25 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -1,41 +1,43 @@ -pipeline { - agent{ - docker{ - image 'maven:3.9.8-sapmachine-21' - args '-v $HOME/.m2:/root/.m2' - } - } - stages{ - stage('build'){ - steps{ - echo 'building worker app' - dir('worker'){ - sh 'mvn compile' - } - } - } - stage('test'){ - steps{ - echo 'running unit tests on worker app' - dir('worker'){ - sh 'mvn clean test' - } - } - } - stage('package'){ - steps{ - echo 'packaging worker app into a jarfile' - dir('worker'){ - sh 'mvn package -DskipTests' - archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true - } - } - } +pipeline { + agent any + + tools{ + maven 'Maven 3.9.8' } - post{ - always{ - echo 'the job is complete' + stages{ + stage("build"){ + steps{ + echo 'Compiling worker app' + dir('worker'){ + sh 'mvn compile' + } + } + } + stage("test"){ + steps{ + echo 'Running Unit Test on worker app' + dir('worker'){ + sh 'mvn clean test' + } + } + } + + stage("package"){ + steps{ + echo 'Packaging worker app' + dir('worker'){ + sh 'mvn package -DskipTests' + } + } + } + } + post{ + always{ + archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true + + echo 'Building multibranch pipeline for worker is completed..' + } + } } - } -} + diff --git a/worker/Jenkinsfile_16Nov24p24State b/worker/Jenkinsfile_16Nov24p24State new file mode 100644 index 00000000..1dd2392f --- /dev/null +++ b/worker/Jenkinsfile_16Nov24p24State @@ -0,0 +1,43 @@ +pipeline { + agent any + + tools{ + maven 'Maven 3.9.8' + } + + stages{ + stage("build"){ + steps{ + echo 'Compiling worker app' + dir('worker'){ + sh 'mvn compile' + } + } + } + stage("test"){ + steps{ + echo 'Running Unit Test on worker app' + dir('worker'){ + sh 'mvn clean test' + } + } + } + + stage("package"){ + steps{ + echo 'Packaging worker app' + dir('worker'){ + sh 'mvn package -DskipTests' + } + } + } + } + post{ + always{ + archiveArtifactss artifacts: '**/target/*.jar', fingerprint: true + + echo 'Building multibranch pipeline for worker is completed..' + } + } + } + diff --git a/worker/Jenkinsfile_build b/worker/Jenkinsfile_build new file mode 100644 index 00000000..86b11cd3 --- /dev/null +++ b/worker/Jenkinsfile_build @@ -0,0 +1,34 @@ +pipeline { + agent any + + tools{ + maven 'maven 3.9.8' + } + + stages{ + stage("build"){ + steps{ + echo 'Compiling worker app' + dir('worker'){ + sh 'mvn compile' + } + } + } + stage("test"){ + steps{ + echo 'Running Unit Test on worker app' + } + + stage("packaging"){ + steps{ + echo 'Packaging worker app' + } + } + } + post{ + always{ + echo 'Building multibranch pipeline for worker is completed..' + } + } + } +} diff --git a/worker/Jenkinsfile_original b/worker/Jenkinsfile_original new file mode 100644 index 00000000..b66016b2 --- /dev/null +++ b/worker/Jenkinsfile_original @@ -0,0 +1,41 @@ +pipeline { + agent{ + docker{ + image 'maven:3.9.8-sapmachine-21' + args '-v $HOME/.m2:/root/.m2' + } + } + stages{ + stage('build'){ + steps{ + echo 'building worker app' + dir('worker'){ + sh 'mvn compile' + } + } + } + stage('test'){ + steps{ + echo 'running unit tests on worker app' + dir('worker'){ + sh 'mvn clean test' + } + } + } + stage('package'){ + steps{ + echo 'packaging worker app into a jarfile' + dir('worker'){ + sh 'mvn package -DskipTests' + archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true + } + } + } + } + post{ + always{ + echo 'the job is complete' + + } + } +} diff --git a/worker/README.md b/worker/README.md index 834be372..46451ca5 100644 --- a/worker/README.md +++ b/worker/README.md @@ -1,5 +1,5 @@ ## Worker Java App * Build Status -[![Build Status](http://35.197.102.152:8080/buildStatus/icon?job=job-01)](http://35.197.102.152:8080/job/job-01/) -[![Build Status](http://35.197.102.152:8080/buildStatus/icon?job=job-02&subject=UnitTest)](http://35.197.102.152:8080/job/job-02/) + +