diff --git a/.github/actions/deploy-components/action.yaml b/.github/actions/deploy-components/action.yaml index 5a15acef..c3c7b104 100644 --- a/.github/actions/deploy-components/action.yaml +++ b/.github/actions/deploy-components/action.yaml @@ -5,11 +5,19 @@ name: Deploy agntcy components description: Deploy agntcy components for integration testing inputs: + checkout-repository: + description: 'Checkout AGNTCY repository' + required: false + default: 'false' + checkout-path: + description: 'Path to checkout AGNTCY repository' + required: false + default: '' deploy-gateway: description: 'Deploy gateway to a kind cluster' required: false default: 'false' - gateway-image-version: + gateway-image-tag: description: 'Set gateway container image version' required: false default: '' @@ -17,14 +25,14 @@ inputs: description: 'Deploy directory to a kind cluster' required: false default: 'false' - directory-image-version: + directory-image-tag: description: 'Set directory container image version' required: false default: '' kind-cluster-name: description: 'Set kind cluster name where components are deployed' required: false - default: 'agntcy-components' + default: 'agntcy-test' kind-cluster-namespace: description: 'Set cluster namespace where components are deployed' required: false @@ -50,11 +58,12 @@ runs: using: composite steps: - name: Checkout agntcy repository + if: ${{ inputs.checkout-repository != 'false' }} uses: actions/checkout@v4 with: repository: 'agntcy/csit' ref: ${{ inputs.github-repository-ref }} - path: 'agntcy-csit' + path: ${{ inputs.checkout-path }} - name: Install KinD if: ${{ inputs.install-kind-depedency != 'false' }} @@ -81,23 +90,18 @@ runs: with: version: 3.x - # Maybe /usr/local/bin is already in PATH by default - # - name: Update GITHUB_PATH - # shell: bash - # run: echo "/usr/local/bin" >> $GITHUB_PATH - - name: Create kind cluster shell: bash run: | - task -d agntcy-csit/ integrations:kind:create \ + task -d ./${{ inputs.checkout-path }} integrations:kind:create \ KIND_CLUSTER_NAME=${{ inputs.kind-cluster-name }} - name: Deploy Gateway if: ${{ inputs.deploy-gateway != 'false' }} shell: bash run: | - task -d agntcy-csit/ integrations:gateway:test-env:deploy \ - GATEWAY_IMAGE_TAG=${{ inputs.gateway-image-version }} \ + task -d ./${{ inputs.checkout-path }} integrations:gateway:test-env:deploy \ + GATEWAY_IMAGE_TAG=${{ inputs.gateway-image-tag }} \ KIND_CLUSTER_NAME=${{ inputs.kind-cluster-name }} \ HELM_NAMESPACE=${{ inputs.kind-cluster-namespace }} @@ -105,7 +109,7 @@ runs: if: ${{ inputs.deploy-directory != 'false' }} shell: bash run: | - task -d agntcy-csit/ integrations:directory:test-env:deploy \ - DIRECTORY_IMAGE_TAG=${{ inputs.directory-image-version }} \ + task -d ./${{ inputs.checkout-path }} integrations:directory:test-env:deploy \ + DIRECTORY_IMAGE_TAG=${{ inputs.directory-image-tag }} \ KIND_CLUSTER_NAME=${{ inputs.kind-cluster-name }} \ HELM_NAMESPACE=${{ inputs.kind-cluster-namespace }} diff --git a/.github/workflows/test-integrations.yaml b/.github/workflows/test-integrations.yaml index 3c24946d..ef9a2c09 100644 --- a/.github/workflows/test-integrations.yaml +++ b/.github/workflows/test-integrations.yaml @@ -9,11 +9,18 @@ on: pull_request: workflow_dispatch: inputs: - kind-version: + kind_version: description: 'Kind version' required: false default: '0.24.0' - + override_directory_image_tag: + description: 'Directory image tag' + required: false + default: '' + override_gateway_image_tag: + description: 'Gateway image tag' + required: false + default: '' jobs: set-kind-version: runs-on: ubuntu-latest @@ -27,7 +34,7 @@ jobs: shell: bash run: | if [ "${{ github.event_name }}" == 'workflow_dispatch' ]; then - KIND_VERSION="${{ inputs.kind-version }}" + KIND_VERSION="${{ inputs.kind_version }}" fi echo "Set KinD version to: $KIND_VERSION" @@ -67,13 +74,11 @@ jobs: with: kind-version: ${{ needs.set-kind-version.outputs.kind-version }} - - name: Create kind cluster - run: task integrations:kind:create - shell: bash - - - name: Deploy agntcy agp - run: task integrations:gateway:test-env:deploy - shell: bash + - name: Deploy Gateway + uses: ./.github/actions/deploy-components + with: + deploy-gateway: 'true' + gateway-image-tag: ${{ inputs.override_gateway_image_tag }} - name: Run simple gateway tests env: @@ -119,14 +124,12 @@ jobs: with: kind-version: ${{ needs.set-kind-version.outputs.kind-version }} - - name: Create kind cluster - run: task integrations:kind:create - shell: bash - - - name: Deploy agntcy dir - run: task integrations:directory:test-env:deploy - shell: bash + - name: Deploy Directory + uses: ./.github/actions/deploy-components + with: + deploy-directory: 'true' + directory-image-tag: ${{ inputs.override_directory_image_tag}} - - name: Run agent build tests + - name: Run Directory tests run: task integrations:directory:test shell: bash diff --git a/.github/workflows/test-remote-workflow-dispatch.yaml b/.github/workflows/test-remote-workflow-dispatch.yaml new file mode 100644 index 00000000..2e1984fc --- /dev/null +++ b/.github/workflows/test-remote-workflow-dispatch.yaml @@ -0,0 +1,28 @@ +# Copyright AGNTCY Contributors (https://github.com/agntcy) +# SPDX-License-Identifier: Apache-2.0 + +name: test-remote-workflow-dispatch-trigger +on: + workflow_dispatch: + pull_request: + +jobs: + trigger-integration-workflow: + runs-on: ubuntu-latest + permissions: write-all # TODO: Find the correct permission or create PAT token + steps: + - name: Repository Dispatch + uses: actions/github-script@v7 + with: + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'agntcy', + repo: 'csit', + workflow_id: 'test-integrations.yaml', + ref: 'feat/gh-action-repository-dispatch', + inputs: { + override_gateway_image_tag: '0.3.11', + override_directory_image_tag: 'v0.2.1', + }, + }); + debug: true \ No newline at end of file diff --git a/Taskfile.yml b/Taskfile.yml index c55f4577..f6cf45c0 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -10,6 +10,10 @@ includes: integrations: taskfile: ./integrations/Taskfile.yml dir: ./integrations + vars: + DIRECTORY_IMAGE_TAG: '{{ .DIRECTORY_IMAGE_TAG }}' + GATEWAY_IMAGE_TAG: '{{ .GATEWAY_IMAGE_TAG }}' + samples: taskfile: ./samples/Taskfile.yml dir: ./samples