P13: build-test-image-push pipeline, cache abhi nahi (baseline naap)
course-p13-ci / pipeline (push) Failing after 54s
course-p13-ci / pipeline (push) Failing after 54s
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
name: build
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
# Runner ke paas sirf do label hain (ubuntu-latest, node-22) — Java ka koi nahi.
|
||||
# Isliye job Maven ke apne image me chalta hai: build ka environment pinned.
|
||||
container:
|
||||
image: maven:3.9-eclipse-temurin-21
|
||||
steps:
|
||||
# actions/checkout NAHI — wo ek JavaScript action hai aur use container ke andar
|
||||
# `node` chahiye, jo maven image me nahi hai. git se clone karna seedha aur saaf hai.
|
||||
- name: Code laao
|
||||
run: git clone --depth 1 http://gitea:3000/abhishek/shopforge.git .
|
||||
- name: Build aur test
|
||||
run: mvn -B clean verify
|
||||
@@ -0,0 +1,47 @@
|
||||
name: course-p13-ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
REGISTRY: git.ridgeserve.duckdns.org
|
||||
IMAGE: git.ridgeserve.duckdns.org/abhishek/course-p13-shopforge
|
||||
|
||||
jobs:
|
||||
pipeline:
|
||||
runs-on: ubuntu-latest
|
||||
# Runner ke paas Java/Maven ka koi label nahi (P02 hissa 7.2). Isliye job apne
|
||||
# image me chalta hai — aur us image me Maven ki dependency pehle se padi hai.
|
||||
container:
|
||||
image: course-p13-builder:nocache
|
||||
steps:
|
||||
# actions/checkout NAHI — wo JavaScript action hai aur use container me node chahiye.
|
||||
# Aur `git clone` bhi nahi: wo default branch ka NAYA commit laata hai, wo nahi
|
||||
# jiske liye ye run bana. Isliye seedha usi commit ko fetch kar rahe hain.
|
||||
- name: Code laao
|
||||
run: |
|
||||
git init -q .
|
||||
git remote add origin http://gitea:3000/abhishek/shopforge.git
|
||||
git fetch -q --depth 1 origin "$GITHUB_SHA" || git fetch -q --depth 1 origin "$GITHUB_REF"
|
||||
git checkout -q FETCH_HEAD
|
||||
|
||||
- name: Test chalao
|
||||
run: mvn -B test
|
||||
|
||||
- name: Jar banao
|
||||
run: mvn -B package -DskipTests
|
||||
|
||||
# Ye do step PR par nahi chalte. PR ka code abhi main par hai hi nahi —
|
||||
# uski image banana matlab registry me kachra bharna.
|
||||
- name: Image banao
|
||||
if: github.event_name == 'push'
|
||||
run: docker build -t "$IMAGE:$GITHUB_SHA" .
|
||||
|
||||
- name: Registry me chadhao
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
echo "${{ secrets.COURSE_P13_REGISTRY_TOKEN }}" \
|
||||
| docker login "$REGISTRY" -u abhishek --password-stdin
|
||||
docker push "$IMAGE:$GITHUB_SHA"
|
||||
Reference in New Issue
Block a user