From 1954129e01ceac4c6f42ee34b0b512d75b8f4ec4 Mon Sep 17 00:00:00 2001 From: Artsiom Koltun Date: Thu, 26 Oct 2023 09:01:52 +0200 Subject: [PATCH] ci: reuse docker job from actions Signed-off-by: Artsiom Koltun --- .github/workflows/docker-publish.yml | 84 +--------------------------- docker-compose.yml | 26 +++++++++ 2 files changed, 29 insertions(+), 81 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index c46e01b6..43a7b18f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -12,89 +12,11 @@ on: permissions: contents: read -concurrency: - # if workflow for PR or push is already running stop it, and start new one - group: poc-storage-${{ github.ref }} - cancel-in-progress: true - jobs: - storage-push: - runs-on: ubuntu-latest + call: permissions: contents: read packages: write id-token: write - steps: - - uses: actions/checkout@v4 - - uses: docker/setup-qemu-action@v3 - - uses: docker/setup-buildx-action@v3.0.0 - - - name: Log in to Docker Hub - if: github.event_name != 'pull_request' - uses: docker/login-action@v3.0.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Log in to the GH Container registry - if: github.event_name != 'pull_request' - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5.0.0 - with: - images: | - ${{ github.repository }} - ghcr.io/${{ github.repository }} - - - name: Get opi-api Version - run: echo "OPI_API_VERSION=$(go list -m -f '{{.Version}}' github.com/opiproject/opi-api)" >> $GITHUB_ENV - - - name: Build and push Docker image - uses: docker/build-push-action@v5.0.0 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: | - ${{ steps.meta.outputs.labels }}, - opi-api-version=${{ env.OPI_API_VERSION }} - cache-from: type=gha - cache-to: type=gha,mode=max - - storage-ci: - runs-on: ubuntu-latest - steps: - - name: configure HUGE pages - run: | - sync - echo 1 | sudo tee /proc/sys/vm/drop_caches - sudo mkdir -p /mnt/huge - grep hugetlbfs /proc/mounts || sudo mount -t hugetlbfs nodev /mnt/huge - echo 1024 | sudo tee /proc/sys/vm/nr_hugepages - echo "Check and fail if not enough" - grep 1024 /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages - - - uses: actions/checkout@v4 - - uses: docker/setup-qemu-action@v3 - - uses: docker/setup-buildx-action@5d9862498505fcac67b9f455d6e94ec0339f7b90 - - - name: Start containers - run: docker-compose up --build --force-recreate --detach - - - name: Run Tests - run: ./scripts/tests.sh - - - name: Logs - if: always() - run: docker-compose logs - - - name: Stop containers - if: always() - run: docker-compose down --volumes --remove-orphans + uses: opiproject/actions/.github/workflows/docker-publish.yml@main + secrets: inherit diff --git a/docker-compose.yml b/docker-compose.yml index 630b2740..e70650d1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -69,6 +69,8 @@ services: condition: service_healthy redis: condition: service_healthy + jaeger: + condition: service_started command: sh -c "/opi-spdk-bridge -grpc_port=50051 -http_port=8082 -spdk_addr=/var/tmp/spdk.sock -redis_addr=redis:6379" healthcheck: test: grpcurl -plaintext localhost:50051 list || exit 1 @@ -77,6 +79,8 @@ services: image: redis:7.2.2-alpine3.18 networks: - opi + ports: + - "6379:6379" healthcheck: test: ["CMD", "redis-cli", "--raw", "incr", "ping"] @@ -100,6 +104,15 @@ services: condition: service_healthy command: curl -qkL http://opi-spdk-server:8082/v1/inventory/1/inventory/2 + opi-jaeger-test: + image: curlimages/curl:8.4.0 + networks: + - opi + depends_on: + opi-spdk-client: + condition: service_completed_successfully + command: sh -c 'curl -s "http://jaeger:16686/api/traces?service=opi-spdk-bridge&lookback=20m&prettyPrint=true&limit=10" | grep operationName' + opi-spdk-client: image: ghcr.io/opiproject/godpu:main@sha256:2b55d76814befaec963e378b1764a611f37698c70fd55bfe2ddf07f06393fa28 networks: @@ -109,5 +122,18 @@ services: condition: service_healthy command: storage test --addr=opi-spdk-server:50051 + opi-test: + image: docker.io/namely/grpc-cli + networks: + - opi + depends_on: + opi-spdk-client: + condition: service_completed_successfully + opi-gw-test: + condition: service_completed_successfully + opi-jaeger-test: + condition: service_completed_successfully + command: ls opi-spdk-server:50051 opi_api.storage.v1.FrontendNvmeService -l + networks: opi: