spring-petclinic/.github/workflows/ci-pipeline.yml
2025-03-14 12:40:18 -07:00

132 lines
4.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Build with JFrog CLI (Forcing New Extractor)
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
#################################################
# 1) Check out the repository
#################################################
- name: Checkout
uses: actions/checkout@v3
#################################################
# 2) Set up Java
#################################################
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
#################################################
# 3) Download & Override Build-Info Extractor
#
# We manually download a newer build-info-extractor
# to overshadow the old 2.28.6 version. Adjust
# 2.39.6 to any newer version you prefer.
#################################################
- name: Download & Override Build-Info Extractor
run: |
mkdir -p custom-extractor
curl -sSL -o custom-extractor/build-info-extractor-uber.jar \
https://repo1.maven.org/maven2/org/jfrog/buildinfo/build-info-extractor-maven3/2.39.6/build-info-extractor-maven3-2.39.6-uber.jar
echo "JFROG_CLI_BUILD_INFO_EXTRACTOR_DOWNLOAD_URL=file://$(pwd)/custom-extractor/build-info-extractor-uber.jar" >> $GITHUB_ENV
#################################################
# 4) Install JFrog CLI
#################################################
- name: Install JFrog CLI
run: |
curl -fL https://getcli.jfrog.io | bash
chmod +x jfrog
mv jfrog /usr/local/bin/
#################################################
# 5) Configure JFrog CLI
#################################################
- name: Configure JFrog CLI
run: |
jfrog config add my-artifactory \
--artifactory-url=https://trialt0zppb.jfrog.io/artifactory \
--user="${{ secrets.ARTIFACTORY_USERNAME }}" \
--password="${{ secrets.ARTIFACTORY_IDENTITY_TOKEN }}" \
--interactive=false
#################################################
# 6) Configure Maven Repos (Optional)
#
# If you want to ensure dependencies are fetched
# through Artifactory, uncomment the jfrog rt mvnc
# step below. If you're just hooking the build-info
# for publishing, you can skip it.
#################################################
# - name: Configure JFrog CLI for Maven
# run: |
# jfrog rt mvnc \
# --server-id-resolve=my-artifactory \
# --repo-resolve-releases=maven-maven-remote \
# --repo-resolve-snapshots=maven-maven-remote \
# --server-id-deploy=my-artifactory \
# --repo-deploy-releases=maven-libs-release-local \
# --repo-deploy-snapshots=maven-libs-snapshot-local
#################################################
# 7) Clear local Maven cache
#################################################
- name: Clear local Maven cache
run: rm -rf ~/.m2/repository
- name: Ensure mvnw is executable
run: chmod +x mvnw
- name: check mvn version
run: ./mvnw -version
- name: Debug repository files
run: ls -lah
#################################################
# 8) Build via jfrog rt mvn, using the new extractor jar
#
# Notice the flags: -X -e for debug; remove them once
# you confirm its working.
#################################################
- name: Maven Build With JFrog CLI
run: |
jfrog rt mvn clean package -X -e \
--build-name="spring-petclinic" \
--build-number="${{ github.run_id }}"
#################################################
# 9) Build Docker Image
#################################################
- name: Build Docker Image
run: |
docker build -t trialt0zppb.jfrog.io/onboarding-docker-local/spring-petclinic:${{ github.run_id }} .
#################################################
# 10) Push Docker Image via JFrog CLI
#################################################
- name: Docker Push to Artifactory
run: |
jfrog rt docker-push \
trialt0zppb.jfrog.io/onboarding-docker-local/spring-petclinic:${{ github.run_id }} \
onboarding-docker-local \
--build-name="spring-petclinic" \
--build-number="${{ github.run_id }}"
#################################################
# 11) Publish Build Info
#################################################
- name: Publish Build Info
run: |
jfrog rt build-publish "spring-petclinic" "${{ github.run_id }}"