Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lesson28/.github/workflows/ci.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v2

- name: Set up JDK 14
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '14'
distribution: 'temurin'
java-version: '17'

- name: Cache Maven dependencies
uses: actions/cache@v3
Expand All @@ -33,10 +34,10 @@ jobs:
run: mvn -B package --file lesson28/${{ matrix.app }}/pom.xml

- name: Upload build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.app }}-jar
path: lesson28/${{ matrix.app }}/target/*jar-with-dependencies.jar
path: lesson28/${{ matrix.app }}/target/*.jar

- name: Docker login
run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
Expand Down
1 change: 0 additions & 1 deletion lesson28/hello-devops
Submodule hello-devops deleted from cc466b
4 changes: 4 additions & 0 deletions lesson28/hello-devops/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM openjdk:14-slim
COPY target/*jar-with-dependencies.jar app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]

2 changes: 2 additions & 0 deletions lesson28/hello-devops/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# github-action-maven-example-start
Link to tutorial: https://medium.com/@alexander.volminger/ci-cd-for-java-maven-using-github-actions-d009a7cb4b8f
68 changes: 68 additions & 0 deletions lesson28/hello-devops/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?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>

<groupId>org.kth</groupId>
<artifactId>hello-devops</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
App
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

<dependencies>

</dependencies>

</project>
11 changes: 11 additions & 0 deletions lesson28/hello-devops/src/main/java/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class App
{
public static void main( String[] args )
{
System.out.println("I am your awesome Java application!");

DeepThought ourSuperComputer = new DeepThought();
int ans = ourSuperComputer.answer_to_the_ultimate_question_of_life_the_universe_and_everything();
System.out.println(ans);
}
}
34 changes: 34 additions & 0 deletions lesson28/hello-devops/src/main/java/DeepThought.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import java.util.concurrent.TimeUnit;

public class DeepThought {
public DeepThought(){

}

public int answer_to_the_ultimate_question_of_life_the_universe_and_everything(){
System.out.println("You have asked the answer to the Ultimate Question of Life, the Universe, and Everything");
System.out.println("I need to think a while about that one, come back again in 7.5 million years...");
calculate(); // for 7.5 million years....
return give_answer();
}

private void calculate(){
for(int million_years = 0; million_years < 8; million_years++){
System.out.println(million_years + " million years have passed...");
think(1);
}
System.out.println("7.5 million years have now passed and I have a answer");
}

private void think(int time){
try {
TimeUnit.SECONDS.sleep(time);
} catch (Exception e){
System.out.println(e);
}
}

private int give_answer(){
return 42;
}
}
Binary file added lesson28/hello-devops/target/classes/App.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions lesson28/hello-devops/target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
artifactId=hello-devops
groupId=org.kth
version=1.0-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
App.class
DeepThought.class
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/home/cobalt-strike/codeby_cloned/Codeby_Azat_Hajyyev/lesson28/hello-devops/src/main/java/App.java
/home/cobalt-strike/codeby_cloned/Codeby_Azat_Hajyyev/lesson28/hello-devops/src/main/java/DeepThought.java
1 change: 0 additions & 1 deletion lesson28/hello-jenkins
Submodule hello-jenkins deleted from cc466b
4 changes: 4 additions & 0 deletions lesson28/hello-jenkins/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM openjdk:14-slim
COPY target/*jar-with-dependencies.jar app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]

2 changes: 2 additions & 0 deletions lesson28/hello-jenkins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# github-action-maven-example-start
Link to tutorial: https://medium.com/@alexander.volminger/ci-cd-for-java-maven-using-github-actions-d009a7cb4b8f
68 changes: 68 additions & 0 deletions lesson28/hello-jenkins/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?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>

<groupId>org.kth</groupId>
<artifactId>hello-jenkins</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
App
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

<dependencies>

</dependencies>

</project>
11 changes: 11 additions & 0 deletions lesson28/hello-jenkins/src/main/java/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class App
{
public static void main( String[] args )
{
System.out.println("I am your awesome Java application!");

DeepThought ourSuperComputer = new DeepThought();
int ans = ourSuperComputer.answer_to_the_ultimate_question_of_life_the_universe_and_everything();
System.out.println(ans);
}
}
34 changes: 34 additions & 0 deletions lesson28/hello-jenkins/src/main/java/DeepThought.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import java.util.concurrent.TimeUnit;

public class DeepThought {
public DeepThought(){

}

public int answer_to_the_ultimate_question_of_life_the_universe_and_everything(){
System.out.println("You have asked the answer to the Ultimate Question of Life, the Universe, and Everything");
System.out.println("I need to think a while about that one, come back again in 7.5 million years...");
calculate(); // for 7.5 million years....
return give_answer();
}

private void calculate(){
for(int million_years = 0; million_years < 8; million_years++){
System.out.println(million_years + " million years have passed...");
think(1);
}
System.out.println("7.5 million years have now passed and I have a answer");
}

private void think(int time){
try {
TimeUnit.SECONDS.sleep(time);
} catch (Exception e){
System.out.println(e);
}
}

private int give_answer(){
return 42;
}
}
Binary file added lesson28/hello-jenkins/target/classes/App.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions lesson28/hello-jenkins/target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
artifactId=hello-jenkins
groupId=org.kth
version=1.0-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
App.class
DeepThought.class
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/home/cobalt-strike/codeby_cloned/Codeby_Azat_Hajyyev/lesson28/hello-jenkins/src/main/java/App.java
/home/cobalt-strike/codeby_cloned/Codeby_Azat_Hajyyev/lesson28/hello-jenkins/src/main/java/DeepThought.java
1 change: 0 additions & 1 deletion lesson28/hello-world
Submodule hello-world deleted from cc466b
4 changes: 4 additions & 0 deletions lesson28/hello-world/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM openjdk:14-slim
COPY target/*jar-with-dependencies.jar app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]

2 changes: 2 additions & 0 deletions lesson28/hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# github-action-maven-example-start
Link to tutorial: https://medium.com/@alexander.volminger/ci-cd-for-java-maven-using-github-actions-d009a7cb4b8f
68 changes: 68 additions & 0 deletions lesson28/hello-world/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?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>

<groupId>org.kth</groupId>
<artifactId>hello-world</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
App
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

<dependencies>

</dependencies>

</project>
11 changes: 11 additions & 0 deletions lesson28/hello-world/src/main/java/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class App
{
public static void main( String[] args )
{
System.out.println("I am your awesome Java application!");

DeepThought ourSuperComputer = new DeepThought();
int ans = ourSuperComputer.answer_to_the_ultimate_question_of_life_the_universe_and_everything();
System.out.println(ans);
}
}
Loading