JAVA-31609 move jenkins, mesos modules to ops repo

This commit is contained in:
Loredana Crusoveanu
2024-04-01 17:24:15 +03:00
parent 2119df902b
commit a305c54712
47 changed files with 0 additions and 1244 deletions
-8
View File
@@ -1,8 +0,0 @@
## Relevant Articles
- [Trigger Another Job from a Jenkins Pipeline](https://www.baeldung.com/ops/jenkins-pipeline-trigger-new-job)
- [Fixing the “No Such DSL method” Error in Jenkins Pipeline](https://www.baeldung.com/ops/jenkins-pipeline-no-such-dsl-method-error)
- [Jenkins Pipeline – Change to Another Folder](https://www.baeldung.com/ops/jenkins-pipeline-change-to-another-folder)
- [How to Stop a Zombie Job on Jenkins Without Restarting the Server?](https://www.baeldung.com/ops/stop-zombie-job-on-jenkins-without-restarting-the-server)
- [Running Stages in Parallel With Jenkins Workflow / Pipeline](https://www.baeldung.com/ops/running-stages-in-parallel-jenkins-workflow-pipeline)
- [Skip a Stage in a Jenkins Pipeline](https://www.baeldung.com/ops/jenkins-pipeline-skip-stage)
- [Prevent Jenkins Build From Failing When Execute Shell Step Fails](https://www.baeldung.com/linux/jenkins-build-execute-shell-step-fails)
@@ -1,11 +0,0 @@
pipeline {
agent any
stages {
stage('Build') {
steps {
dir('/var/jenkins_home/workspace/SamplePipeline/scripts') {
}
}
}
}
}
@@ -1,11 +0,0 @@
pipeline {
agent any
stages {
stage('Build') {
steps {
dir('scripts') {
}
}
}
}
}
@@ -1,10 +0,0 @@
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'cd scripts'
}
}
}
}
@@ -1,10 +0,0 @@
pipeline {
agent any
stages {
stage('Build') {
steps {
mvn 'clean install'
}
}
}
}
@@ -1,13 +0,0 @@
pipeline {
agent any
stages {
stage('Example') {
steps {
script {
def output = sh(script: "echo \$(ls)", returnStdout: true)
echo "Output: ${output}"
}
}
}
}
}
@@ -1,17 +0,0 @@
pipeline {
agent any
stages {
stage('Example') {
steps {
script {
def status = sh(returnStatus: true, script: 'ls /test')
if (status != 0) {
echo "Error: Command exited with status ${status}"
} else {
echo "Command executed successfully"
}
}
}
}
}
}
@@ -1,13 +0,0 @@
pipeline {
agent any
stages {
stage('Example') {
steps {
script {
def output = sh(returnStdout: true, script: 'pwd')
echo "Output: ${output}"
}
}
}
}
}
@@ -1,13 +0,0 @@
pipeline {
agent any
stages {
stage('Example') {
steps {
script {
def output = sh(returnStdout: true, returnStdoutTrim: true, script: 'echo " hello "')
echo "Output: '${output}'"
}
}
}
}
}
@@ -1,34 +0,0 @@
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'echo "Building the application"'
// Add commands to build application
}
}
stage('Test') {
parallel {
stage('Unit Tests') {
steps {
sh 'sleep 5s'
sh 'echo "Running unit tests"'
// Add commands to run unit tests
}
}
stage('Integration Tests') {
steps {
sh 'echo "Running integration tests"'
// Add commands to run integration tests
}
}
}
}
stage('Deploy') {
steps {
sh 'echo "Deploying the application"'
// Add commands to deploy application
}
}
}
}
@@ -1,16 +0,0 @@
pipeline {
agent any
stages {
stage('tryCatch') {
steps {
script {
try {
sh 'test_script.sh'
} catch (e) {
echo "An error occurred: ${e}"
}
}
}
}
}
}
@@ -1,32 +0,0 @@
pipeline {
agent any
parameters {
booleanParam(name: 'skip_test', defaultValue: false, description: 'Set to true to skip the test stage')
}
stages {
stage('Build') {
steps {
sh 'echo "Building the application"'
}
}
stage('Test') {
steps {
execute_stage('Test', params.skip_test)
}
}
stage('Deploy') {
steps {
sh 'echo "Deploying the application"'
}
}
}
}
def execute_stage(stage_name, skip) {
stage(stage_name) {
if(skip) {
echo "Skipping ${stage_name} stage"
return
}
// Add steps to test the application
}
@@ -1,29 +0,0 @@
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'echo "Building the application"'
// Add steps to build the application
}
}
stage('Test') {
steps {
input message: 'Do you want to skip the test stage?', ok: 'Yes', parameters: [booleanParam(name: 'skip_test', defaultValue: false)], timeout: time(minutes: 5))
script {
if(params.skip_test) {
sh 'echo "Testing the application"'
return
}
}
// Add steps to test the application
}
}
stage('Deploy') {
steps {
sh 'echo "Deploying the application"'
// Add steps to deploy the application
}
}
}
}
@@ -1,27 +0,0 @@
pipeline {
agent any
parameters {
booleanParam(name: 'skip_test', defaultValue: false, description: 'Set to true to skip the test stage')
}
stages {
stage('Build') {
steps {
sh 'echo "Building application"'
// Add build steps here
}
}
stage('Test') {
when { expression { params.skip_test != true } }
steps {
sh 'echo "Testing application"'
// Add test steps here
}
}
stage('Deploy') {
steps {
sh 'echo "Deploying application"'
// Add deployment steps here
}
}
}
}
@@ -1,15 +0,0 @@
pipeline {
agent any
stages {
stage('build') {
steps {
echo "parentJob"
}
}
stage('triggerChildJob') {
steps {
build job: "childJob", wait: true
}
}
}
}
@@ -1,15 +0,0 @@
pipeline {
agent any
stages {
stage('Infinite Loop') {
steps {
script {
while (true) {
println 'This is an infinite loop!'
Thread.sleep(10000)
}
}
}
}
}
}
@@ -1,3 +0,0 @@
Jenkins.instance.getItemByFullName("sampleZombieJob")
.getBuildByNumber(17)
.finish(hudson.model.Result.ABORTED, new java.io.IOException("Aborting build"));
@@ -1,6 +0,0 @@
Thread.getAllStackTraces().keySet().each() {
if (it.name.contains('sampleZombieJob')) {
println "Stopping $it.name"
it.interrupt()
}
}
@@ -1,6 +0,0 @@
Thread.getAllStackTraces().keySet().each() {
if (it.name.contains('sampleZombieJob')) {
println "Stopping $it.name"
it.stop()
}
}
-4
View File
@@ -1,4 +0,0 @@
FROM openjdk:17-jdk-alpine
ADD target/mesos-marathon-0.0.1-SNAPSHOT.jar app.jar
EXPOSE 8082
ENTRYPOINT ["java","-jar","/app.jar"]
-9
View File
@@ -1,9 +0,0 @@
## Marathon and Mesos
This module contains articles about Marathon and Mesos.
### Relevant articles
- [Simple Jenkins Pipeline with Marathon and Mesos](https://www.baeldung.com/ops/jenkins-pipeline-with-marathon-mesos)
To run the pipeline, please modify the dockerise.sh file with your own username and password for docker login.
-5
View File
@@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -e
docker login -u mogronalol -p $DOCKER_PASSWORD
docker build -t baeldung/mesos-marathon-demo:$BUILD_NUMBER .
docker push baeldung/mesos-marathon-demo:$BUILD_NUMBER
-14
View File
@@ -1,14 +0,0 @@
{
"id": "mesos-marathon-demo",
"container": {
"type": "DOCKER",
"docker": {
"image": "",
"network": "BRIDGE",
"portMappings": [
{ "containerPort": 8082, "hostPort": 0 }
]
},
"volumes": []
}
}
-39
View File
@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mesos-marathon</artifactId>
<name>mesos-marathon</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-3</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-3</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -1,12 +0,0 @@
package com.baeldung;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
@@ -1,16 +0,0 @@
package com.baeldung;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController(value = "/")
public class HelloController {
@GetMapping
@ResponseBody
public String getMapping() {
return "Hello world";
}
}
@@ -1 +0,0 @@
server.port=8082
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>
@@ -1,33 +0,0 @@
package com.baeldung;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = {DemoApplication.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class DemoApplicationIntegrationTest {
private RestTemplate restTemplate;
@LocalServerPort
private int port;
@Before
public void setUp() {
restTemplate = new RestTemplate();
}
@Test
public void contextLoads() {
final String result = restTemplate.getForObject("http://localhost:" + port + "/", String.class);
assertThat(result).isEqualTo("Hello world");
}
}
-24
View File
@@ -1,24 +0,0 @@
target/
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/

Some files were not shown because too many files have changed in this diff Show More