diff --git a/.github/workflows/build-agent-container.yml b/.github/workflows/build-agent-container.yml deleted file mode 100644 index f79bc12c3..000000000 --- a/.github/workflows/build-agent-container.yml +++ /dev/null @@ -1,105 +0,0 @@ -name: Build Agents - -on: - workflow_run: - workflows: ["Build Production Rust Code"] - branches: - - main - - 'v[0-9]+.[0-9]+.[0-9]+*' - types: - - completed - -jobs: - - per-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - akri-component: - - agent - - agent-full - - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Download rust build artifacts - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - workflow_conclusion: success - commit: ${{ github.event.workflow_run.head_sha }} - name: rust-${{ matrix.arch }}-binaries - path: /tmp - - - name: Unpack Rust binaries - run: | - tar -xvf /tmp/rust-${{ matrix.arch }}-binaries.tar - - - name: Run Per-Arch component build for ${{ matrix.akri-component }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - github_ref: ${{ github.ref }} - container_name: ${{ matrix.akri-component }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ matrix.akri-component }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} && ((github.event.workflow_run.event == 'release') || (github.event.workflow_run.event == 'push' && github.ref == 'refs/heads/main')) - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 - strategy: - matrix: - akri-component: - - agent - - agent-full - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ matrix.akri-component }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - container_name: ${{ matrix.akri-component }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ matrix.akri-component }} diff --git a/.github/workflows/build-anomaly-detection-app-container.yml b/.github/workflows/build-anomaly-detection-app-container.yml deleted file mode 100644 index 0d327b5ca..000000000 --- a/.github/workflows/build-anomaly-detection-app-container.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: Build Anomaly Detection App Container - -on: - push: - branches: [ main ] - paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - - .github/workflows/build-anomaly-detection-app-container.yml - - build/containers/Dockerfile.anomaly-detection-app - - samples/apps/anomaly-detection-app/** - - version.txt - - build/akri-containers.mk - - build/akri-python-containers.mk - - Makefile - pull_request: - branches: [ main ] - paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - - .github/workflows/build-anomaly-detection-app-container.yml - - build/containers/Dockerfile.anomaly-detection-app - - samples/apps/anomaly-detection-app/** - - version.txt - - build/akri-containers.mk - - build/akri-python-containers.mk - - Makefile - release: - types: - - published - -env: - AKRI_COMPONENT: anomaly-detection-app - MAKEFILE_COMPONENT: anomaly-detection - -jobs: - - per-arch: - runs-on: ubuntu-latest - timeout-minutes: 20 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event_name }} - github_ref: ${{ github.ref }} - github_event_action: ${{ github.event.action }} - github_merged: ${{ github.event.pull_request.merged }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: (github.event_name == 'release') || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (startsWith(github.event_name, 'pull_request') && github.event.action == 'closed' && github.event.pull_request.merged == true && github.ref != 'refs/heads/main') - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event_name }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} \ No newline at end of file diff --git a/.github/workflows/build-controller-container.yml b/.github/workflows/build-controller-container.yml deleted file mode 100644 index 0bc17c9af..000000000 --- a/.github/workflows/build-controller-container.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Build Controller - -on: - workflow_run: - workflows: ["Build Production Rust Code"] - branches: - - main - - 'v[0-9]+.[0-9]+.[0-9]+*' - types: - - completed - -env: - AKRI_COMPONENT: controller - MAKEFILE_COMPONENT: controller - -jobs: - - per-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Download rust build artifacts - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - workflow_conclusion: success - commit: ${{ github.event.workflow_run.head_sha }} - name: rust-${{ matrix.arch }}-binaries - path: /tmp - - - name: Unpack Rust binaries - run: | - tar -xvf /tmp/rust-${{ matrix.arch }}-binaries.tar - - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - github_ref: ${{ github.ref }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} && ((github.event.workflow_run.event == 'release') || (github.event.workflow_run.event == 'push' && github.ref == 'refs/heads/main')) - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} diff --git a/.github/workflows/build-discovery-handlers.yml b/.github/workflows/build-discovery-handlers.yml deleted file mode 100644 index 3051e83fa..000000000 --- a/.github/workflows/build-discovery-handlers.yml +++ /dev/null @@ -1,109 +0,0 @@ -name: Build Discovery Handlers - -on: - workflow_run: - workflows: ["Build Production Rust Code"] - branches: - - main - - 'v[0-9]+.[0-9]+.[0-9]+*' - types: - - completed - -jobs: - - per-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - akri-component: - - debug-echo-discovery - - udev-discovery - - onvif-discovery - - opcua-discovery - - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Download rust build artifacts - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - workflow_conclusion: success - commit: ${{ github.event.workflow_run.head_sha }} - name: rust-${{ matrix.arch }}-binaries - path: /tmp - - - name: Unpack Rust binaries - run: | - tar -xvf /tmp/rust-${{ matrix.arch }}-binaries.tar - - - name: Run Per-Arch component build for ${{ matrix.akri-component }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - github_ref: ${{ github.ref }} - container_name: ${{ matrix.akri-component }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ matrix.akri-component }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} && ((github.event.workflow_run.event == 'release') || (github.event.workflow_run.event == 'push' && github.ref == 'refs/heads/main')) - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 - strategy: - matrix: - akri-component: - - debug-echo-discovery - - udev-discovery - - onvif-discovery - - opcua-discovery - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ matrix.akri-component }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - container_name: ${{ matrix.akri-component }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ matrix.akri-component }} diff --git a/.github/workflows/build-onvif-video-broker-container.yml b/.github/workflows/build-onvif-video-broker-container.yml index 3b2211c0a..524636e26 100644 --- a/.github/workflows/build-onvif-video-broker-container.yml +++ b/.github/workflows/build-onvif-video-broker-container.yml @@ -4,26 +4,20 @@ on: push: branches: [ main ] paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - .github/workflows/build-onvif-video-broker-container.yml - build/containers/Dockerfile.onvif-video-broker - samples/brokers/onvif-video-broker/** - version.txt - - build/akri-containers.mk - - build/akri-dotnet-containers.mk + - build/samples.mk - Makefile pull_request: branches: [ main ] paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - .github/workflows/build-onvif-video-broker-container.yml - build/containers/Dockerfile.onvif-video-broker - samples/brokers/onvif-video-broker/** - version.txt - - build/akri-containers.mk - - build/akri-dotnet-containers.mk + - build/samples.mk - Makefile release: types: @@ -34,16 +28,9 @@ env: MAKEFILE_COMPONENT: onvif jobs: - - per-arch: + build-broker: runs-on: ubuntu-latest timeout-minutes: 20 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 steps: - name: Checkout the head commit of the branch @@ -51,59 +38,24 @@ jobs: with: persist-credentials: false - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps + - name: Get version.txt + id: version-string run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs + echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event_name }} - github_ref: ${{ github.ref }} - github_event_action: ${{ github.event.action }} - github_merged: ${{ github.event.pull_request.merged }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: (github.event_name == 'release') || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (startsWith(github.event_name, 'pull_request') && github.event.action == 'closed' && github.event.pull_request.merged == true && github.ref != 'refs/heads/main') - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - steps: - - name: Checkout repo - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 with: - persist-credentials: false + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps + - name: Build and push run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs + make onvif-video-broker $(${{ github.event_name != 'pull_request' }} && echo "PUSH=1") - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event_name }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} diff --git a/.github/workflows/build-opcua-monitoring-broker-container.yml b/.github/workflows/build-opcua-monitoring-broker-container.yml index 971369d0d..0e43e6320 100644 --- a/.github/workflows/build-opcua-monitoring-broker-container.yml +++ b/.github/workflows/build-opcua-monitoring-broker-container.yml @@ -4,46 +4,26 @@ on: push: branches: [ main ] paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - .github/workflows/build-opcua-monitoring-broker-container.yml - build/containers/Dockerfile.opcua-monitoring-broker - samples/brokers/opcua-monitoring-broker/** - version.txt - - build/akri-containers.mk - - build/akri-dotnet-containers.mk - - Makefile pull_request: branches: [ main ] paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - .github/workflows/build-opcua-monitoring-broker-container.yml - build/containers/Dockerfile.opcua-monitoring-broker - samples/brokers/opcua-monitoring-broker/** - version.txt - - build/akri-containers.mk - - build/akri-dotnet-containers.mk - - Makefile release: types: - published -env: - AKRI_COMPONENT: opcua-monitoring-broker - MAKEFILE_COMPONENT: opcua-monitoring - jobs: - per-arch: + build-broker: runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 + timeout-minutes: 20 steps: - name: Checkout the head commit of the branch @@ -51,57 +31,43 @@ jobs: with: persist-credentials: false - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps + - name: Get version.txt + id: version-string run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs + echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event_name }} - github_ref: ${{ github.ref }} - github_event_action: ${{ github.event.action }} - github_merged: ${{ github.event.pull_request.merged }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: (github.event_name == 'release') || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (startsWith(github.event_name, 'pull_request') && github.event.action == 'closed' && github.event.pull_request.merged == true && github.ref != 'refs/heads/main') - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - steps: - - name: Checkout repo - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Prepare To Install - uses: actions/setup-node@v3 + - name: Docker meta + uses: docker/metadata-action@v5 + id: meta with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs + images: ghcr.io/project-akri/akri/opcua-monitoring-broker + labels: | + org.opencontainers.image.title=akri-opcua-monitoring-broker + org.opencontainers.image.description=Akri sample opcua monitoring broker + tags: | + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=${{steps.version-string.outputs.version}},enable=${{github.event_name != 'release'}} - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch + - name: Build and push + uses: docker/build-push-action@v5 with: - github_event_name: ${{ github.event_name }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} \ No newline at end of file + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + file: build/containers/Dockerfile.opcua-monitoring-broker + platforms: linux/amd64,linux/arm64,linux/arm/v7 diff --git a/.github/workflows/build-opencv-base-container.yml b/.github/workflows/build-opencv-base-container.yml index 22e7fba05..06a204fdb 100644 --- a/.github/workflows/build-opencv-base-container.yml +++ b/.github/workflows/build-opencv-base-container.yml @@ -20,7 +20,6 @@ on: - Makefile issue_comment: types: [created, edited] - branches: [ main ] env: AKRI_COMPONENT: opencvsharp-build @@ -28,81 +27,10 @@ env: jobs: - add-same-version-label-to-pr: - runs-on: ubuntu-latest - if: github.event_name == 'issue_comment' && contains(github.event.comment.body, '/add-same-version-label') - steps: - - uses: actions/checkout@v3 - - name: Add same version label - uses: actions/github-script@v6 - if: success() - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['same version'] - }) - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: '👋 Added [same version] label :)!' - }) - add-build-label-to-pr: - runs-on: ubuntu-latest - if: github.event_name == 'issue_comment' && contains(github.event.comment.body, '/add-build-dependency-containers-label') - steps: - - uses: actions/checkout@v3 - - name: Add build dependency containers label - uses: actions/github-script@v6 - if: success() - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['build dependency containers'] - }) - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: '👋 Added [build dependency containers] label :)!' - }) - - add-label-missing-comment: - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && (github.event.action == 'opened') && !contains(github.event.pull_request.labels.*.name, 'build dependency containers') - steps: - - uses: actions/checkout@v3 - - name: Add comment about missing build dependency containers label - uses: actions/github-script@v6 - if: success() - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.rest.issues.createComment({ - issue_number: context.payload.pull_request.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Hi there, this change should run build dependency containers, but running it will take hours. Do you want to run it? If so, please add label "build dependency containers" by commenting "/add-build-dependency-containers-label".' - }) - per-arch: - if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'build dependency containers') + build-container: runs-on: ubuntu-latest - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 steps: - name: Checkout the head commit of the branch uses: actions/checkout@v3 @@ -118,26 +46,43 @@ jobs: git fetch origin main git diff origin/main -- ./build/intermediate-containers.mk | grep "BUILD_OPENCV_BASE_VERSION = " | wc -l | grep -v 0 - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps + + - name: Get version.txt + id: version-string run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs + grep "BUILD_OPENCV_BASE_VERSION =" build/intermediate-containers.mk | tr -d ' ' >> $GITHUB_OUTPUT - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-intermediate + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 with: - github_event_name: ${{ github.event_name }} - github_ref: ${{ github.ref }} - github_event_action: ${{ github.event.action }} - github_merged: ${{ github.event.pull_request.merged }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + uses: docker/metadata-action@v5 + id: meta + with: + images: ghcr.io/project-akri/akri/opencvsharp-build + labels: | + org.opencontainers.image.title=akri-opencvsharp + org.opencontainers.image.description=Akri opencvsharp base image for samples build + tags: | + type=ref,event=pr + type=raw,value=${{steps.version-string.outputs.version}} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + file: build/containers/intermediate/Dockerfile.opencvsharp-build + platforms: linux/amd64,linux/arm64,linux/arm/v7 + diff --git a/.github/workflows/build-python-app-containers.yml b/.github/workflows/build-python-app-containers.yml new file mode 100644 index 000000000..b67b5cf94 --- /dev/null +++ b/.github/workflows/build-python-app-containers.yml @@ -0,0 +1,81 @@ +name: Build Sample Apps Containers + +on: + push: + branches: [ main ] + paths: + - .github/workflows/build-python-app-container.yml + - build/containers/Dockerfile.python-app + - samples/apps/** + - version.txt + pull_request: + branches: [ main ] + paths: + - .github/workflows/build-python-app-container.yml + - build/containers/Dockerfile.python-app + - samples/apps/** + - version.txt + release: + types: + - published + +jobs: + + build-apps: + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + component: + - anomaly-detection-app + - video-streaming-app + + steps: + - name: Checkout the head commit of the branch + uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Get version.txt + id: version-string + run: | + echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + uses: docker/metadata-action@v5 + id: meta + with: + images: ghcr.io/project-akri/akri/${{ matrix.component }} + labels: | + org.opencontainers.image.title=akri-${{matrix.component}} + org.opencontainers.image.description=Akri Sample App + tags: | + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=${{steps.version-string.outputs.version}},enable=${{github.event_name != 'release'}} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + build-args: | + APPLICATION=${{matrix.component}} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + file: build/containers/Dockerfile.python-app + # Don't build python sample apps for arm/v7 as many modules don't provide armv7 wheels. + platforms: linux/amd64,linux/arm64 \ No newline at end of file diff --git a/.github/workflows/build-rust-code.yml b/.github/workflows/build-rust-code.yml index 84c5f71f7..5caeedf1a 100644 --- a/.github/workflows/build-rust-code.yml +++ b/.github/workflows/build-rust-code.yml @@ -1,69 +1,41 @@ -name: Build Production Rust Code +name: Build Production Rust Containers on: push: branches: [ main ] paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - .github/workflows/build-rust-code.yml - - .github/workflows/build-agent-container.yml - - .github/workflows/build-controller-container.yml - - .github/workflows/build-udev-video-broker-container.yml - - .github/workflows/build-webhook-configuration-container.yml - - build/containers/Dockerfile.agent - - build/containers/Dockerfile.controller - - build/containers/Dockerfile.udev-video-broker - - build/containers/Dockerfile.webhook-configuration + - build/containers/Dockerfile.rust - '**.rs' - '**/Cargo.toml' - '**/Cargo.lock' - version.txt - - build/akri-containers.mk - - build/akri-rust-containers.mk - - Makefile pull_request: branches: [ main ] paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - .github/workflows/build-rust-code.yml - - .github/workflows/build-agent-container.yml - - .github/workflows/build-controller-container.yml - - .github/workflows/build-udev-video-broker-container.yml - - .github/workflows/build-webhook-configuration-container.yml - - build/containers/Dockerfile.agent - - build/containers/Dockerfile.controller - - build/containers/Dockerfile.udev-video-broker - - build/containers/Dockerfile.webhook-configuration + - build/containers/Dockerfile.rust - '**.rs' - '**/Cargo.toml' - '**/Cargo.lock' - version.txt - - build/akri-containers.mk - - build/akri-rust-containers.mk - - Makefile release: types: - published jobs: - build-rust: + build-agents: + # Run separately to heat the cache for every architecture runs-on: ubuntu-latest - timeout-minutes: 50 + timeout-minutes: 60 strategy: matrix: - arch: - - label: arm64v8 - make-target: arm64 - rust-target-path: aarch64-unknown-linux-gnu - - label: arm32v7 - make-target: arm32 - rust-target-path: armv7-unknown-linux-gnueabihf - - label: amd64 - make-target: amd64 - rust-target-path: x86_64-unknown-linux-gnu + component: + - label: agent + cargo-build-args: --release + - label: agent-full + cargo-build-args: --release -F agent-full,onvif-feat,opcua-feat,udev-feat steps: - name: Checkout the head commit of the branch @@ -71,32 +43,106 @@ jobs: with: persist-credentials: false - - name: Rust install - uses: dtolnay/rust-toolchain@master + - name: Get version.txt + id: version-string + run: | + echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 with: - toolchain: 1.68.1 - components: clippy, rustfmt + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Build production rust for ${{ matrix.arch.label }} - env: - AGENT_FEATURES: "agent-full onvif-feat opcua-feat udev-feat" - run: | - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - make install-cross - cross --version - make akri-cross-build-${{ matrix.arch.make-target }} + - name: Docker meta + uses: docker/metadata-action@v5 + id: meta + with: + images: ghcr.io/project-akri/akri/${{ matrix.component.label }} + labels: | + org.opencontainers.image.title=akri-${{matrix.component.label}} + tags: | + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=${{steps.version-string.outputs.version}},enable=${{github.event_name != 'release'}} - - name: Package build binaries + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + build-args: | + AKRI_COMPONENT=agent + EXTRA_CARGO_ARGS=${{matrix.component.cargo-build-args}} + cache-from: type=gha,scope=${{github.ref_name}}-${{matrix.component.label}} + cache-to: type=gha,mode=max,scope=${{github.ref_name}}-${{matrix.component.label}} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + file: build/containers/Dockerfile.rust + platforms: linux/amd64,linux/arm64,linux/arm/v7 + + build-others: + runs-on: ubuntu-latest + needs: build-agents + timeout-minutes: 50 + strategy: + matrix: + component: + - label: controller + - label: webhook-configuration + - label: debug-echo-discovery-handler + - label: udev-discovery-handler + - label: opcua-discovery-handler + - label: onvif-discovery-handler + - label: udev-video-broker + + steps: + - name: Checkout the head commit of the branch + uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Get version.txt + id: version-string run: | - tar_manifest='/tmp/tar-contents.txt' - > $tar_manifest - for f in target/${{ matrix.arch.rust-target-path }}/release/*; do filetype=$( file "$f" ); case "$filetype" in *ELF*) echo "$f" >> $tar_manifest ;; esac; done - tar -cvf /tmp/rust-${{ matrix.arch.label }}-binaries.tar `cat $tar_manifest` + echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT - - name: Upload target binaries as artifact - uses: actions/upload-artifact@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + uses: docker/metadata-action@v5 + id: meta with: - name: rust-${{ matrix.arch.label }}-binaries - path: /tmp/rust-${{ matrix.arch.label }}-binaries.tar - retention-days: 1 + images: ghcr.io/project-akri/akri/${{ matrix.component.label }} + labels: | + org.opencontainers.image.title=akri-${{matrix.component.label}} + tags: | + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=${{steps.version-string.outputs.version}},enable=${{github.event_name != 'release'}} + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + build-args: | + AKRI_COMPONENT=agent + EXTRA_CARGO_ARGS=--release + cache-from: type=gha,scope=${{github.ref_name}}-agent + # No cache-to here as we want to use the one from agent + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + file: build/containers/Dockerfile.rust + platforms: linux/amd64,linux/arm64,linux/arm/v7 \ No newline at end of file diff --git a/.github/workflows/build-rust-crossbuild-container.yml b/.github/workflows/build-rust-crossbuild-container.yml deleted file mode 100644 index a8e13a1d2..000000000 --- a/.github/workflows/build-rust-crossbuild-container.yml +++ /dev/null @@ -1,143 +0,0 @@ -name: Build Rust CrossBuild - -on: - push: - branches: [ main ] - paths: - - .github/actions/build-intermediate/** - - .github/workflows/build-rust-crossbuild-container.yml - - build/containers/intermediate/Dockerfile.rust-crossbuild-* - - build/intermediate-containers.mk - - Makefile - pull_request: - types: [opened, synchronize, reopened, labeled] - branches: [ main ] - paths: - - .github/actions/build-intermediate/** - - .github/workflows/build-rust-crossbuild-container.yml - - build/containers/intermediate/Dockerfile.rust-crossbuild-* - - build/intermediate-containers.mk - - Makefile - issue_comment: - types: [created, edited] - branches: [ main ] - -env: - AKRI_COMPONENT: rust-crossbuild - MAKEFILE_COMPONENT: rust-crossbuild - -jobs: - - add-same-version-label-to-pr: - runs-on: ubuntu-latest - if: github.event_name == 'issue_comment' && contains(github.event.comment.body, '/add-same-version-label') - steps: - - uses: actions/checkout@v3 - - name: Add same version label - uses: actions/github-script@v6 - if: success() - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['same version'] - }) - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: '👋 Added [same version] label :)!' - }) - - add-build-label-to-pr: - runs-on: ubuntu-latest - if: github.event_name == 'issue_comment' && contains(github.event.comment.body, '/add-build-dependency-containers-label') - steps: - - uses: actions/checkout@v3 - - name: Add build dependency containers label - uses: actions/github-script@v6 - if: success() - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['build dependency containers'] - }) - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: '👋 Added [build dependency containers] label :)!' - }) - - add-label-missing-comment: - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && (github.event.action == 'opened') && !contains(github.event.pull_request.labels.*.name, 'build dependency containers') - steps: - - uses: actions/checkout@v3 - - name: Add comment about missing build dependency containers label - uses: actions/github-script@v6 - if: success() - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.rest.issues.createComment({ - issue_number: context.payload.pull_request.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Hi there, this change should run build dependency containers, but running it will take hours. Do you want to run it? If so, please add label "build dependency containers" by commenting "/add-build-dependency-containers-label".' - }) - - per-arch: - if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'build dependency containers') - runs-on: ubuntu-latest - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - # Only run build version change check if PR does not have "same version" label - - if: >- - startsWith(github.event_name, 'pull_request') && - !contains(github.event.pull_request.labels.*.name, 'same version') - name: Ensure that ${{ env.AKRI_COMPONENT }} version has changed - run: | - git fetch origin main - git diff origin/main -- ./build/intermediate-containers.mk | grep "BUILD_RUST_CROSSBUILD_VERSION = " | wc -l | grep -v 0 - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-intermediate - with: - github_event_name: ${{ github.event_name }} - github_ref: ${{ github.ref }} - github_event_action: ${{ github.event.action }} - github_merged: ${{ github.event.pull_request.merged }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} diff --git a/.github/workflows/build-udev-video-broker-container.yml b/.github/workflows/build-udev-video-broker-container.yml deleted file mode 100644 index a99757df4..000000000 --- a/.github/workflows/build-udev-video-broker-container.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Build UDEV Broker - -on: - workflow_run: - workflows: ["Build Production Rust Code"] - branches: - - main - - 'v[0-9]+.[0-9]+.[0-9]+*' - types: - - completed - -env: - AKRI_COMPONENT: udev-video-broker - MAKEFILE_COMPONENT: udev - -jobs: - - per-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Download rust build artifacts - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - workflow_conclusion: success - commit: ${{ github.event.workflow_run.head_sha }} - name: rust-${{ matrix.arch }}-binaries - path: /tmp - - - name: Unpack Rust binaries - run: | - tar -xvf /tmp/rust-${{ matrix.arch }}-binaries.tar - - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - github_ref: ${{ github.ref }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} && ((github.event.workflow_run.event == 'release') || (github.event.workflow_run.event == 'push' && github.ref == 'refs/heads/main')) - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} diff --git a/.github/workflows/build-video-streaming-app-container.yml b/.github/workflows/build-video-streaming-app-container.yml deleted file mode 100644 index 3451ff02a..000000000 --- a/.github/workflows/build-video-streaming-app-container.yml +++ /dev/null @@ -1,109 +0,0 @@ -name: Build Video Streaming App Container - -on: - push: - branches: [ main ] - paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - - .github/workflows/build-video-streaming-app-container.yml - - build/containers/Dockerfile.video-streaming-app - - samples/apps/video-streaming-app/** - - version.txt - - build/akri-containers.mk - - build/akri-python-containers.mk - - Makefile - pull_request: - branches: [ main ] - paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - - .github/workflows/build-video-streaming-app-container.yml - - build/containers/Dockerfile.video-streaming-app - - samples/apps/video-streaming-app/** - - version.txt - - build/akri-containers.mk - - build/akri-python-containers.mk - - Makefile - release: - types: - - published - -env: - AKRI_COMPONENT: video-streaming-app - MAKEFILE_COMPONENT: streaming - -jobs: - - per-arch: - runs-on: ubuntu-latest - timeout-minutes: 20 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event_name }} - github_ref: ${{ github.ref }} - github_event_action: ${{ github.event.action }} - github_merged: ${{ github.event.pull_request.merged }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: (github.event_name == 'release') || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (startsWith(github.event_name, 'pull_request') && github.event.action == 'closed' && github.event.pull_request.merged == true && github.ref != 'refs/heads/main') - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event_name }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} diff --git a/.github/workflows/build-webhook-configuration-container.yml b/.github/workflows/build-webhook-configuration-container.yml deleted file mode 100644 index c67d6da55..000000000 --- a/.github/workflows/build-webhook-configuration-container.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: Build Webhook Configuration - -on: - workflow_run: - workflows: ["Build Production Rust Code"] - branches: - - main - - 'v[0-9]+.[0-9]+.[0-9]+*' - types: - - completed - -env: - AKRI_COMPONENT: webhook-configuration - MAKEFILE_COMPONENT: webhook-configuration - -jobs: - per-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - timeout-minutes: 60 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Download rust build artifacts - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - workflow_conclusion: success - commit: ${{ github.event.workflow_run.head_sha }} - name: rust-${{ matrix.arch }}-binaries - path: /tmp - - - name: Unpack Rust binaries - run: | - tar -xvf /tmp/rust-${{ matrix.arch }}-binaries.tar - - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - github_ref: ${{ github.ref }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} && ((github.event.workflow_run.event == 'release') || (github.event.workflow_run.event == 'push' && github.ref == 'refs/heads/main')) - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 60 - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 12 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} diff --git a/.github/workflows/cancel-previous-pr-workflows.yml b/.github/workflows/cancel-previous-pr-workflows.yml index f73f4e48e..a64ef6de9 100644 --- a/.github/workflows/cancel-previous-pr-workflows.yml +++ b/.github/workflows/cancel-previous-pr-workflows.yml @@ -1,7 +1,19 @@ name: Cancel Previous PR Workflows on: workflow_run: - workflows: ["Dependencies autoupdate", "Build Agents", "Build Anomaly Detection App Container", "Build Controller", "Build ONVIF Broker (.NET)", "Build OPC UA Monitoring Broker", "Build OpenCV Base", "Build Production Rust Code", "Build Rust CrossBuild", "Build UDEV Broker", "Build Video Streaming App Container", "Build Webhook Configuration", "Check Rust", "Check versioning", "Helm", "Tarpaulin Code Coverage", "Test K3s, Kubernetes, and MicroK8s"] + workflows: + - "Dependencies autoupdate" + - "Build Sample Apps Containers" + - "Build ONVIF Broker (.NET)" + - "Build OPC UA Monitoring Broker" + - "Build OpenCV Base" + - "Build Production Rust Containers" + - "Build UDEV Broker" + - "Check Rust" + - "Check versioning" + - "Helm" + - "Tarpaulin Code Coverage" + - "Test K3s, Kubernetes, and MicroK8s" types: - requested jobs: diff --git a/.github/workflows/run-test-cases.yml b/.github/workflows/run-test-cases.yml index b6699f4c1..2e4b23294 100644 --- a/.github/workflows/run-test-cases.yml +++ b/.github/workflows/run-test-cases.yml @@ -6,8 +6,7 @@ on: paths: - test/e2e/** - .github/workflows/run-test-cases.yml - - build/containers/Dockerfile.agent - - build/containers/Dockerfile.controller + - build/containers/Dockerfile.rust - deployment/helm/** - agent/** - controller/** @@ -20,8 +19,7 @@ on: paths: - test/e2e/** - .github/workflows/run-test-cases.yml - - build/containers/Dockerfile.agent - - build/containers/Dockerfile.controller + - build/containers/Dockerfile.rust - deployment/helm/** - agent/** - controller/** @@ -44,38 +42,25 @@ jobs: with: persist-credentials: false - - name: Rust install - uses: dtolnay/rust-toolchain@master - with: - toolchain: 1.68.1 - components: clippy, rustfmt + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Build local containers for PR tests if: startsWith(github.event_name, 'pull_request') env: - BUILD_AMD64: 1 - BUILD_ARM32: 0 - BUILD_ARM64: 0 - BUILD_SLIM_AGENT: 1 PREFIX: ghcr.io/project-akri/akri LABEL_PREFIX: pr - CARGO_INCREMENTAL: 0 run: | - make akri-build - make controller-build-amd64 - make agent-build-amd64 - make webhook-configuration-build-amd64 - make debug-echo-discovery-build-amd64 - make udev-discovery-build-amd64 - make onvif-discovery-build-amd64 - make opcua-discovery-build-amd64 - docker save ${PREFIX}/agent:${LABEL_PREFIX}-amd64 > agent.tar - docker save ${PREFIX}/controller:${LABEL_PREFIX}-amd64 > controller.tar - docker save ${PREFIX}/webhook-configuration:${LABEL_PREFIX}-amd64 > webhook-configuration.tar - docker save ${PREFIX}/debug-echo-discovery:${LABEL_PREFIX}-amd64 > debug-echo-discovery.tar - docker save ${PREFIX}/udev-discovery:${LABEL_PREFIX}-amd64 > udev-discovery.tar - docker save ${PREFIX}/opcua-discovery:${LABEL_PREFIX}-amd64 > opcua-discovery.tar - docker save ${PREFIX}/onvif-discovery:${LABEL_PREFIX}-amd64 > onvif-discovery.tar + make akri LOAD=1 + docker save ${PREFIX}/agent:${LABEL_PREFIX} > agent.tar + docker save ${PREFIX}/controller:${LABEL_PREFIX} > controller.tar + docker save ${PREFIX}/webhook-configuration:${LABEL_PREFIX} > webhook-configuration.tar + docker save ${PREFIX}/debug-echo-discovery:${LABEL_PREFIX} > debug-echo-discovery.tar + docker save ${PREFIX}/udev-discovery:${LABEL_PREFIX} > udev-discovery.tar + docker save ${PREFIX}/opcua-discovery:${LABEL_PREFIX} > opcua-discovery.tar + docker save ${PREFIX}/onvif-discovery:${LABEL_PREFIX} > onvif-discovery.tar - name: Upload Agent container as artifact if: startsWith(github.event_name, 'pull_request') diff --git a/.github/workflows/update-versions.yml b/.github/workflows/update-versions.yml index edac442a9..368d1bc0c 100644 --- a/.github/workflows/update-versions.yml +++ b/.github/workflows/update-versions.yml @@ -5,8 +5,32 @@ on: types: [created, edited] jobs: + add-same-version-label-to-pr: + runs-on: ubuntu-latest + if: github.event.issue.pull_request && contains(github.event.comment.body, '/add-same-version-label') + steps: + - uses: actions/checkout@v3 + - name: Add same version label + uses: actions/github-script@v6 + if: success() + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['same version'] + }) + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '👋 Added [same version] label :)!' + }) + build: - if: ${{ github.event.issue.pull_request }} + if: ${{ github.event.issue.pull_request }} && contains(github.event.comment.body, '/version') runs-on: ubuntu-latest steps: diff --git a/Makefile b/Makefile index 66f98260f..a856d5013 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,10 @@ PUSH ?= LOAD ?= LOCAL_ARCH = $(shell uname -m) ifeq ($(LOAD), 1) -PLATFORMS ?= LOCAL_ARCH -$(intcmp 1,$(words $(PLATFORMS)), $(error Cannot load for more than one platform)) +PLATFORMS ?= $(LOCAL_ARCH) +ifneq (1, $(words $(PLATFORMS))) +$(error Cannot load for more than one platform: [$(PLATFORMS)]) +endif else PLATFORMS ?= amd64 arm64 arm/v7 endif diff --git a/build/akri-dotnet-containers.mk b/build/akri-dotnet-containers.mk deleted file mode 100644 index 3def3f1a5..000000000 --- a/build/akri-dotnet-containers.mk +++ /dev/null @@ -1,47 +0,0 @@ -define add_onvif_target - akri-$(1): akri-docker-$(1) - akri-docker-$(1): $(1)-build $(1)-docker-per-arch $(1)-docker-multi-arch-create $(1)-docker-multi-arch-push - $(1)-build: $(1)-build-amd64 $(1)-build-arm32 $(1)-build-arm64 - $(1)-docker-per-arch: $(1)-docker-per-arch-amd64 $(1)-docker-per-arch-arm32 $(1)-docker-per-arch-arm64 - - $(1)-build-amd64: - ifeq (1, ${BUILD_AMD64}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) --build-arg OUTPUT_PLATFORM_TAG=$(USE_OPENCV_BASE_VERSION)-$(AMD64_SUFFIX) --build-arg DOTNET_PUBLISH_RUNTIME=linux-x64 - endif - $(1)-build-arm32: - ifeq (1, ${BUILD_ARM32}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) --build-arg OUTPUT_PLATFORM_TAG=$(USE_OPENCV_BASE_VERSION)-$(ARM32V7_SUFFIX) --build-arg DOTNET_PUBLISH_RUNTIME=linux-arm - endif - $(1)-build-arm64: - ifeq (1, ${BUILD_ARM64}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) --build-arg OUTPUT_PLATFORM_TAG=$(USE_OPENCV_BASE_VERSION)-$(ARM64V8_SUFFIX) --build-arg DOTNET_PUBLISH_RUNTIME=linux-arm64 - endif - - $(1)-docker-per-arch-amd64: - ifeq (1, ${BUILD_AMD64}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) - endif - $(1)-docker-per-arch-arm32: - ifeq (1, ${BUILD_ARM32}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) - endif - $(1)-docker-per-arch-arm64: - ifeq (1, ${BUILD_ARM64}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) - endif - - $(1)-docker-multi-arch-create: - ifeq (1, ${BUILD_AMD64}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) - endif - ifeq (1, ${BUILD_ARM32}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) - endif - ifeq (1, ${BUILD_ARM64}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) - endif - - $(1)-docker-multi-arch-push: - $(ENABLE_DOCKER_MANIFEST) docker manifest push $(PREFIX)/$(2):$(LABEL_PREFIX) - -endef \ No newline at end of file diff --git a/test/e2e/conftest.py b/test/e2e/conftest.py index f34a159c6..4a4af0f45 100644 --- a/test/e2e/conftest.py +++ b/test/e2e/conftest.py @@ -13,7 +13,7 @@ def pytest_addoption(parser): ) parser.addoption("--test-version", action="store", help="version to test") parser.addoption( - "--local-tag", action="store", default="pr-amd64", help="tag for local images" + "--local-tag", action="store", default="pr", help="tag for local images" ) parser.addoption("--use-local", action="store_true", help="use local images if set") parser.addoption("--release", action="store_true", help="use released helm chart") @@ -69,7 +69,7 @@ def install_akri(request, distribution_config, pytestconfig, akri_version): helm_install_command = ["helm", "install", "akri"] if pytestconfig.getoption("--use-local"): - local_tag = pytestconfig.getoption("--local-tag", "pr-amd64") + local_tag = pytestconfig.getoption("--local-tag", "pr") helm_install_command.extend( [ Path(__file__).parent / "../../deployment/helm", @@ -101,7 +101,7 @@ def install_akri(request, distribution_config, pytestconfig, akri_version): ] ) if pytestconfig.getoption("--use-local"): - local_tag = pytestconfig.getoption("--local-tag", "pr-amd64") + local_tag = pytestconfig.getoption("--local-tag", "pr") helm_install_command.extend( [ "--set",