mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 20:25:50 +00:00
fixing mvn
This commit is contained in:
parent
cb6fba2310
commit
f66f7ea949
1 changed files with 39 additions and 19 deletions
58
.github/workflows/ci-pipeline.yml
vendored
58
.github/workflows/ci-pipeline.yml
vendored
|
@ -1,27 +1,34 @@
|
||||||
name: CI Pipeline with JFrog Artifactory
|
name: Build and Publish with JFrog Artifactory
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [ "main" ]
|
||||||
- main
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches: [ "main" ]
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
################################################################
|
||||||
|
# 1) Check out your code
|
||||||
|
################################################################
|
||||||
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# 2) Set up Java
|
||||||
|
################################################################
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# 3) Install & configure JFrog CLI
|
||||||
|
################################################################
|
||||||
- name: Install JFrog CLI
|
- name: Install JFrog CLI
|
||||||
run: |
|
run: |
|
||||||
curl -fL https://getcli.jfrog.io | bash
|
curl -fL https://getcli.jfrog.io | bash
|
||||||
|
@ -32,10 +39,14 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
jfrog config add my-artifactory \
|
jfrog config add my-artifactory \
|
||||||
--artifactory-url=https://trialt0zppb.jfrog.io/artifactory \
|
--artifactory-url=https://trialt0zppb.jfrog.io/artifactory \
|
||||||
--user=${{ secrets.ARTIFACTORY_USERNAME }} \
|
--user="${{ secrets.ARTIFACTORY_USERNAME }}" \
|
||||||
--password=${{ secrets.ARTIFACTORY_IDENTITY_TOKEN }} \
|
--password="${{ secrets.ARTIFACTORY_IDENTITY_TOKEN }}" \
|
||||||
--interactive=false
|
--interactive=false
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# 4) Configure Maven to Use Artifactory
|
||||||
|
# (jfrog rt mvnc sets up the Maven resolver & deploy repos)
|
||||||
|
################################################################
|
||||||
- name: Configure JFrog CLI for Maven
|
- name: Configure JFrog CLI for Maven
|
||||||
run: |
|
run: |
|
||||||
jfrog rt mvnc \
|
jfrog rt mvnc \
|
||||||
|
@ -46,28 +57,37 @@ jobs:
|
||||||
--repo-deploy-releases=maven-libs-release-local \
|
--repo-deploy-releases=maven-libs-release-local \
|
||||||
--repo-deploy-snapshots=maven-libs-snapshot-local
|
--repo-deploy-snapshots=maven-libs-snapshot-local
|
||||||
|
|
||||||
- name: Debug Maven Settings
|
################################################################
|
||||||
run: mvn help:effective-settings
|
# 5) Clear the local .m2 cache to avoid leftover references
|
||||||
|
################################################################
|
||||||
|
- name: Clear local Maven cache
|
||||||
|
run: rm -rf ~/.m2/repository
|
||||||
|
|
||||||
- name: Compile and Package the Application
|
################################################################
|
||||||
run: mvn clean package -DskipTests
|
# 6) Maven build & publish artifact via JFrog CLI with build info
|
||||||
|
################################################################
|
||||||
- name: Publish Maven Artifact to JFrog Artifactory
|
- name: Build & Publish Maven Artifact
|
||||||
run: |
|
run: |
|
||||||
jfrog rt mvn clean install \
|
jfrog rt mvn clean install \
|
||||||
--build-name=spring-petclinic \
|
--build-name=spring-petclinic \
|
||||||
--build-number=${{ github.run_id }}
|
--build-number="${{ github.run_id }}"
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# 7) Build and push Docker image with JFrog CLI (no 'docker push')
|
||||||
|
################################################################
|
||||||
- name: Build Docker Image
|
- name: Build Docker Image
|
||||||
run: |
|
run: |
|
||||||
docker build -t trialt0zppb.jfrog.io/onboarding-docker-local/spring-petclinic:${{ github.run_id }} .
|
docker build -t trialt0zppb.jfrog.io/onboarding-docker-local/spring-petclinic:${{ github.run_id }} .
|
||||||
|
|
||||||
- name: Push Docker Image to JFrog Artifactory using JFrog CLI
|
- name: Push Docker Image to Artifactory
|
||||||
run: |
|
run: |
|
||||||
jfrog rt docker-push trialt0zppb.jfrog.io/onboarding-docker-local/spring-petclinic:${{ github.run_id }} onboarding-docker-local \
|
jfrog rt docker-push trialt0zppb.jfrog.io/onboarding-docker-local/spring-petclinic:${{ github.run_id }} onboarding-docker-local \
|
||||||
--build-name=spring-petclinic \
|
--build-name=spring-petclinic \
|
||||||
--build-number=${{ github.run_id }}
|
--build-number="${{ github.run_id }}"
|
||||||
|
|
||||||
- name: Publish Build Info to JFrog Artifactory
|
################################################################
|
||||||
|
# 8) Publish the Build Info to Artifactory for full traceability
|
||||||
|
################################################################
|
||||||
|
- name: Publish Build Info
|
||||||
run: |
|
run: |
|
||||||
jfrog rt build-publish spring-petclinic ${{ github.run_id }}
|
jfrog rt build-publish spring-petclinic "${{ github.run_id }}"
|
||||||
|
|
Loading…
Reference in a new issue