mirror of
https://gitea.smigz.com/smiggiddy/odin-codeprojects.git
synced 2025-06-27 20:45:35 -04:00
ai testing pipeline
Some checks failed
Build and Push Docker Images / build (admin-dashboard) (push) Failing after 1m13s
Build and Push Docker Images / build (auth-expressjs) (push) Failing after 10s
Build and Push Docker Images / build (battleship) (push) Failing after 9s
Build and Push Docker Images / build (calculator) (push) Failing after 9s
Build and Push Docker Images / build (cv) (push) Failing after 9s
Build and Push Docker Images / build (cv-project) (push) Failing after 10s
Build and Push Docker Images / build (inventory) (push) Failing after 9s
Build and Push Docker Images / build (library) (push) Failing after 9s
Build and Push Docker Images / build (messages) (push) Failing after 10s
Build and Push Docker Images / build (nodejs-mini-message-board) (push) Failing after 10s
Build and Push Docker Images / build (portfolio) (push) Failing after 9s
Build and Push Docker Images / build (restaurant) (push) Failing after 10s
Build and Push Docker Images / build (shopping-cart) (push) Failing after 9s
Build and Push Docker Images / build (signup_form) (push) Failing after 10s
Build and Push Docker Images / build (tictactoe) (push) Failing after 9s
Build and Push Docker Images / build (todo) (push) Failing after 11s
Build and Push Docker Images / build (weather) (push) Failing after 10s
Some checks failed
Build and Push Docker Images / build (admin-dashboard) (push) Failing after 1m13s
Build and Push Docker Images / build (auth-expressjs) (push) Failing after 10s
Build and Push Docker Images / build (battleship) (push) Failing after 9s
Build and Push Docker Images / build (calculator) (push) Failing after 9s
Build and Push Docker Images / build (cv) (push) Failing after 9s
Build and Push Docker Images / build (cv-project) (push) Failing after 10s
Build and Push Docker Images / build (inventory) (push) Failing after 9s
Build and Push Docker Images / build (library) (push) Failing after 9s
Build and Push Docker Images / build (messages) (push) Failing after 10s
Build and Push Docker Images / build (nodejs-mini-message-board) (push) Failing after 10s
Build and Push Docker Images / build (portfolio) (push) Failing after 9s
Build and Push Docker Images / build (restaurant) (push) Failing after 10s
Build and Push Docker Images / build (shopping-cart) (push) Failing after 9s
Build and Push Docker Images / build (signup_form) (push) Failing after 10s
Build and Push Docker Images / build (tictactoe) (push) Failing after 9s
Build and Push Docker Images / build (todo) (push) Failing after 11s
Build and Push Docker Images / build (weather) (push) Failing after 10s
This commit is contained in:
parent
f5fee78b6a
commit
7c3cf4c5c9
1 changed files with 57 additions and 30 deletions
87
.github/workflows/build.yml
vendored
87
.github/workflows/build.yml
vendored
|
@ -11,6 +11,26 @@ jobs:
|
||||||
permissions:
|
permissions:
|
||||||
packages: write
|
packages: write
|
||||||
contents: read
|
contents: read
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
project:
|
||||||
|
- admin-dashboard
|
||||||
|
- auth-expressjs
|
||||||
|
- battleship
|
||||||
|
- calculator
|
||||||
|
- cv
|
||||||
|
- cv-project
|
||||||
|
- inventory
|
||||||
|
- library
|
||||||
|
- messages
|
||||||
|
- nodejs-mini-message-board
|
||||||
|
- portfolio
|
||||||
|
- restaurant
|
||||||
|
- shopping-cart
|
||||||
|
- signup_form
|
||||||
|
- tictactoe
|
||||||
|
- todo
|
||||||
|
- weather
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
@ -25,39 +45,46 @@ jobs:
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push images
|
- name: Build and Push Docker Image
|
||||||
|
id: build-and-push
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/${{ matrix.project }}
|
||||||
IMAGE_NAME_PREFIX: ${{ github.repository_owner }}
|
|
||||||
run: |
|
run: |
|
||||||
set -eux
|
IMAGE_TAG_LATEST=$IMAGE_NAME:latest
|
||||||
|
|
||||||
|
# Check if the latest image exists in the registry
|
||||||
|
IMAGE_EXISTS=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://ghcr.io/v2/${{ github.repository_owner }}/${{ matrix.project }}/manifests/latest")
|
||||||
|
|
||||||
find . -name 'Dockerfile' -path '*/devops/*' -print0 | while IFS= read -r -d $'\0' dockerfile; do
|
if [ "$IMAGE_EXISTS" == "200" ]; then
|
||||||
dir=$(dirname "$dockerfile")
|
echo "Latest image exists, checking for changes..."
|
||||||
project=$(basename "$(dirname "$dir")")
|
|
||||||
image="$REGISTRY/$IMAGE_NAME_PREFIX/$project:latest"
|
|
||||||
echo "Building $image using $dockerfile"
|
|
||||||
|
|
||||||
# Check if an image with the same tag already exists
|
# Get the latest image digest
|
||||||
manifest=$(curl -s -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -u "${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}" "https://ghcr.io/v2/$IMAGE_NAME_PREFIX/$project/manifests/latest" 2> /dev/null)
|
LATEST_DIGEST=$(curl -s -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://ghcr.io/v2/${{ github.repository_owner }}/${{ matrix.project }}/manifests/latest" | jq -r '.config.digest')
|
||||||
if [[ -z "$manifest" ]]; then
|
|
||||||
echo "No existing image found for $project, building..."
|
# Get the digest of the current revision image
|
||||||
docker buildx build --push --platform linux/amd64,linux/arm64 -t "$image" -f "$dockerfile" "$dir"
|
CURRENT_DIGEST=$(docker buildx bake --print ${{ matrix.project }}/devops/Dockerfile | grep '^sha256:' | head -n 1 | awk '{print $2}')
|
||||||
|
|
||||||
|
if [ "$LATEST_DIGEST" == "$CURRENT_DIGEST" ]; then
|
||||||
|
echo "No changes detected, skipping build."
|
||||||
else
|
else
|
||||||
echo "Found existing image for $project, checking for changes..."
|
echo "Changes detected, building..."
|
||||||
|
docker buildx build \
|
||||||
# Determine the last commit hash that resulted in a successful build
|
--push \
|
||||||
last_commit=$(git log -n 1 --pretty=format:%H)
|
-t $IMAGE_TAG_LATEST \
|
||||||
|
-f ${{ matrix.project }}/devops/Dockerfile \
|
||||||
# Get the list of changed files
|
--build-arg TARGET_REVISION=$(git rev-parse HEAD) \
|
||||||
changed_files=$(git diff --name-only "$last_commit" HEAD "$dir" || true)
|
--cache-from type=gha \
|
||||||
|
--cache-to type=gha,mode=max \
|
||||||
# Check if the project has changed
|
${{ matrix.project }}
|
||||||
if [[ -n "$changed_files" ]] || [[ $(git diff --quiet HEAD "$dir" || echo "changed") != "" ]]; then
|
|
||||||
echo "Changes detected for $project, building..."
|
|
||||||
docker buildx build --push --platform linux/amd64,linux/arm64 -t "$image" -f "$dockerfile" "$dir"
|
|
||||||
else
|
|
||||||
echo "No changes detected for $project, skipping build."
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
else
|
||||||
|
echo "Latest image does not exist, building..."
|
||||||
|
docker buildx build \
|
||||||
|
--push \
|
||||||
|
-t $IMAGE_TAG_LATEST \
|
||||||
|
-f ${{ matrix.project }}/devops/Dockerfile \
|
||||||
|
--build-arg TARGET_REVISION=$(git rev-parse HEAD) \
|
||||||
|
--cache-from type=gha \
|
||||||
|
--cache-to type=gha,mode=max \
|
||||||
|
${{ matrix.project }}
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue