From 0d613940441907edadc125de84c9d9524889d74c Mon Sep 17 00:00:00 2001 From: Harold Jimenez Date: Thu, 22 Dec 2022 11:11:31 -0500 Subject: [PATCH] Initial commit simple Hello world rest service with and example of github actions --- .github/workflows/github-actions-demo.yml | 18 +++++++ pom.xml | 48 +++++++++++++++++++ .../example/KubernetesApplication.java | 13 +++++ .../personal/example/controller/Person.java | 16 +++++++ src/main/resources/application.properties | 1 + .../KuberneteExampleApplicationTests.java | 13 +++++ 6 files changed, 109 insertions(+) create mode 100644 .github/workflows/github-actions-demo.yml create mode 100644 pom.xml create mode 100644 src/main/java/com/personal/example/KubernetesApplication.java create mode 100644 src/main/java/com/personal/example/controller/Person.java create mode 100644 src/main/resources/application.properties create mode 100644 src/test/java/com/personal/example/KuberneteExampleApplicationTests.java diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml new file mode 100644 index 0000000..8a9c1ff --- /dev/null +++ b/.github/workflows/github-actions-demo.yml @@ -0,0 +1,18 @@ +name: GitHub Actions Demo +run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 +on: [push] +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..dc61c49 --- /dev/null +++ b/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.0.0 + + + com.personal.example + kubernetes + 0.0.1-SNAPSHOT + kubernetes + kubernetes + spring web + gitHub actions + + 17 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + diff --git a/src/main/java/com/personal/example/KubernetesApplication.java b/src/main/java/com/personal/example/KubernetesApplication.java new file mode 100644 index 0000000..37b31e6 --- /dev/null +++ b/src/main/java/com/personal/example/KubernetesApplication.java @@ -0,0 +1,13 @@ +package com.personal.example; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class KubernetesApplication { + + public static void main(String[] args) { + SpringApplication.run(KubernetesApplication.class, args); + } + +} diff --git a/src/main/java/com/personal/example/controller/Person.java b/src/main/java/com/personal/example/controller/Person.java new file mode 100644 index 0000000..bd3e4c8 --- /dev/null +++ b/src/main/java/com/personal/example/controller/Person.java @@ -0,0 +1,16 @@ +package com.personal.example.controller; + +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping(path = "/person", produces = MediaType.APPLICATION_JSON_VALUE) +public class Person { + + @GetMapping("/greet") + public String greet(){ + return "Hello world "; + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/src/test/java/com/personal/example/KuberneteExampleApplicationTests.java b/src/test/java/com/personal/example/KuberneteExampleApplicationTests.java new file mode 100644 index 0000000..84be385 --- /dev/null +++ b/src/test/java/com/personal/example/KuberneteExampleApplicationTests.java @@ -0,0 +1,13 @@ +package com.personal.example; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class KuberneteExampleApplicationTests { + + @Test + void contextLoads() { + } + +}