diff --git a/lesson28/.github/workflows/ci.yml b/.github/workflows/ci.yml similarity index 84% rename from lesson28/.github/workflows/ci.yml rename to .github/workflows/ci.yml index 15d0975..e81170b 100644 --- a/lesson28/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 diff --git a/lesson28/hello-devops b/lesson28/hello-devops deleted file mode 160000 index cc466be..0000000 --- a/lesson28/hello-devops +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cc466be8a0f386a7765c8231ec5476f9a068c6c9 diff --git a/lesson28/hello-devops/Dockerfile b/lesson28/hello-devops/Dockerfile new file mode 100644 index 0000000..d6f17d1 --- /dev/null +++ b/lesson28/hello-devops/Dockerfile @@ -0,0 +1,4 @@ +FROM openjdk:14-slim +COPY target/*jar-with-dependencies.jar app.jar +ENTRYPOINT ["java", "-jar", "app.jar"] + diff --git a/lesson28/hello-devops/README.md b/lesson28/hello-devops/README.md new file mode 100644 index 0000000..dc4a1e8 --- /dev/null +++ b/lesson28/hello-devops/README.md @@ -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 diff --git a/lesson28/hello-devops/pom.xml b/lesson28/hello-devops/pom.xml new file mode 100644 index 0000000..1f33514 --- /dev/null +++ b/lesson28/hello-devops/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + + org.kth + hello-devops + 1.0-SNAPSHOT + + + UTF-8 + 1.7 + 1.7 + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + + + + App + + + + + jar-with-dependencies + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + + org.junit.platform + junit-platform-surefire-provider + 1.1.0 + + + org.junit.jupiter + junit-jupiter-engine + 5.1.0 + + + + + + + + + + + diff --git a/lesson28/hello-devops/src/main/java/App.java b/lesson28/hello-devops/src/main/java/App.java new file mode 100644 index 0000000..6f9d5aa --- /dev/null +++ b/lesson28/hello-devops/src/main/java/App.java @@ -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); + } +} \ No newline at end of file diff --git a/lesson28/hello-devops/src/main/java/DeepThought.java b/lesson28/hello-devops/src/main/java/DeepThought.java new file mode 100644 index 0000000..148fba9 --- /dev/null +++ b/lesson28/hello-devops/src/main/java/DeepThought.java @@ -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; + } +} diff --git a/lesson28/hello-devops/target/classes/App.class b/lesson28/hello-devops/target/classes/App.class new file mode 100644 index 0000000..97a524c Binary files /dev/null and b/lesson28/hello-devops/target/classes/App.class differ diff --git a/lesson28/hello-devops/target/classes/DeepThought.class b/lesson28/hello-devops/target/classes/DeepThought.class new file mode 100644 index 0000000..72d3f5a Binary files /dev/null and b/lesson28/hello-devops/target/classes/DeepThought.class differ diff --git a/lesson28/hello-devops/target/hello-devops-1.0-SNAPSHOT-jar-with-dependencies.jar b/lesson28/hello-devops/target/hello-devops-1.0-SNAPSHOT-jar-with-dependencies.jar new file mode 100644 index 0000000..1841620 Binary files /dev/null and b/lesson28/hello-devops/target/hello-devops-1.0-SNAPSHOT-jar-with-dependencies.jar differ diff --git a/lesson28/hello-devops/target/hello-devops-1.0-SNAPSHOT.jar b/lesson28/hello-devops/target/hello-devops-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..e494440 Binary files /dev/null and b/lesson28/hello-devops/target/hello-devops-1.0-SNAPSHOT.jar differ diff --git a/lesson28/hello-devops/target/maven-archiver/pom.properties b/lesson28/hello-devops/target/maven-archiver/pom.properties new file mode 100644 index 0000000..88d7962 --- /dev/null +++ b/lesson28/hello-devops/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=hello-devops +groupId=org.kth +version=1.0-SNAPSHOT diff --git a/lesson28/hello-devops/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/lesson28/hello-devops/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..490f23e --- /dev/null +++ b/lesson28/hello-devops/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,2 @@ +App.class +DeepThought.class diff --git a/lesson28/hello-devops/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/lesson28/hello-devops/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..218b9b4 --- /dev/null +++ b/lesson28/hello-devops/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -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 diff --git a/lesson28/hello-jenkins b/lesson28/hello-jenkins deleted file mode 160000 index cc466be..0000000 --- a/lesson28/hello-jenkins +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cc466be8a0f386a7765c8231ec5476f9a068c6c9 diff --git a/lesson28/hello-jenkins/Dockerfile b/lesson28/hello-jenkins/Dockerfile new file mode 100644 index 0000000..d6f17d1 --- /dev/null +++ b/lesson28/hello-jenkins/Dockerfile @@ -0,0 +1,4 @@ +FROM openjdk:14-slim +COPY target/*jar-with-dependencies.jar app.jar +ENTRYPOINT ["java", "-jar", "app.jar"] + diff --git a/lesson28/hello-jenkins/README.md b/lesson28/hello-jenkins/README.md new file mode 100644 index 0000000..dc4a1e8 --- /dev/null +++ b/lesson28/hello-jenkins/README.md @@ -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 diff --git a/lesson28/hello-jenkins/pom.xml b/lesson28/hello-jenkins/pom.xml new file mode 100644 index 0000000..08697e0 --- /dev/null +++ b/lesson28/hello-jenkins/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + + org.kth + hello-jenkins + 1.0-SNAPSHOT + + + UTF-8 + 1.7 + 1.7 + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + + + + App + + + + + jar-with-dependencies + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + + org.junit.platform + junit-platform-surefire-provider + 1.1.0 + + + org.junit.jupiter + junit-jupiter-engine + 5.1.0 + + + + + + + + + + + diff --git a/lesson28/hello-jenkins/src/main/java/App.java b/lesson28/hello-jenkins/src/main/java/App.java new file mode 100644 index 0000000..6f9d5aa --- /dev/null +++ b/lesson28/hello-jenkins/src/main/java/App.java @@ -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); + } +} \ No newline at end of file diff --git a/lesson28/hello-jenkins/src/main/java/DeepThought.java b/lesson28/hello-jenkins/src/main/java/DeepThought.java new file mode 100644 index 0000000..148fba9 --- /dev/null +++ b/lesson28/hello-jenkins/src/main/java/DeepThought.java @@ -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; + } +} diff --git a/lesson28/hello-jenkins/target/classes/App.class b/lesson28/hello-jenkins/target/classes/App.class new file mode 100644 index 0000000..97a524c Binary files /dev/null and b/lesson28/hello-jenkins/target/classes/App.class differ diff --git a/lesson28/hello-jenkins/target/classes/DeepThought.class b/lesson28/hello-jenkins/target/classes/DeepThought.class new file mode 100644 index 0000000..72d3f5a Binary files /dev/null and b/lesson28/hello-jenkins/target/classes/DeepThought.class differ diff --git a/lesson28/hello-jenkins/target/hello-jenkins-1.0-SNAPSHOT-jar-with-dependencies.jar b/lesson28/hello-jenkins/target/hello-jenkins-1.0-SNAPSHOT-jar-with-dependencies.jar new file mode 100644 index 0000000..7a428a7 Binary files /dev/null and b/lesson28/hello-jenkins/target/hello-jenkins-1.0-SNAPSHOT-jar-with-dependencies.jar differ diff --git a/lesson28/hello-jenkins/target/hello-jenkins-1.0-SNAPSHOT.jar b/lesson28/hello-jenkins/target/hello-jenkins-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..9e581c2 Binary files /dev/null and b/lesson28/hello-jenkins/target/hello-jenkins-1.0-SNAPSHOT.jar differ diff --git a/lesson28/hello-jenkins/target/maven-archiver/pom.properties b/lesson28/hello-jenkins/target/maven-archiver/pom.properties new file mode 100644 index 0000000..829deaf --- /dev/null +++ b/lesson28/hello-jenkins/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=hello-jenkins +groupId=org.kth +version=1.0-SNAPSHOT diff --git a/lesson28/hello-jenkins/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/lesson28/hello-jenkins/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..490f23e --- /dev/null +++ b/lesson28/hello-jenkins/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,2 @@ +App.class +DeepThought.class diff --git a/lesson28/hello-jenkins/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/lesson28/hello-jenkins/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..11cd1e2 --- /dev/null +++ b/lesson28/hello-jenkins/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -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 diff --git a/lesson28/hello-world b/lesson28/hello-world deleted file mode 160000 index cc466be..0000000 --- a/lesson28/hello-world +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cc466be8a0f386a7765c8231ec5476f9a068c6c9 diff --git a/lesson28/hello-world/Dockerfile b/lesson28/hello-world/Dockerfile new file mode 100644 index 0000000..d6f17d1 --- /dev/null +++ b/lesson28/hello-world/Dockerfile @@ -0,0 +1,4 @@ +FROM openjdk:14-slim +COPY target/*jar-with-dependencies.jar app.jar +ENTRYPOINT ["java", "-jar", "app.jar"] + diff --git a/lesson28/hello-world/README.md b/lesson28/hello-world/README.md new file mode 100644 index 0000000..dc4a1e8 --- /dev/null +++ b/lesson28/hello-world/README.md @@ -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 diff --git a/lesson28/hello-world/pom.xml b/lesson28/hello-world/pom.xml new file mode 100644 index 0000000..68238ad --- /dev/null +++ b/lesson28/hello-world/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + + org.kth + hello-world + 1.0-SNAPSHOT + + + UTF-8 + 1.7 + 1.7 + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + + + + App + + + + + jar-with-dependencies + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + + org.junit.platform + junit-platform-surefire-provider + 1.1.0 + + + org.junit.jupiter + junit-jupiter-engine + 5.1.0 + + + + + + + + + + + diff --git a/lesson28/hello-world/src/main/java/App.java b/lesson28/hello-world/src/main/java/App.java new file mode 100644 index 0000000..6f9d5aa --- /dev/null +++ b/lesson28/hello-world/src/main/java/App.java @@ -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); + } +} \ No newline at end of file diff --git a/lesson28/hello-world/src/main/java/DeepThought.java b/lesson28/hello-world/src/main/java/DeepThought.java new file mode 100644 index 0000000..148fba9 --- /dev/null +++ b/lesson28/hello-world/src/main/java/DeepThought.java @@ -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; + } +} diff --git a/lesson28/hello-world/target/classes/App.class b/lesson28/hello-world/target/classes/App.class new file mode 100644 index 0000000..97a524c Binary files /dev/null and b/lesson28/hello-world/target/classes/App.class differ diff --git a/lesson28/hello-world/target/classes/DeepThought.class b/lesson28/hello-world/target/classes/DeepThought.class new file mode 100644 index 0000000..72d3f5a Binary files /dev/null and b/lesson28/hello-world/target/classes/DeepThought.class differ diff --git a/lesson28/hello-world/target/hello-world-1.0-SNAPSHOT-jar-with-dependencies.jar b/lesson28/hello-world/target/hello-world-1.0-SNAPSHOT-jar-with-dependencies.jar new file mode 100644 index 0000000..972592a Binary files /dev/null and b/lesson28/hello-world/target/hello-world-1.0-SNAPSHOT-jar-with-dependencies.jar differ diff --git a/lesson28/hello-world/target/hello-world-1.0-SNAPSHOT.jar b/lesson28/hello-world/target/hello-world-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..36df1f2 Binary files /dev/null and b/lesson28/hello-world/target/hello-world-1.0-SNAPSHOT.jar differ diff --git a/lesson28/hello-world/target/maven-archiver/pom.properties b/lesson28/hello-world/target/maven-archiver/pom.properties new file mode 100644 index 0000000..74889d4 --- /dev/null +++ b/lesson28/hello-world/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=hello-world +groupId=org.kth +version=1.0-SNAPSHOT diff --git a/lesson28/hello-world/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/lesson28/hello-world/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..490f23e --- /dev/null +++ b/lesson28/hello-world/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,2 @@ +App.class +DeepThought.class diff --git a/lesson28/hello-world/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/lesson28/hello-world/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..f0f2426 --- /dev/null +++ b/lesson28/hello-world/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,2 @@ +/home/cobalt-strike/codeby_cloned/Codeby_Azat_Hajyyev/lesson28/hello-world/src/main/java/App.java +/home/cobalt-strike/codeby_cloned/Codeby_Azat_Hajyyev/lesson28/hello-world/src/main/java/DeepThought.java