diff --git a/PRA05_ANSWER/Documentation.qmd b/PRA05_ANSWER/Documentation.qmd new file mode 100644 index 00000000..9d2cff2b --- /dev/null +++ b/PRA05_ANSWER/Documentation.qmd @@ -0,0 +1,13 @@ +Tasks +1. [x] Pull Jenkins Docker Image +2. [x] Build and Run Jenkins Container +3. [x] Configure Jenkins Account +4. [x] Install Basic Plugins +5. [x] Create a Pipeline for Spring Boot Project +6. [x] Ensure Docker is installed on the Jenkins server. +7. [x] Configure Docker permissions for the Jenkins user. +8. [x] Adjust the pipeline script according to your project structure and requirements. + + + + diff --git a/PRA05_ANSWER/install_docker-jenkins/addgroup-jenkins.png b/PRA05_ANSWER/install_docker-jenkins/addgroup-jenkins.png new file mode 100644 index 00000000..1e03ced3 Binary files /dev/null and b/PRA05_ANSWER/install_docker-jenkins/addgroup-jenkins.png differ diff --git a/PRA05_ANSWER/install_docker-jenkins/docker-root-jenkins.png b/PRA05_ANSWER/install_docker-jenkins/docker-root-jenkins.png new file mode 100644 index 00000000..dda8cf3a Binary files /dev/null and b/PRA05_ANSWER/install_docker-jenkins/docker-root-jenkins.png differ diff --git a/PRA05_ANSWER/install_docker-jenkins/jenkins-bash-installed_docker.png b/PRA05_ANSWER/install_docker-jenkins/jenkins-bash-installed_docker.png new file mode 100644 index 00000000..beab70d2 Binary files /dev/null and b/PRA05_ANSWER/install_docker-jenkins/jenkins-bash-installed_docker.png differ diff --git a/PRA05_ANSWER/install_docker-jenkins/jenkins-bash.png b/PRA05_ANSWER/install_docker-jenkins/jenkins-bash.png new file mode 100644 index 00000000..ce477682 Binary files /dev/null and b/PRA05_ANSWER/install_docker-jenkins/jenkins-bash.png differ diff --git a/PRA05_ANSWER/install_docker-jenkins/jenkins-bash2.png b/PRA05_ANSWER/install_docker-jenkins/jenkins-bash2.png new file mode 100644 index 00000000..d194d701 Binary files /dev/null and b/PRA05_ANSWER/install_docker-jenkins/jenkins-bash2.png differ diff --git a/PRA05_ANSWER/install_docker-jenkins/volume_privileged.png b/PRA05_ANSWER/install_docker-jenkins/volume_privileged.png new file mode 100644 index 00000000..ac00a748 Binary files /dev/null and b/PRA05_ANSWER/install_docker-jenkins/volume_privileged.png differ diff --git a/PRA05_ANSWER/install_jenkins/1-jenkins.png b/PRA05_ANSWER/install_jenkins/1-jenkins.png new file mode 100644 index 00000000..3f066b4d Binary files /dev/null and b/PRA05_ANSWER/install_jenkins/1-jenkins.png differ diff --git a/PRA05_ANSWER/install_jenkins/1-nano update de repo.png b/PRA05_ANSWER/install_jenkins/1-nano update de repo.png new file mode 100644 index 00000000..f5e5f97c Binary files /dev/null and b/PRA05_ANSWER/install_jenkins/1-nano update de repo.png differ diff --git a/PRA05_ANSWER/install_jenkins/2-jenkinsx2.png b/PRA05_ANSWER/install_jenkins/2-jenkinsx2.png new file mode 100644 index 00000000..bbe57c84 Binary files /dev/null and b/PRA05_ANSWER/install_jenkins/2-jenkinsx2.png differ diff --git a/PRA05_ANSWER/install_jenkins/2-replace _repo.png b/PRA05_ANSWER/install_jenkins/2-replace _repo.png new file mode 100644 index 00000000..d279ea5b Binary files /dev/null and b/PRA05_ANSWER/install_jenkins/2-replace _repo.png differ diff --git a/PRA05_ANSWER/install_jenkins/3-jenkins-pass.png b/PRA05_ANSWER/install_jenkins/3-jenkins-pass.png new file mode 100644 index 00000000..9da5f38d Binary files /dev/null and b/PRA05_ANSWER/install_jenkins/3-jenkins-pass.png differ diff --git a/PRA05_ANSWER/install_jenkins/3-update-intall.png b/PRA05_ANSWER/install_jenkins/3-update-intall.png new file mode 100644 index 00000000..e4c0f289 Binary files /dev/null and b/PRA05_ANSWER/install_jenkins/3-update-intall.png differ diff --git a/PRA05_ANSWER/install_jenkins/4-jenkins-plugin-installed.png b/PRA05_ANSWER/install_jenkins/4-jenkins-plugin-installed.png new file mode 100644 index 00000000..3ee8cb23 Binary files /dev/null and b/PRA05_ANSWER/install_jenkins/4-jenkins-plugin-installed.png differ diff --git a/PRA05_ANSWER/install_jenkins/4-run-hello-world.png b/PRA05_ANSWER/install_jenkins/4-run-hello-world.png new file mode 100644 index 00000000..c419af85 Binary files /dev/null and b/PRA05_ANSWER/install_jenkins/4-run-hello-world.png differ diff --git a/PRA05_ANSWER/install_jenkins/5-add-group.png b/PRA05_ANSWER/install_jenkins/5-add-group.png new file mode 100644 index 00000000..4a73decd Binary files /dev/null and b/PRA05_ANSWER/install_jenkins/5-add-group.png differ diff --git a/PRA05_ANSWER/install_jenkins/install.qmd b/PRA05_ANSWER/install_jenkins/install.qmd new file mode 100644 index 00000000..6ff21d12 --- /dev/null +++ b/PRA05_ANSWER/install_jenkins/install.qmd @@ -0,0 +1,3 @@ +### Issues' version +Our version is not supported for docker, +so we have to modify the repo to Jammy stable. diff --git a/PRA05_ANSWER/pipelines-success/5-jenkins-minipipe-ok.png b/PRA05_ANSWER/pipelines-success/5-jenkins-minipipe-ok.png new file mode 100644 index 00000000..817cb4f0 Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/5-jenkins-minipipe-ok.png differ diff --git a/PRA05_ANSWER/pipelines-success/Pipeline-executing/output.txt b/PRA05_ANSWER/pipelines-success/Pipeline-executing/output.txt new file mode 100644 index 00000000..ddd0f35e --- /dev/null +++ b/PRA05_ANSWER/pipelines-success/Pipeline-executing/output.txt @@ -0,0 +1,165 @@ +Started by user CRhACKER7 +[Pipeline] Start of Pipeline +[Pipeline] node +Running on Jenkins in /var/jenkins_home/workspace/pipe4 +[Pipeline] { +[Pipeline] stage +[Pipeline] { (Declarative: Tool Install) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] } +[Pipeline] // stage +[Pipeline] withEnv +[Pipeline] { +[Pipeline] stage +[Pipeline] { (Checkout) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] git +The recommended git tool is: NONE +No credentials specified + > git rev-parse --resolve-git-dir /var/jenkins_home/workspace/pipe4/.git # timeout=10 +Fetching changes from the remote Git repository + > git config remote.origin.url https://github.com/CrHacker7/docker-spring-boot.git # timeout=10 +Fetching upstream changes from https://github.com/CrHacker7/docker-spring-boot.git + > git --version # timeout=10 + > git --version # 'git version 2.39.5' + > git fetch --tags --force --progress -- https://github.com/CrHacker7/docker-spring-boot.git +refs/heads/*:refs/remotes/origin/* # timeout=10 + > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 +Checking out Revision 941204a429e0e1cc04cfb5bdee46309d6f043f55 (refs/remotes/origin/master) + > git config core.sparsecheckout # timeout=10 + > git checkout -f 941204a429e0e1cc04cfb5bdee46309d6f043f55 # timeout=10 + > git branch -a -v --no-abbrev # timeout=10 + > git branch -D master # timeout=10 + > git checkout -b master 941204a429e0e1cc04cfb5bdee46309d6f043f55 # timeout=10 +Commit message: "first commit" + > git rev-list --no-walk 941204a429e0e1cc04cfb5bdee46309d6f043f55 # timeout=10 +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // stage +[Pipeline] stage +[Pipeline] { (Build) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] sh ++ mvn clean package +[INFO] Scanning for projects... +[INFO] +[INFO] ----------------------< io.company:BooksPageable >---------------------- +[INFO] Building library6 0.0.1-SNAPSHOT +[INFO] from pom.xml +[INFO] --------------------------------[ jar ]--------------------------------- +[INFO] +[INFO] --- clean:3.2.0:clean (default-clean) @ BooksPageable --- +[INFO] +[INFO] --- resources:3.3.1:resources (default-resources) @ BooksPageable --- +[INFO] Copying 1 resource from src/main/resources to target/classes +[INFO] Copying 1 resource from src/main/resources to target/classes +[INFO] +[INFO] --- compiler:3.11.0:compile (default-compile) @ BooksPageable --- +[INFO] Changes detected - recompiling the module! :source +[INFO] Compiling 7 source files with javac [debug release 21] to target/classes +[INFO] Annotation processing is enabled because one or more processors were found + on the class path. A future release of javac may disable annotation processing + unless at least one processor is specified by name (-processor), or a search + path is specified (--processor-path, --processor-module-path), or annotation + processing is enabled explicitly (-proc:only, -proc:full). + Use -Xlint:-options to suppress this message. + Use -proc:none to disable annotation processing. +[INFO] +[INFO] --- resources:3.3.1:testResources (default-testResources) @ BooksPageable --- +[INFO] skip non existing resourceDirectory /var/jenkins_home/workspace/pipe4/src/test/resources +[INFO] +[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ BooksPageable --- +[INFO] No sources to compile +[INFO] +[INFO] --- surefire:3.0.0:test (default-test) @ BooksPageable --- +[INFO] No tests to run. +[INFO] +[INFO] --- jar:3.3.0:jar (default-jar) @ BooksPageable --- +[INFO] Building jar: /var/jenkins_home/workspace/pipe4/target/BooksPageable-0.0.1-SNAPSHOT.jar +[INFO] +[INFO] --- spring-boot:3.1.12:repackage (repackage) @ BooksPageable --- +[INFO] Replacing main artifact /var/jenkins_home/workspace/pipe4/target/BooksPageable-0.0.1-SNAPSHOT.jar with repackaged archive, adding nested dependencies in BOOT-INF/. +[INFO] The original artifact has been renamed to /var/jenkins_home/workspace/pipe4/target/BooksPageable-0.0.1-SNAPSHOT.jar.original +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESS +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 15.720 s +[INFO] Finished at: 2024-12-15T19:21:47Z +[INFO] ------------------------------------------------------------------------ +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // stage +[Pipeline] stage +[Pipeline] { (Archive) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] archiveArtifacts +Archiving artifacts +Recording fingerprints +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // stage +[Pipeline] stage +[Pipeline] { (Execute) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] sh ++ java -jar target/BooksPageable-0.0.1-SNAPSHOT.jar --server.port=8088 + + . ____ _ __ _ _ + /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ +( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ + \\/ ___)| |_)| | | | | || (_| | ) ) ) ) + ' |____| .__|_| |_|_| |_\__, | / / / / + =========|_|==============|___/=/_/_/_/ + :: Spring Boot :: (v3.1.12) + +2024-12-15T19:21:57.145Z INFO 2106 --- [ main] io.company.library.LibraryApplication : Starting LibraryApplication v0.0.1-SNAPSHOT using Java 21.0.1 with PID 2106 (/var/jenkins_home/workspace/pipe4/target/BooksPageable-0.0.1-SNAPSHOT.jar started by jenkins in /var/jenkins_home/workspace/pipe4) +2024-12-15T19:21:57.149Z INFO 2106 --- [ main] io.company.library.LibraryApplication : No active profile set, falling back to 1 default profile: "default" +2024-12-15T19:21:59.878Z INFO 2106 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. +2024-12-15T19:22:00.037Z INFO 2106 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 136 ms. Found 1 JPA repository interface. +2024-12-15T19:22:02.305Z INFO 2106 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8088 (http) +2024-12-15T19:22:02.350Z INFO 2106 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2024-12-15T19:22:02.351Z INFO 2106 --- [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.24] +2024-12-15T19:22:02.850Z INFO 2106 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2024-12-15T19:22:02.853Z INFO 2106 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 5495 ms +2024-12-15T19:22:03.420Z INFO 2106 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] +2024-12-15T19:22:03.608Z INFO 2106 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.2.25.Final +2024-12-15T19:22:03.614Z INFO 2106 --- [ main] org.hibernate.cfg.Environment : HHH000406: Using bytecode reflection optimizer +2024-12-15T19:22:04.613Z INFO 2106 --- [ main] o.s.o.j.p.SpringPersistenceUnitInfo : No LoadTimeWeaver setup: ignoring JPA class transformer +2024-12-15T19:22:04.752Z INFO 2106 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2024-12-15T19:22:05.356Z INFO 2106 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection conn0: url=jdbc:h2:mem:testdb user=SA +2024-12-15T19:22:05.363Z INFO 2106 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. +2024-12-15T19:22:05.454Z WARN 2106 --- [ main] org.hibernate.orm.deprecation : HHH90000025: H2Dialect does not need to be specified explicitly using 'hibernate.dialect' (remove the property setting and it will be selected by default) +2024-12-15T19:22:08.000Z INFO 2106 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration) +2024-12-15T19:22:08.141Z INFO 2106 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' +2024-12-15T19:22:09.316Z WARN 2106 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning +2024-12-15T19:22:10.475Z INFO 2106 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8088 (http) with context path '' +2024-12-15T19:22:10.549Z INFO 2106 --- [ main] io.company.library.LibraryApplication : Started LibraryApplication in 18.024 seconds (process running for 20.121) +2024-12-15T19:22:10.559Z INFO 2106 --- [ main] i.c.library.ApplicationCommandRunner : Welcome to the createFakerBooks +2024-12-15T19:22:11.767Z INFO 2106 --- [ main] i.c.library.ApplicationCommandRunner : finishing createFakerBooks ... +Pausing +Resuming \ No newline at end of file diff --git a/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing.png b/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing.png new file mode 100644 index 00000000..57d8d790 Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing.png differ diff --git a/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing2.png b/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing2.png new file mode 100644 index 00000000..4edd7f2b Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing2.png differ diff --git a/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing3-1.png b/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing3-1.png new file mode 100644 index 00000000..99ccd983 Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing3-1.png differ diff --git a/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing3.png b/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing3.png new file mode 100644 index 00000000..d3f8b6cc Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing3.png differ diff --git a/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing4.png b/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing4.png new file mode 100644 index 00000000..47af5bec Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing4.png differ diff --git a/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing5.png b/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing5.png new file mode 100644 index 00000000..ddedf586 Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/Pipeline-executing/pipeline-executing5.png differ diff --git a/PRA05_ANSWER/pipelines-success/pipe-push-docker/docker-build-error.png b/PRA05_ANSWER/pipelines-success/pipe-push-docker/docker-build-error.png new file mode 100644 index 00000000..6559518d Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/pipe-push-docker/docker-build-error.png differ diff --git a/PRA05_ANSWER/pipelines-success/pipe-push-docker/output.txt b/PRA05_ANSWER/pipelines-success/pipe-push-docker/output.txt new file mode 100644 index 00000000..0a33bf59 --- /dev/null +++ b/PRA05_ANSWER/pipelines-success/pipe-push-docker/output.txt @@ -0,0 +1,303 @@ +Started by user CRhACKER7 + +[Pipeline] Start of Pipeline +[Pipeline] node +Running on Jenkins + in /var/jenkins_home/workspace/pipeline-jenkins +[Pipeline] { +[Pipeline] withCredentials +Masking supported pattern matches of $DOCKERHUB_CREDENTIALS or $DOCKERHUB_CREDENTIALS_PSW +[Pipeline] { +[Pipeline] withEnv +[Pipeline] { +[Pipeline] stage +[Pipeline] { (Declarative: Tool Install) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] } +[Pipeline] // stage +[Pipeline] withEnv +[Pipeline] { +[Pipeline] stage +[Pipeline] { (Checkout) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] git +The recommended git tool is: NONE +No credentials specified +Cloning the remote Git repository +Cloning repository https://github.com/CrHacker7/docker-spring-boot.git + > git init /var/jenkins_home/workspace/pipeline-jenkins # timeout=10 +Fetching upstream changes from https://github.com/CrHacker7/docker-spring-boot.git + > git --version # timeout=10 + > git --version # 'git version 2.39.5' + > git fetch --tags --force --progress -- https://github.com/CrHacker7/docker-spring-boot.git +refs/heads/*:refs/remotes/origin/* # timeout=10 + > git config remote.origin.url https://github.com/CrHacker7/docker-spring-boot.git # timeout=10 + > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 +Avoid second fetch + > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 +Checking out Revision 941204a429e0e1cc04cfb5bdee46309d6f043f55 (refs/remotes/origin/master) + > git config core.sparsecheckout # timeout=10 + > git checkout -f 941204a429e0e1cc04cfb5bdee46309d6f043f55 # timeout=10 + > git branch -a -v --no-abbrev # timeout=10 + > git checkout -b master 941204a429e0e1cc04cfb5bdee46309d6f043f55 # timeout=10 +Commit message: "first commit" +First time build. Skipping changelog. +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // stage +[Pipeline] stage +[Pipeline] { (Build) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] sh ++ mvn clean package +[INFO] Scanning for projects... +[INFO] +[INFO] ----------------------< io.company:BooksPageable >---------------------- +[INFO] Building library6 0.0.1-SNAPSHOT +[INFO] from pom.xml +[INFO] --------------------------------[ jar ]--------------------------------- +[INFO] +[INFO] --- clean:3.2.0:clean (default-clean) @ BooksPageable --- +[INFO] +[INFO] --- resources:3.3.1:resources (default-resources) @ BooksPageable --- +[INFO] Copying 1 resource from src/main/resources to target/classes +[INFO] Copying 1 resource from src/main/resources to target/classes +[INFO] +[INFO] --- compiler:3.11.0:compile (default-compile) @ BooksPageable --- +[INFO] Changes detected - recompiling the module! :source +[INFO] Compiling 7 source files with javac [debug release 21] to target/classes +[INFO] Annotation processing is enabled because one or more processors were found + on the class path. A future release of javac may disable annotation processing + unless at least one processor is specified by name (-processor), or a search + path is specified (--processor-path, --processor-module-path), or annotation + processing is enabled explicitly (-proc:only, -proc:full). + Use -Xlint:-options to suppress this message. + Use -proc:none to disable annotation processing. +[INFO] +[INFO] --- resources:3.3.1:testResources (default-testResources) @ BooksPageable --- +[INFO] skip non existing resourceDirectory /var/jenkins_home/workspace/pipeline-jenkins/src/test/resources +[INFO] +[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ BooksPageable --- +[INFO] No sources to compile +[INFO] +[INFO] --- surefire:3.0.0:test (default-test) @ BooksPageable --- +[INFO] No tests to run. +[INFO] +[INFO] --- jar:3.3.0:jar (default-jar) @ BooksPageable --- +[INFO] Building jar: /var/jenkins_home/workspace/pipeline-jenkins/target/BooksPageable-0.0.1-SNAPSHOT.jar +[INFO] +[INFO] --- spring-boot:3.1.12:repackage (repackage) @ BooksPageable --- +[INFO] Replacing main artifact /var/jenkins_home/workspace/pipeline-jenkins/target/BooksPageable-0.0.1-SNAPSHOT.jar with repackaged archive, adding nested dependencies in BOOT-INF/. +[INFO] The original artifact has been renamed to /var/jenkins_home/workspace/pipeline-jenkins/target/BooksPageable-0.0.1-SNAPSHOT.jar.original +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESS +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 21.559 s +[INFO] Finished at: 2024-12-15T18:58:56Z +[INFO] ------------------------------------------------------------------------ +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // stage +[Pipeline] stage +[Pipeline] { (Test) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] sh ++ mvn test +[INFO] Scanning for projects... +[INFO] +[INFO] ----------------------< io.company:BooksPageable >---------------------- +[INFO] Building library6 0.0.1-SNAPSHOT +[INFO] from pom.xml +[INFO] --------------------------------[ jar ]--------------------------------- +[INFO] +[INFO] --- resources:3.3.1:resources (default-resources) @ BooksPageable --- +[INFO] Copying 1 resource from src/main/resources to target/classes +[INFO] Copying 1 resource from src/main/resources to target/classes +[INFO] +[INFO] --- compiler:3.11.0:compile (default-compile) @ BooksPageable --- +[INFO] Nothing to compile - all classes are up to date +[INFO] +[INFO] --- resources:3.3.1:testResources (default-testResources) @ BooksPageable --- +[INFO] skip non existing resourceDirectory /var/jenkins_home/workspace/pipeline-jenkins/src/test/resources +[INFO] +[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ BooksPageable --- +[INFO] No sources to compile +[INFO] +[INFO] --- surefire:3.0.0:test (default-test) @ BooksPageable --- +[INFO] No tests to run. +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESS +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 4.303 s +[INFO] Finished at: 2024-12-15T18:59:07Z +[INFO] ------------------------------------------------------------------------ +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // stage +[Pipeline] stage +[Pipeline] { (Archive) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] archiveArtifacts +Archiving artifacts +Recording fingerprints +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // stage +[Pipeline] stage +[Pipeline] { (Build Docker Image) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] script +[Pipeline] { +[Pipeline] sh ++ docker build -t crhacker7/books-pageable-backend:1 -t crhacker7/books-pageable-backend:latest . +#0 building with "default" instance using docker driver + +#1 [internal] load build definition from Dockerfile +#1 transferring dockerfile: 168B 0.0s done +#1 DONE 0.1s + +#2 [internal] load metadata for docker.io/library/openjdk:21-slim +#2 DONE 0.9s + +#3 [internal] load .dockerignore +#3 transferring context: 2B done +#3 DONE 0.1s + +#4 [1/3] FROM docker.io/library/openjdk:21-slim@sha256:7072053847a8a05d7f3a14ebc778a90b38c50ce7e8f199382128a53385160688 +#4 DONE 0.0s + +#5 [internal] load build context +#5 transferring context: 49.46MB 0.7s done +#5 DONE 0.8s + +#6 [2/3] WORKDIR /app +#6 CACHED + +#7 [3/3] COPY target/*.jar app.jar +#7 DONE 17.2s + +#8 exporting to image +#8 exporting layers +#8 exporting layers 0.9s done +#8 writing image sha256:bc0adf4efb0e26c12ba865d765deac8339b6dc887078c8261fb0990e65722ae1 0.0s done +#8 naming to docker.io/crhacker7/books-pageable-backend:1 0.1s done +#8 naming to docker.io/crhacker7/books-pageable-backend:latest +#8 naming to docker.io/crhacker7/books-pageable-backend:latest 0.0s done +#8 DONE 1.2s +[Pipeline] } +[Pipeline] // script +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // stage +[Pipeline] stage +[Pipeline] { (Push to DockerHub) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] script +[Pipeline] { +[Pipeline] sh +Warning: A secret was passed to "sh" using Groovy String interpolation, which is insecure. + Affected argument(s) used the following variable(s): [DOCKERHUB_CREDENTIALS_PSW] + See https://jenkins.io/redirect/groovy-string-interpolation for details. ++ echo **** ++ docker login -u crhacker7 --password-stdin +WARNING! Your password will be stored unencrypted in /var/jenkins_home/.docker/config.json. +Configure a credential helper to remove this warning. See +https://docs.docker.com/engine/reference/commandline/login/#credential-stores + +Login Succeeded +[Pipeline] sh ++ docker push crhacker7/books-pageable-backend:1 +The push refers to repository [docker.io/crhacker7/books-pageable-backend] +c56c171c0cd3: Preparing +f82750e12aa6: Preparing +659a8c4ba776: Preparing +0ac7ecf8a41c: Preparing +d310e774110a: Preparing +659a8c4ba776: Layer already exists +0ac7ecf8a41c: Layer already exists +d310e774110a: Layer already exists +f82750e12aa6: Layer already exists +c56c171c0cd3: Pushed +1: digest: sha256:b6162b8d0f22b474442589c22ba1c27e9c56a89290faa73ad05eb4cfc83ba4e1 size: 1371 +[Pipeline] sh ++ docker push crhacker7/books-pageable-backend:latest +The push refers to repository [docker.io/crhacker7/books-pageable-backend] +c56c171c0cd3: Preparing +f82750e12aa6: Preparing +659a8c4ba776: Preparing +0ac7ecf8a41c: Preparing +d310e774110a: Preparing +f82750e12aa6: Layer already exists +0ac7ecf8a41c: Layer already exists +659a8c4ba776: Layer already exists +d310e774110a: Layer already exists +c56c171c0cd3: Layer already exists +latest: digest: sha256:b6162b8d0f22b474442589c22ba1c27e9c56a89290faa73ad05eb4cfc83ba4e1 size: 1371 +[Pipeline] } +[Pipeline] // script +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // stage +[Pipeline] stage +[Pipeline] { (Declarative: Post Actions) +[Pipeline] sh ++ docker logout +Removing login credentials for https://index.docker.io/v1/ +[Pipeline] sh ++ docker rmi crhacker7/books-pageable-backend:1 +Untagged: crhacker7/books-pageable-backend:1 +[Pipeline] sh ++ docker rmi crhacker7/books-pageable-backend:latest +Untagged: crhacker7/books-pageable-backend:latest +Untagged: crhacker7/books-pageable-backend@sha256:b6162b8d0f22b474442589c22ba1c27e9c56a89290faa73ad05eb4cfc83ba4e1 +Deleted: sha256:bc0adf4efb0e26c12ba865d765deac8339b6dc887078c8261fb0990e65722ae1 +[Pipeline] } +[Pipeline] // stage +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // withCredentials +[Pipeline] } +[Pipeline] // node +[Pipeline] End of Pipeline +Finished: SUCCESS diff --git a/PRA05_ANSWER/pipelines-success/pipe-push-docker/pipe-jenkins1.png b/PRA05_ANSWER/pipelines-success/pipe-push-docker/pipe-jenkins1.png new file mode 100644 index 00000000..8fcd302f Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/pipe-push-docker/pipe-jenkins1.png differ diff --git a/PRA05_ANSWER/pipelines-success/pipe-push-docker/pipe-jenkins2.png b/PRA05_ANSWER/pipelines-success/pipe-push-docker/pipe-jenkins2.png new file mode 100644 index 00000000..98a48ffd Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/pipe-push-docker/pipe-jenkins2.png differ diff --git a/PRA05_ANSWER/pipelines-success/pipe-push-docker/pipe-jenkins3.png b/PRA05_ANSWER/pipelines-success/pipe-push-docker/pipe-jenkins3.png new file mode 100644 index 00000000..a7725e2c Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/pipe-push-docker/pipe-jenkins3.png differ diff --git a/PRA05_ANSWER/pipelines-success/pipe-push-docker/pipe-jenkins4.png b/PRA05_ANSWER/pipelines-success/pipe-push-docker/pipe-jenkins4.png new file mode 100644 index 00000000..c33795c8 Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/pipe-push-docker/pipe-jenkins4.png differ diff --git a/PRA05_ANSWER/pipelines-success/pipeline-docker/jenkins-docker-success.png b/PRA05_ANSWER/pipelines-success/pipeline-docker/jenkins-docker-success.png new file mode 100644 index 00000000..ef3cd8f2 Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/pipeline-docker/jenkins-docker-success.png differ diff --git a/PRA05_ANSWER/pipelines-success/pipeline-docker/jenkins-docker-success2.png b/PRA05_ANSWER/pipelines-success/pipeline-docker/jenkins-docker-success2.png new file mode 100644 index 00000000..047f0987 Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/pipeline-docker/jenkins-docker-success2.png differ diff --git a/PRA05_ANSWER/pipelines-success/pipeline-docker/jenkins-docker-success3.png b/PRA05_ANSWER/pipelines-success/pipeline-docker/jenkins-docker-success3.png new file mode 100644 index 00000000..e15e3526 Binary files /dev/null and b/PRA05_ANSWER/pipelines-success/pipeline-docker/jenkins-docker-success3.png differ diff --git a/PRA05_ANSWER/pipelines-success/pipeline-docker/output.txt b/PRA05_ANSWER/pipelines-success/pipeline-docker/output.txt new file mode 100644 index 00000000..8aff392e --- /dev/null +++ b/PRA05_ANSWER/pipelines-success/pipeline-docker/output.txt @@ -0,0 +1,277 @@ +Started by user CRhACKER7 + +[Pipeline] Start of Pipeline +[Pipeline] node +Running on Jenkins + in /var/jenkins_home/workspace/pipeline-dockerhub +[Pipeline] { +[Pipeline] withCredentials +Masking supported pattern matches of $DOCKERHUB_CREDENTIALS or $DOCKERHUB_CREDENTIALS_PSW +[Pipeline] { +[Pipeline] withEnv +[Pipeline] { +[Pipeline] stage +[Pipeline] { (Declarative: Tool Install) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] } +[Pipeline] // stage +[Pipeline] withEnv +[Pipeline] { +[Pipeline] stage +[Pipeline] { (Checkout) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] git +The recommended git tool is: NONE +No credentials specified + > git rev-parse --resolve-git-dir /var/jenkins_home/workspace/pipeline-dockerhub/.git # timeout=10 +Fetching changes from the remote Git repository + > git config remote.origin.url https://github.com/CrHacker7/docker-spring-boot.git # timeout=10 +Fetching upstream changes from https://github.com/CrHacker7/docker-spring-boot.git + > git --version # timeout=10 + > git --version # 'git version 2.39.5' + > git fetch --tags --force --progress -- https://github.com/CrHacker7/docker-spring-boot.git +refs/heads/*:refs/remotes/origin/* # timeout=10 + > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 +Checking out Revision 941204a429e0e1cc04cfb5bdee46309d6f043f55 (refs/remotes/origin/master) + > git config core.sparsecheckout # timeout=10 + > git checkout -f 941204a429e0e1cc04cfb5bdee46309d6f043f55 # timeout=10 + > git branch -a -v --no-abbrev # timeout=10 + > git branch -D master # timeout=10 + > git checkout -b master 941204a429e0e1cc04cfb5bdee46309d6f043f55 # timeout=10 +Commit message: "first commit" + > git rev-list --no-walk 941204a429e0e1cc04cfb5bdee46309d6f043f55 # timeout=10 +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // stage +[Pipeline] stage +[Pipeline] { (Build) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] sh ++ mvn clean package +[INFO] Scanning for projects... +[INFO] +[INFO] ----------------------< io.company:BooksPageable >---------------------- +[INFO] Building library6 0.0.1-SNAPSHOT +[INFO] from pom.xml +[INFO] --------------------------------[ jar ]--------------------------------- +[INFO] +[INFO] --- clean:3.2.0:clean (default-clean) @ BooksPageable --- +[INFO] Deleting /var/jenkins_home/workspace/pipeline-dockerhub/target +[INFO] +[INFO] --- resources:3.3.1:resources (default-resources) @ BooksPageable --- +[INFO] Copying 1 resource from src/main/resources to target/classes +[INFO] Copying 1 resource from src/main/resources to target/classes +[INFO] +[INFO] --- compiler:3.11.0:compile (default-compile) @ BooksPageable --- +[INFO] Changes detected - recompiling the module! :source +[INFO] Compiling 7 source files with javac [debug release 21] to target/classes +[INFO] Annotation processing is enabled because one or more processors were found + on the class path. A future release of javac may disable annotation processing + unless at least one processor is specified by name (-processor), or a search + path is specified (--processor-path, --processor-module-path), or annotation + processing is enabled explicitly (-proc:only, -proc:full). + Use -Xlint:-options to suppress this message. + Use -proc:none to disable annotation processing. +[INFO] +[INFO] --- resources:3.3.1:testResources (default-testResources) @ BooksPageable --- +[INFO] skip non existing resourceDirectory /var/jenkins_home/workspace/pipeline-dockerhub/src/test/resources +[INFO] +[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ BooksPageable --- +[INFO] No sources to compile +[INFO] +[INFO] --- surefire:3.0.0:test (default-test) @ BooksPageable --- +[INFO] No tests to run. +[INFO] +[INFO] --- jar:3.3.0:jar (default-jar) @ BooksPageable --- +[INFO] Building jar: /var/jenkins_home/workspace/pipeline-dockerhub/target/BooksPageable-0.0.1-SNAPSHOT.jar +[INFO] +[INFO] --- spring-boot:3.1.12:repackage (repackage) @ BooksPageable --- +[INFO] Replacing main artifact /var/jenkins_home/workspace/pipeline-dockerhub/target/BooksPageable-0.0.1-SNAPSHOT.jar with repackaged archive, adding nested dependencies in BOOT-INF/. +[INFO] The original artifact has been renamed to /var/jenkins_home/workspace/pipeline-dockerhub/target/BooksPageable-0.0.1-SNAPSHOT.jar.original +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESS +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 11.092 s +[INFO] Finished at: 2024-12-15T18:17:56Z +[INFO] ------------------------------------------------------------------------ +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // stage +[Pipeline] stage +[Pipeline] { (Build Docker Image) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] script +[Pipeline] { +[Pipeline] isUnix +[Pipeline] withEnv +[Pipeline] { +[Pipeline] sh ++ docker build -t crhacker7/books-pageable-backend:4 . +#0 building with "default" instance using docker driver + +#1 [internal] load build definition from Dockerfile +#1 DONE 0.0s + +#1 [internal] load build definition from Dockerfile +#1 transferring dockerfile: +#1 transferring dockerfile: 168B done +#1 DONE 0.7s + +#2 [internal] load metadata for docker.io/library/openjdk:21-slim +#2 DONE 1.8s + +#3 [internal] load .dockerignore +#3 transferring context: 2B done +#3 DONE 0.3s + +#4 [1/3] FROM docker.io/library/openjdk:21-slim@sha256:7072053847a8a05d7f3a14ebc778a90b38c50ce7e8f199382128a53385160688 +#4 DONE 0.0s + +#5 [internal] load build context +#5 transferring context: 49.46MB 0.9s done +#5 DONE 3.3s + +#6 [2/3] WORKDIR /app +#6 CACHED + +#7 [3/3] COPY target/*.jar app.jar +#7 DONE 16.6s + +#8 exporting to image +#8 exporting layers +#8 exporting layers 0.5s done +#8 writing image sha256:bc2df09af16581a71127288859444d0384448dd4e77e3107e6599417bcf50c00 0.0s done +#8 naming to docker.io/crhacker7/books-pageable-backend:4 0.0s done +#8 DONE 0.6s +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // script +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // stage +[Pipeline] stage +[Pipeline] { (Push to DockerHub) +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] tool +[Pipeline] envVarsForTool +[Pipeline] withEnv +[Pipeline] { +[Pipeline] script +[Pipeline] { +[Pipeline] withEnv +[Pipeline] { +[Pipeline] withDockerRegistry +$ docker login -u crhacker7 -p ******** https://index.docker.io/v1/ +WARNING! Using --password via the CLI is insecure. Use --password-stdin. +WARNING! Your password will be stored unencrypted in /var/jenkins_home/workspace/pipeline-dockerhub@tmp/4788bc0b-0798-45c2-bf44-3ac330096f04/config.json. +Configure a credential helper to remove this warning. See +https://docs.docker.com/engine/reference/commandline/login/#credential-stores + +Login Succeeded +[Pipeline] { +[Pipeline] isUnix +[Pipeline] withEnv +[Pipeline] { +[Pipeline] sh ++ docker tag crhacker7/books-pageable-backend:4 crhacker7/books-pageable-backend:4 +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] isUnix +[Pipeline] withEnv +[Pipeline] { +[Pipeline] sh ++ docker push crhacker7/books-pageable-backend:4 +The push refers to repository [docker.io/crhacker7/books-pageable-backend] +83fbe4afdd38: Preparing +f82750e12aa6: Preparing +659a8c4ba776: Preparing +0ac7ecf8a41c: Preparing +d310e774110a: Preparing +0ac7ecf8a41c: Layer already exists +d310e774110a: Layer already exists +659a8c4ba776: Layer already exists +f82750e12aa6: Mounted from crhacker7/books-spring-boot +83fbe4afdd38: Pushed +4: digest: sha256:ce186064e7f64d3abaa45cbc6171273f519fdbc1198ca21a6b6f15c94a16a56b size: 1371 +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] isUnix +[Pipeline] withEnv +[Pipeline] { +[Pipeline] sh ++ docker tag crhacker7/books-pageable-backend:4 crhacker7/books-pageable-backend:latest +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] isUnix +[Pipeline] withEnv +[Pipeline] { +[Pipeline] sh ++ docker push crhacker7/books-pageable-backend:latest +The push refers to repository [docker.io/crhacker7/books-pageable-backend] +83fbe4afdd38: Preparing +f82750e12aa6: Preparing +659a8c4ba776: Preparing +0ac7ecf8a41c: Preparing +d310e774110a: Preparing +0ac7ecf8a41c: Layer already exists +83fbe4afdd38: Layer already exists +d310e774110a: Layer already exists +659a8c4ba776: Layer already exists +f82750e12aa6: Layer already exists +latest: digest: sha256:ce186064e7f64d3abaa45cbc6171273f519fdbc1198ca21a6b6f15c94a16a56b size: 1371 +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // withDockerRegistry +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // script +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // stage +[Pipeline] stage +[Pipeline] { (Declarative: Post Actions) +[Pipeline] sh ++ docker rmi crhacker7/books-pageable-backend:4 +Untagged: crhacker7/books-pageable-backend:4 +[Pipeline] sh ++ docker rmi crhacker7/books-pageable-backend:latest +Untagged: crhacker7/books-pageable-backend:latest +Untagged: crhacker7/books-pageable-backend@sha256:ce186064e7f64d3abaa45cbc6171273f519fdbc1198ca21a6b6f15c94a16a56b +Deleted: sha256:bc2df09af16581a71127288859444d0384448dd4e77e3107e6599417bcf50c00 +[Pipeline] } +[Pipeline] // stage +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // withEnv +[Pipeline] } +[Pipeline] // withCredentials +[Pipeline] } +[Pipeline] // node +[Pipeline] End of Pipeline +Finished: SUCCESS