diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml new file mode 100644 index 0000000..6ab78c6 --- /dev/null +++ b/.github/workflows/ant.yml @@ -0,0 +1,25 @@ +# This workflow will build a Java project with Ant +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant + +name: Java CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + - name: Build with Ant + run: ant -noinput -buildfile build.xml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..63ade82 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Cache SonarCloud packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@v1 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=thimmaiahout_VProfile diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..63ade82 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,36 @@ +name: Build +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Cache SonarCloud packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@v1 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=thimmaiahout_VProfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2295e2d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM jenkins/jenkins +# set maintainer +LABEL maintainer "Optimus" +USER root +COPY . /var/jenkins_home +RUN rm -r -f /var/jenkins_home/RioMobile-iOS +RUN rm -r -f /var/jenkins_home/Rio-mobile +RUN apt update +RUN apt install openjdk-11-jdk -y +# tell docker what port to expose +EXPOSE 8009 diff --git a/app.yml b/app.yml new file mode 100644 index 0000000..925498b --- /dev/null +++ b/app.yml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Service +metadata: + name: my-service +spec: + type: LoadBalancer + ports: + - port: 8080 + selector: + app: my-app diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..389c51d --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,54 @@ +# Docker +# Build and push an image to Azure Container Registry +# https://docs.microsoft.com/azure/devops/pipelines/languages/docker + +trigger: +- master + +resources: +- repo: self + +variables: + # Container registry service connection established during pipeline creation + dockerRegistryServiceConnection: '7828d9da-bf1f-4712-8510-699d959b2c92' + imageRepository: 'thimmaiahoutvprofile' + containerRegistry: 'docker100.azurecr.io' + dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile' + tag: '$(Build.BuildId)' + + # Agent VM image name + vmImageName: 'ubuntu-latest' + +stages: +- stage: Build + displayName: Build and push stage + jobs: + - job: Build + displayName: Build + pool: + vmImage: $(vmImageName) + steps: + - task: Docker@2 + displayName: Build and push an image to container registry + inputs: + command: buildAndPush + repository: $(imageRepository) + dockerfile: $(dockerfilePath) + containerRegistry: $(dockerRegistryServiceConnection) + tags: | + $(tag) +- task: CopyFiles@2 + inputs: + SourceFolder: 'Vprofile' + Contents: | + app.yml + service.yml + TargetFolder: '$(Build.ArtifactStagingDirectory)' + + + + + + + + diff --git a/pom.xml b/pom.xml index 332e952..a665412 100644 --- a/pom.xml +++ b/pom.xml @@ -20,6 +20,8 @@ 1.1.3 1.8 1.8 + thimmaiahout + https://sonarcloud.io diff --git a/service.yml b/service.yml new file mode 100644 index 0000000..f86cd58 --- /dev/null +++ b/service.yml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: app-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: my-app + template: + metadata: + labels: + app: my-app + spec: + containers: + - name: my-image + image: docker100.azurecr.io/thimmaiahoutvprofile + ports: + - containerPort: 8080