diff --git a/.github/workflows/e2e-science.yml b/.github/workflows/e2e-science.yml index 3b8de4b6..05b9d5f2 100644 --- a/.github/workflows/e2e-science.yml +++ b/.github/workflows/e2e-science.yml @@ -11,9 +11,10 @@ on: - master jobs: call-workflow-passing-data: - uses: ./.github/workflows/e2e.yml + uses: ./.github/workflows/e2e-common.yml with: suffix: "" + ci_repo: "docker-registry.docker-registry:5000" secrets: registry_username: ${{ secrets.REGISTRY_USERNAME }} registry_token: ${{ secrets.REGISTRY_TOKEN }} diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml deleted file mode 100644 index 693f0e2f..00000000 --- a/.github/workflows/e2e.yml +++ /dev/null @@ -1,182 +0,0 @@ -name: "Reusable workflow for Fink self-hosted e2e tests" - -on: - workflow_call: - inputs: - suffix: - required: true - type: string - secrets: - registry_username: - required: true - registry_token: - required: true -env: - CIUXCONFIG: /tmp/ciux.sh - CIUX_VERSION: 927153e3f - GHA_BRANCH_NAME: ${{ github.head_ref || github.ref_name }} - SUFFIX: ${{ inputs.suffix }} - # Override the self-hosted runner value - POD_NAMESPACE: default - CI_REPO: docker-registry.docker-registry:5000 -jobs: - build: - name: Build image - runs-on: [self-hosted, v3] - outputs: - image: ${{ steps.push.outputs.IMAGE }} - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: actions/setup-go@v4 - with: - go-version: '1.21.4' - - name: Install ciux - run: go install github.com/k8s-school/ciux@"${{ env.CIUX_VERSION }}" - - name: Build image if not present in registry - run: | - ./build.sh -s "${{ env.SUFFIX }}" -r "${{ env.CI_REPO }}" - - name: Push image to local registry - id: push - run: | - # FIXME make it simpler - if image=$(ciux get image --check $PWD $SUFFIX_OPT) - then - echo "IMAGE=$image" >> "$GITHUB_OUTPUT" - else - . "$CIUXCONFIG" - . ./conf.sh - docker push $IMAGE - echo "IMAGE=$IMAGE" >> "$GITHUB_OUTPUT" - fi - integration-tests: - name: Run integration tests - runs-on: [self-hosted, v3] - outputs: - promoted_image: ${{ steps.promote.outputs.PROMOTED_IMAGE }} - needs: build - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: actions/setup-go@v4 - with: - go-version: '1.21.4' - - name: Install ciux - run: go install github.com/k8s-school/ciux@"${{ env.CIUX_VERSION }}" - - name: Ciux project ignition - run: ciux ignite --selector ci --branch="$GHA_BRANCH_NAME" $PWD - - name: Display ciux configuration - run: | - cat "$CIUXCONFIG" - - name: Create ktbx configuration - run: | - mkdir -p $HOME/.ktbx - cat < $HOME/.ktbx/config - kind: - # Supported only for clusters with one node - # Use host directory to share data between host and kind node - # host directory will be mounted on /mnt/extra on each node - # extraMountPath: /path/to/host/directory - - # Sets "127.0.0.1" as an extra Subject Alternative Names (SANs) for the API Server signing certificate. - # See https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta3/#kubeadm-k8s-io-v1beta3-APIServer - # Usefull to access API server through a ssh tunnel - localcertsans: false - - # Use calico CNI instead of kindnet - # useCalico: true - # Number of worker nodes - workers: 0 - - # Supported only for clusters with one node - # Certificates must be available on kind host at "/etc/docker/certs.d/{{ .PrivateRegistry }}" - privateRegistry: "docker-registry.docker-registry:5000" - EOF - - name: Create k8s/kind cluster - run: | - echo "Installing kind in version v0.15.0 because kind latest version is not supported by self-hosted runners" - ktbx install kind --kind-version="v0.15.0" - ktbx install kubectl - kind version - kubectl version --client - ktbx version - ktbx create -s - - name: Install olm and argocd operators - run: | - ktbx install olm - ktbx install argocd - - name: Run argoCD - run: | - ./e2e/argocd.sh - - name: Install fink-alert-simulator pre-requisites (argo-workflows) - run: | - . "$CIUXCONFIG" - "$FINK_ALERT_SIMULATOR_DIR"/prereq-install.sh - - name: Install fink-broker pre-requisites (JDK, Spark) - run: | - sudo apt-get -y update - sudo apt-get -y install openjdk-8-jdk-headless - ./e2e/prereq-install.sh - - name: Run fink-alert-simulator - run: | - . "$CIUXCONFIG" - "$FINK_ALERT_SIMULATOR_DIR"/argo-submit.sh - argo watch @latest - # - name: Setup tmate session - # uses: mxschmitt/action-tmate@v3 - - name: Run fink-broker - run: | - ./e2e/fink-start.sh - - name: Check ouput topics are created - run: | - ./e2e/check-results.sh - - name: Set promoted image name - id: promote - run: | - . "$CIUXCONFIG" - . ./conf.sh - echo "PROMOTED_IMAGE=$PROMOTED_IMAGE" >> "$GITHUB_OUTPUT" - image-analysis: - name: Analyze image - runs-on: ubuntu-22.04 - permissions: - security-events: write - needs: build - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Download image - uses: actions/download-artifact@v3 - with: - name: docker-artifact - path: artifacts - - name: Load image in local registry - run: | - if [ -f artifacts/image.tar ]; then - echo "Loading image ${{ needs.build.outputs.image }} from archive" - docker load --input artifacts/image.tar - else - echo "Using existing image ${{ needs.build.outputs.image }}" - fi - push: - name: Push fink-broker image to IN2P3 registry - runs-on: [self-hosted, v3] - needs: [build, integration-tests, image-analysis] - steps: - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - registry: gitlab-registry.in2p3.fr - username: ${{ secrets.registry_username }} - password: ${{ secrets.registry_token }} - - name: Push image to IN2P3 registry - run: | - IMAGE="${{ needs.build.outputs.image }}" - PROMOTED_IMAGE="${{ needs.integration-tests.outputs.promoted_image }}" - docker pull "$IMAGE" - docker tag "$IMAGE" "$PROMOTED_IMAGE" - docker push "$PROMOTED_IMAGE"