This is an automated email from the ASF dual-hosted git repository.

espino pushed a commit to branch container-test-build-publish
in repository https://gitbox.apache.org/repos/asf/cloudberry-devops-release.git

commit e33408e163947415521c9f1e41ab9459ce7ac251
Author: Ed Espino <[email protected]>
AuthorDate: Thu Nov 14 18:17:23 2024 -0800

    test
---
 .github/workflows/docker-cbdb-build-containers.yml | 218 ---------------------
 .github/workflows/docker-cbdb-test-containers.yml  | 180 -----------------
 .github/workflows/test-docker-publish.yml          |  29 +++
 test/Dockerfile                                    |  10 +
 4 files changed, 39 insertions(+), 398 deletions(-)

diff --git a/.github/workflows/docker-cbdb-build-containers.yml 
b/.github/workflows/docker-cbdb-build-containers.yml
deleted file mode 100644
index cd7ba7d..0000000
--- a/.github/workflows/docker-cbdb-build-containers.yml
+++ /dev/null
@@ -1,218 +0,0 @@
-# --------------------------------------------------------------------
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to You under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of the
-# License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-#
-# --------------------------------------------------------------------
-#
-# Purpose: Builds, tests and pushes Docker images for Apache Cloudberry DB 
build environments
-# Images are built for Rocky Linux 8 and 9, tested with TestInfra, and pushed 
to DockerHub
-#
-# Images are tagged with:
-# - cbdb-build-rocky8-latest
-# - cbdb-build-rocky8-{YYYYMMDD}-{git-short-sha}
-# - cbdb-build-rocky9-latest
-# - cbdb-build-rocky9-{YYYYMMDD}-{git-short-sha}
-#
-# Features:
-# - Matrix build for multiple platforms
-# - Caching strategy for efficient builds
-# - Path filtering to only build changed platforms
-# - Comprehensive build summary and metadata
-# - Container testing with TestInfra
-
-name: docker-cbdb-build-containers
-
-# Trigger on pushes to docker-images branch when relevant paths change
-# Also allows manual triggering via GitHub UI
-on:
-  push:
-    branches:
-      - main
-    paths:
-      - 'images/docker/cbdb/build/rocky8/**'
-      - 'images/docker/cbdb/build/rocky9/**'
-  workflow_dispatch:  # Manual trigger
-
-# Prevent multiple workflow runs from interfering with each other
-concurrency:
-  group: docker-build-${{ github.ref }}
-  cancel-in-progress: true
-
-jobs:
-  build-and-push:
-    timeout-minutes: 60  # Prevent hanging builds
-    runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        # Build for both Rocky Linux 8 and 9
-        platform: ['rocky8', 'rocky9']
-
-    steps:
-      # Checkout repository code
-      - name: Checkout code
-        uses: actions/checkout@v4
-
-      # Generate version information for image tags
-      - name: Set version
-        id: version
-        run: |
-          echo "BUILD_DATE=$(date -u +'%Y%m%d')" >> $GITHUB_OUTPUT
-          echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
-
-      # Determine if the current platform's files have changed
-      - name: Determine if platform changed
-        id: platform-filter
-        uses: dorny/paths-filter@v3
-        with:
-          filters: |
-            rocky8:
-              - 'images/docker/cbdb/build/rocky8/**'
-            rocky9:
-              - 'images/docker/cbdb/build/rocky9/**'
-
-      # Skip if no changes for current platform
-      - name: Skip if not relevant
-        if: ${{ steps.platform-filter.outputs[matrix.platform] != 'true' }}
-        run: echo "Skipping because the changes do not affect this platform"
-
-      # Login to DockerHub for pushing images
-      - name: Login to Docker Hub
-        if: ${{ steps.platform-filter.outputs[matrix.platform] == 'true' }}
-        uses: docker/login-action@v3
-        with:
-          username: ${{ secrets.DOCKERHUB_USER }}
-          password: ${{ secrets.DOCKERHUB_TOKEN }}
-
-      # Setup Docker Buildx for efficient builds
-      - name: Set up Docker Buildx
-        if: ${{ steps.platform-filter.outputs[matrix.platform] == 'true' }}
-        uses: docker/setup-buildx-action@v3
-        with:
-          buildkitd-flags: --debug
-
-      # Build the Docker image locally for testing
-      - name: Build Docker image for cbdb-build-${{ matrix.platform }}
-        if: ${{ steps.platform-filter.outputs[matrix.platform] == 'true' }}
-        uses: docker/build-push-action@v6
-        with:
-          context: ./images/docker/cbdb/build/${{ matrix.platform }}
-          push: false  # Don't push yet, we'll test first
-          load: true   # Load into local Docker daemon for testing
-          # Use caching for faster builds
-          cache-from: |
-            type=registry,ref=${{ secrets.DOCKERHUB_USER }}/cbdb-build-${{ 
matrix.platform }}:latest
-            type=gha,scope=docker-cbdb-build-${{ matrix.platform }}
-          cache-to: type=gha,mode=max,scope=docker-cbdb-build-${{ 
matrix.platform }}
-          tags: |
-            cbdb-build-${{ matrix.platform }}:latest
-          # Add metadata labels for better image tracking
-          labels: |
-            org.opencontainers.image.source=${{ github.server_url }}/${{ 
github.repository }}
-            org.opencontainers.image.revision=${{ github.sha }}
-            org.opencontainers.image.created=${{ 
steps.version.outputs.BUILD_DATE }}
-            org.opencontainers.image.version=${{ 
steps.version.outputs.BUILD_DATE }}-${{ steps.version.outputs.SHA_SHORT }}
-
-      # Show available Docker images
-      - name: List Docker images
-        if: ${{ steps.platform-filter.outputs[matrix.platform] == 'true' }}
-        run: docker images
-
-      # Run TestInfra tests against the built image
-      - name: Run Testinfra Tests
-        if: ${{ steps.platform-filter.outputs[matrix.platform] == 'true' }}
-        id: test
-        run: |
-          docker run -d \
-                     -h cdw \
-                     --name cbdb-build-${{ matrix.platform }}-test \
-                     cbdb-build-${{ matrix.platform }}:latest \
-                     bash \
-                     -c "sleep 30"
-          docker exec cbdb-build-${{ matrix.platform }}-test pytest \
-                     --cache-clear \
-                     --disable-warnings \
-                     -p no:warnings \
-                     /tests/testinfra/test_cloudberry_db_env.py
-
-      # Save test results as artifacts
-      - name: Save test results
-        if: always() && steps.platform-filter.outputs[matrix.platform] == 
'true'
-        uses: actions/upload-artifact@v3
-        with:
-          name: test-results-${{ matrix.platform }}
-          path: |
-            test-results/
-          retention-days: 7
-
-      # Cleanup test container
-      - name: Remove Test Container
-        if: always() && steps.platform-filter.outputs[matrix.platform] == 
'true'
-        run: docker rm -f cbdb-build-${{ matrix.platform }}-test
-
-      # Push the image to DockerHub if tests passed
-      - name: Retag and Push Docker image to DockerHub
-        if: steps.test.outcome == 'success' && 
steps.platform-filter.outputs[matrix.platform] == 'true'
-        uses: docker/build-push-action@v6
-        with:
-          context: ./images/docker/cbdb/build/${{ matrix.platform }}
-          push: true
-          cache-from: |
-            type=registry,ref=${{ secrets.DOCKERHUB_USER }}/cbdb-build-${{ 
matrix.platform }}:latest
-            type=gha,scope=docker-cbdb-build-${{ matrix.platform }}
-          tags: |
-            ${{ secrets.DOCKERHUB_USER }}/incubator-cloudberry:cbdb-build-${{ 
matrix.platform }}-latest
-            ${{ secrets.DOCKERHUB_USER }}/incubator-cloudberry:cbdb-build-${{ 
matrix.platform }}-${{ steps.version.outputs.BUILD_DATE }}-${{ 
steps.version.outputs.SHA_SHORT }}
-          labels: |
-            org.opencontainers.image.source=${{ github.server_url }}/${{ 
github.repository }}
-            org.opencontainers.image.revision=${{ github.sha }}
-            org.opencontainers.image.created=${{ 
steps.version.outputs.BUILD_DATE }}
-            org.opencontainers.image.version=${{ 
steps.version.outputs.BUILD_DATE }}-${{ steps.version.outputs.SHA_SHORT }}
-
-      # Generate build summary
-      - name: Build Summary
-        if: always()
-        run: |
-          echo "### Build Summary for ${{ matrix.platform }} 🚀" >> 
$GITHUB_STEP_SUMMARY
-          echo "" >> $GITHUB_STEP_SUMMARY
-
-          echo "#### 🔍 Build Information" >> $GITHUB_STEP_SUMMARY
-          echo "- **Build Status**: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
-          echo "- **Platform**: ${{ matrix.platform }}" >> $GITHUB_STEP_SUMMARY
-          echo "- **Commit SHA**: [\`${{ github.sha }}\`](${{ 
github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})" >> 
$GITHUB_STEP_SUMMARY
-          echo "- **Trigger**: ${{ github.event_name }}" >> 
$GITHUB_STEP_SUMMARY
-          echo "- **Branch**: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
-          echo "- **Build Date**: ${{ steps.version.outputs.BUILD_DATE }}" >> 
$GITHUB_STEP_SUMMARY
-          echo "- **Version Tag**: \`${{ steps.version.outputs.BUILD_DATE 
}}-${{ steps.version.outputs.SHA_SHORT }}\`" >> $GITHUB_STEP_SUMMARY
-          echo "" >> $GITHUB_STEP_SUMMARY
-
-          if [[ "${{ steps.test.outcome }}" == "success" && "${{ 
steps.platform-filter.outputs[matrix.platform] }}" == "true" ]]; then
-            echo "#### 🐳 Docker Image" >> $GITHUB_STEP_SUMMARY
-            echo "- **Repository**: [\`${{ secrets.DOCKERHUB_USER 
}}/cbdb-build-${{ matrix.platform }}\`](https://hub.docker.com/r/${{ 
secrets.DOCKERHUB_USER }}/cbdb-build-${{ matrix.platform }})" >> 
$GITHUB_STEP_SUMMARY
-            echo "- **Tags Pushed**:" >> $GITHUB_STEP_SUMMARY
-            echo "  - \`latest\`" >> $GITHUB_STEP_SUMMARY
-            echo "  - \`${{ steps.version.outputs.BUILD_DATE }}-${{ 
steps.version.outputs.SHA_SHORT }}\`" >> $GITHUB_STEP_SUMMARY
-            echo "" >> $GITHUB_STEP_SUMMARY
-
-            echo "#### 📋 Quick Reference" >> $GITHUB_STEP_SUMMARY
-            echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
-            echo "# Pull the image" >> $GITHUB_STEP_SUMMARY
-            echo "docker pull ${{ secrets.DOCKERHUB_USER }}/cbdb-build-${{ 
matrix.platform }}:${{ steps.version.outputs.BUILD_DATE }}-${{ 
steps.version.outputs.SHA_SHORT }}" >> $GITHUB_STEP_SUMMARY
-            echo "" >> $GITHUB_STEP_SUMMARY
-            echo "# View image details" >> $GITHUB_STEP_SUMMARY
-            echo "docker inspect ${{ secrets.DOCKERHUB_USER }}/cbdb-build-${{ 
matrix.platform }}:${{ steps.version.outputs.BUILD_DATE }}-${{ 
steps.version.outputs.SHA_SHORT }}" >> $GITHUB_STEP_SUMMARY
-            echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
-          fi
diff --git a/.github/workflows/docker-cbdb-test-containers.yml 
b/.github/workflows/docker-cbdb-test-containers.yml
deleted file mode 100644
index d4d3967..0000000
--- a/.github/workflows/docker-cbdb-test-containers.yml
+++ /dev/null
@@ -1,180 +0,0 @@
-# --------------------------------------------------------------------
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to You under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of the
-# License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-#
-# --------------------------------------------------------------------
-#
-# Purpose: Builds, tests and pushes Docker images for Apache Cloudberry DB 
test environments
-# Images are built for Rocky Linux 8 and 9, tested with TestInfra, and pushed 
to DockerHub
-#
-# Images are tagged with:
-# - cbdb-test-rocky8-latest
-# - cbdb-test-rocky8-{YYYYMMDD}-{git-short-sha}
-# - cbdb-test-rocky9-latest
-# - cbdb-test-rocky9-{YYYYMMDD}-{git-short-sha}
-#
-# Features:
-# - Matrix build for multiple platforms
-# - Caching strategy for efficient builds
-# - Path filtering to only build changed platforms
-# - Comprehensive build summary and metadata
-
-name: docker-cbdb-test-containers
-
-# Trigger on pushes to docker-images branch when relevant paths change
-# Also allows manual triggering via GitHub UI
-on:
-  push:
-    branches:
-      - main
-    paths:
-      - 'images/docker/cbdb/test/rocky8/**'
-      - 'images/docker/cbdb/test/rocky9/**'
-  workflow_dispatch:  # Manual trigger
-
-# Prevent multiple workflow runs from interfering with each other
-concurrency:
-  group: docker-test-${{ github.ref }}
-  cancel-in-progress: true
-
-jobs:
-  build-and-push:
-    timeout-minutes: 60  # Prevent hanging builds
-    runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        # Build for both Rocky Linux 8 and 9
-        platform: ['rocky8', 'rocky9']
-
-    steps:
-      # Checkout repository code
-      - name: Checkout code
-        uses: actions/checkout@v4
-
-      # Generate version information for image tags
-      - name: Set version
-        id: version
-        run: |
-          echo "BUILD_DATE=$(date -u +'%Y%m%d')" >> $GITHUB_OUTPUT
-          echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
-
-      # Determine if the current platform's files have changed
-      - name: Determine if platform changed
-        id: platform-filter
-        uses: dorny/paths-filter@v3
-        with:
-          filters: |
-            rocky8:
-              - 'images/docker/cbdb/test/rocky8/**'
-            rocky9:
-              - 'images/docker/cbdb/test/rocky9/**'
-
-      # Skip if no changes for current platform
-      - name: Skip if not relevant
-        if: ${{ steps.platform-filter.outputs[matrix.platform] != 'true' }}
-        run: echo "Skipping because the changes do not affect this platform"
-
-      # Login to DockerHub for pushing images
-      - name: Login to Docker Hub
-        if: ${{ steps.platform-filter.outputs[matrix.platform] == 'true' }}
-        uses: docker/login-action@v3
-        with:
-          username: ${{ secrets.DOCKERHUB_USER }}
-          password: ${{ secrets.DOCKERHUB_TOKEN }}
-
-      # Setup Docker Buildx for efficient builds
-      - name: Set up Docker Buildx
-        if: ${{ steps.platform-filter.outputs[matrix.platform] == 'true' }}
-        uses: docker/setup-buildx-action@v3
-        with:
-          buildkitd-flags: --debug
-
-      # Build the Docker image locally for testing
-      - name: Build Docker image for cbdb-test-${{ matrix.platform }}
-        if: ${{ steps.platform-filter.outputs[matrix.platform] == 'true' }}
-        uses: docker/build-push-action@v6
-        with:
-          context: ./images/docker/cbdb/test/${{ matrix.platform }}
-          push: false  # Don't push yet, we'll test first
-          load: true   # Load into local Docker daemon for testing
-          # Use caching for faster builds
-          cache-from: |
-            type=registry,ref=${{ secrets.DOCKERHUB_USER }}/cbdb-test-${{ 
matrix.platform }}:latest
-            type=gha,scope=docker-cbdb-test-${{ matrix.platform }}
-          cache-to: type=gha,mode=max,scope=docker-cbdb-test-${{ 
matrix.platform }}
-          tags: |
-            cbdb-test-${{ matrix.platform }}:latest
-          # Add metadata labels for better image tracking
-          labels: |
-            org.opencontainers.image.source=${{ github.server_url }}/${{ 
github.repository }}
-            org.opencontainers.image.revision=${{ github.sha }}
-            org.opencontainers.image.created=${{ 
steps.version.outputs.BUILD_DATE }}
-            org.opencontainers.image.version=${{ 
steps.version.outputs.BUILD_DATE }}-${{ steps.version.outputs.SHA_SHORT }}
-
-      # Push the image to DockerHub if tests passed
-      - name: Retag and Push Docker image to DockerHub
-        if: steps.platform-filter.outputs[matrix.platform] == 'true'
-        uses: docker/build-push-action@v6
-        with:
-          context: ./images/docker/cbdb/test/${{ matrix.platform }}
-          push: true
-          cache-from: |
-            type=registry,ref=${{ secrets.DOCKERHUB_USER }}/cbdb-test-${{ 
matrix.platform }}:latest
-            type=gha,scope=docker-cbdb-test-${{ matrix.platform }}
-          tags: |
-            ${{ secrets.DOCKERHUB_USER }}/incubator-cloudberry:cbdb-test-${{ 
matrix.platform }}-latest
-            ${{ secrets.DOCKERHUB_USER }}/incubator-cloudberry:cbdb-test-${{ 
matrix.platform }}-${{ steps.version.outputs.BUILD_DATE }}-${{ 
steps.version.outputs.SHA_SHORT }}
-          labels: |
-            org.opencontainers.image.source=${{ github.server_url }}/${{ 
github.repository }}
-            org.opencontainers.image.revision=${{ github.sha }}
-            org.opencontainers.image.created=${{ 
steps.version.outputs.BUILD_DATE }}
-            org.opencontainers.image.version=${{ 
steps.version.outputs.BUILD_DATE }}-${{ steps.version.outputs.SHA_SHORT }}
-
-      # Generate build summary
-      - name: Build Summary
-        if: always()
-        run: |
-          echo "### Build Summary for ${{ matrix.platform }} 🚀" >> 
$GITHUB_STEP_SUMMARY
-          echo "" >> $GITHUB_STEP_SUMMARY
-
-          echo "#### 🔍 Build Information" >> $GITHUB_STEP_SUMMARY
-          echo "- **Build Status**: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
-          echo "- **Platform**: ${{ matrix.platform }}" >> $GITHUB_STEP_SUMMARY
-          echo "- **Commit SHA**: [\`${{ github.sha }}\`](${{ 
github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})" >> 
$GITHUB_STEP_SUMMARY
-          echo "- **Trigger**: ${{ github.event_name }}" >> 
$GITHUB_STEP_SUMMARY
-          echo "- **Branch**: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
-          echo "- **Build Date**: ${{ steps.version.outputs.BUILD_DATE }}" >> 
$GITHUB_STEP_SUMMARY
-          echo "- **Version Tag**: \`${{ steps.version.outputs.BUILD_DATE 
}}-${{ steps.version.outputs.SHA_SHORT }}\`" >> $GITHUB_STEP_SUMMARY
-          echo "" >> $GITHUB_STEP_SUMMARY
-
-          if [[ "${{ steps.platform-filter.outputs[matrix.platform] }}" == 
"true" ]]; then
-            echo "#### 🐳 Docker Image" >> $GITHUB_STEP_SUMMARY
-            echo "- **Repository**: [\`${{ secrets.DOCKERHUB_USER 
}}/cbdb-test-${{ matrix.platform }}\`](https://hub.docker.com/r/${{ 
secrets.DOCKERHUB_USER }}/cbdb-test-${{ matrix.platform }})" >> 
$GITHUB_STEP_SUMMARY
-            echo "- **Tags Pushed**:" >> $GITHUB_STEP_SUMMARY
-            echo "  - \`latest\`" >> $GITHUB_STEP_SUMMARY
-            echo "  - \`${{ steps.version.outputs.BUILD_DATE }}-${{ 
steps.version.outputs.SHA_SHORT }}\`" >> $GITHUB_STEP_SUMMARY
-            echo "" >> $GITHUB_STEP_SUMMARY
-
-            echo "#### 📋 Quick Reference" >> $GITHUB_STEP_SUMMARY
-            echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
-            echo "# Pull the image" >> $GITHUB_STEP_SUMMARY
-            echo "docker pull ${{ secrets.DOCKERHUB_USER }}/cbdb-test-${{ 
matrix.platform }}:${{ steps.version.outputs.BUILD_DATE }}-${{ 
steps.version.outputs.SHA_SHORT }}" >> $GITHUB_STEP_SUMMARY
-            echo "" >> $GITHUB_STEP_SUMMARY
-            echo "# View image details" >> $GITHUB_STEP_SUMMARY
-            echo "docker inspect ${{ secrets.DOCKERHUB_USER }}/cbdb-test-${{ 
matrix.platform }}:${{ steps.version.outputs.BUILD_DATE }}-${{ 
steps.version.outputs.SHA_SHORT }}" >> $GITHUB_STEP_SUMMARY
-            echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
-          fi
diff --git a/.github/workflows/test-docker-publish.yml 
b/.github/workflows/test-docker-publish.yml
new file mode 100644
index 0000000..0261ab1
--- /dev/null
+++ b/.github/workflows/test-docker-publish.yml
@@ -0,0 +1,29 @@
+name: Test Build & Publish Docker Image
+
+on:
+  push:
+    branches:
+      - container-test-build-publish
+  workflow_dispatch:  # Manual trigger
+
+jobs:
+  build-and-publish:
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v3
+
+      - name: Login to Docker Hub
+        uses: docker/login-action@v3
+        with:
+          username: ${{ secrets.DOCKERHUB_USER }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+      - name: Build - Build the base image
+        uses: docker/build-push-action@v3
+        with:
+          context: test
+          tags: apache/incubator-cloudberry:cbdb-test-alpine
+          platforms: linux/amd64
+          push: true
diff --git a/test/Dockerfile b/test/Dockerfile
new file mode 100644
index 0000000..a2ea9d7
--- /dev/null
+++ b/test/Dockerfile
@@ -0,0 +1,10 @@
+# Start with a lightweight base image
+FROM alpine:latest
+
+# Add some basic metadata
+LABEL maintainer="[email protected]"
+LABEL version="1.0"
+LABEL description="A tiny Docker image for testing purposes"
+
+# Set the default command to run when the container starts
+CMD ["echo", "Hello from your tiny Docker image!"]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to