diff --git a/.github/workflows/callable_test-automation-extention.yaml b/.github/workflows/callable_test-automation-extention.yaml index 1f2a7b05..dfebb4ea 100644 --- a/.github/workflows/callable_test-automation-extention.yaml +++ b/.github/workflows/callable_test-automation-extention.yaml @@ -203,7 +203,7 @@ jobs: uses: docker/build-push-action@v3 with: context: ./system/docker/node - file: ./system/docker/node/Dockerfile.extention + file: ./system/docker/node/Dockerfile.node push: false tags: ${{ steps.prep.outputs.tags }} labels: | @@ -212,6 +212,8 @@ jobs: org.opencontainers.image.revision=${{ github.sha }} build-args: | EXTENTION_DEB=${{ env.INPUT_DEBNAME }} + CALL_FROM_EXTENTION=yes + CALL_FROM_NODE=no outputs: type=docker,dest=/tmp/node_image_${{ env.INPUT_UBUNTUVERSION }}.tar cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max diff --git a/.github/workflows/callable_test-automation-node.yaml b/.github/workflows/callable_test-automation-node.yaml index 2012bea0..ca920cc0 100644 --- a/.github/workflows/callable_test-automation-node.yaml +++ b/.github/workflows/callable_test-automation-node.yaml @@ -206,6 +206,8 @@ jobs: org.opencontainers.image.revision=${{ github.sha }} build-args: | EXTENTION_DEB=${{ env.INPUT_DEBNAME }} + CALL_FROM_EXTENTION=no + CALL_FROM_NODE=yes outputs: type=docker,dest=/tmp/node_image_${{ env.INPUT_UBUNTUVERSION }}.tar cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max diff --git a/.github/workflows/dispatchable_test-automation.yaml b/.github/workflows/dispatchable_test-automation.yaml new file mode 100644 index 00000000..66c05863 --- /dev/null +++ b/.github/workflows/dispatchable_test-automation.yaml @@ -0,0 +1,424 @@ +name: indy-test-automation-dispatch +on: + workflow_dispatch: + inputs: + libsovtokenJSON: + description: "JSON encoded libsovtoken variables: install, version" + required: false + type: string + default: "{\"install\": \"yes\", \"version\": \"1.0.5\"}" + libIndyVersion: + description: 'Version of Libindy' + required: false + type: string + default: "1.15.0~1625-bionic" + networkJSON: + description: "JSON encoded network variables: networkName, networkSubnet" + required: false + type: string + default: "{\"networkName\": \"indy-test-automation-network\", \"networkSubnet\": \"10.0.0.0/24\"}" + testDirectory: + description: "The directory, relative to the indy-test-automantion project folder, containing the tests to be executed." + required: false + type: string + default: "system/indy-node-tests" + includePaymentTests: + description: "Include payment tests. Defaults to false." + required: false + type: boolean + default: false + testAutomationBranch: + description: "Branch of Indy-Test-Automation to use" + required: false + type: string + default: "main" + ignoreTests: + description: "Ignores tests starting with ..." + required: false + type: string + default: "skip-,TestEndorserSuite,TestLedgerSuite,TestCatchUpSuite" + debName: + description: "The name of the deb package of the extention to install" + required: true + type: string + default: "indy-node*.deb" + packageName: + description: "The name of the package of the extention to download with version in apt format (i.e. `sovrin=1.2.0~dev1679329393`)" + required: true + type: string + Extention: + description: "Extention yes if sovrin-like Package no for indy-node tests" + required: true + default: "no" + type: string + +env: + INPUT_UBUNTUVERSION: 'ubuntu-2004' + + INPUT_LIBSOVTOKEN_INSTALL: "no" + + INPUT_LIBINDYVERSION: ${{ inputs.libIndyVersion }} + + TEST_AUTOMATION_BRANCH: ${{ inputs.testAutomationBranch }} + + NETWORK_NAME: ${{ fromJSON(inputs.networkJSON).networkName }} + NETWORK_SUBNET: ${{ fromJSON(inputs.networkJSON).networkSubnet }} + TEST_DIRECTORY: ${{ inputs.testDirectory }} + INCLUDE_PAYMENT_TESTS: ${{ inputs.includePaymentTests }} + + INPUT_DEBNAME: ${{ inputs.debName }} + +jobs: + workflow-setup: + name: Initialize Workflow + runs-on: ubuntu-20.04 + outputs: + GITHUB_REPOSITORY_NAME: ${{ steps.repository-name.outputs.lowercase }} + DIND_BUILD_ARG: ${{ steps.cache.outputs.DIND_BUILD_ARG}} + steps: + - name: Convert the GitHub repository name to lowercase + id: repository-name + uses: ASzc/change-string-case-action@v5 + with: + string: ${{ github.repository }} + + - name: Set outputs + id: cache + run: | + # Set variables according to version of ubuntu + if [[ "${{ env.INPUT_UBUNTUVERSION }}" == "ubuntu-1604" ]]; then + echo "DIND_BUILD_ARG=16.04" >> $GITHUB_OUTPUT + echo "distribution=xenial" >> $GITHUB_OUTPUT + fi + if [[ "${{ env.INPUT_UBUNTUVERSION }}" == "ubuntu-2004" ]]; then + echo "DIND_BUILD_ARG=20.04" >> $GITHUB_OUTPUT + echo "distribution=focal" >> $GITHUB_OUTPUT + fi + + + + dind-image: + name: Create DinD Image + needs: workflow-setup + runs-on: ubuntu-20.04 + env: + GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} + DIND_BUILD_ARG: ${{ needs.workflow-setup.outputs.DIND_BUILD_ARG }} + steps: + - name: Git checkout teracyhq/docker-files + uses: actions/checkout@v3 + with: + repository: teracyhq/docker-files + + - name: Prepare image labels and tags + id: prep + shell: bash + run: | + DOCKER_IMAGE=ghcr.io/${{ env.GITHUB_REPOSITORY_NAME }}/dind + TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${{ env.INPUT_UBUNTUVERSION }}" + echo "tags=${TAGS}" >> $GITHUB_OUTPUT + echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT + + - name: Log into the GitHub Container Registry + if: steps.cache-image.outputs.cache-hit != 'true' + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx + + - name: Build and push image + uses: docker/build-push-action@v3 + with: + context: ./ubuntu/base + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.prep.outputs.tags }} + build-args: | + UBUNTU_VERSION=${{ env.DIND_BUILD_ARG }} + labels: | + org.opencontainers.image.source=${{ github.event.repository.html_url }} + org.opencontainers.image.created=${{ steps.prep.outputs.created }} + org.opencontainers.image.revision=${{ github.sha }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + node-image: + name: Create Node Image + needs: workflow-setup + runs-on: ubuntu-20.04 + env: + GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} + steps: + - name: Git checkout hyperledger/indy-test-automation + uses: actions/checkout@v3 + with: + repository: hyperledger/indy-test-automation + ref: ${{ env.TEST_AUTOMATION_BRANCH }} + + - name: Prepare image labels and tags + if: steps.cache-image.outputs.cache-hit != 'true' + id: prep + shell: bash + run: | + DOCKER_IMAGE=ghcr.io/${{ env.GITHUB_REPOSITORY_NAME }}/node-${{ env.INPUT_UBUNTUVERSION }} + # TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${{ env.INPUT_UBUNTUVERSION }}" + TAGS="${DOCKER_IMAGE}:latest" + echo "tags=${TAGS}" >> $GITHUB_OUTPUT + echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT + + - name: Set up Docker Buildx + if: steps.cache-image.outputs.cache-hit != 'true' + uses: docker/setup-buildx-action@v2 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx + + - name: Build image indy-node + if: inputs.Extention == 'no' + uses: docker/build-push-action@v3 + with: + context: ./system/docker/node + file: ./system/docker/node/Dockerfile.node + push: false + tags: ${{ steps.prep.outputs.tags }} + labels: | + org.opencontainers.image.source=${{ github.event.repository.html_url }} + org.opencontainers.image.created=${{ steps.prep.outputs.created }} + org.opencontainers.image.revision=${{ github.sha }} + build-args: | + EXTENTION_DEB=${{ env.INPUT_DEBNAME }} + CALL_FROM_EXTENTION="no" + CALL_FROM_NODE="yes" + PACKAGE=${{ inputs.packageName }} + outputs: type=docker,dest=/tmp/node_image_${{ env.INPUT_UBUNTUVERSION }}.tar + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: Build image extention + if: inputs.Extention == 'yes' + uses: docker/build-push-action@v3 + with: + context: ./system/docker/node + file: ./system/docker/node/Dockerfile.node + push: false + tags: ${{ steps.prep.outputs.tags }} + labels: | + org.opencontainers.image.source=${{ github.event.repository.html_url }} + org.opencontainers.image.created=${{ steps.prep.outputs.created }} + org.opencontainers.image.revision=${{ github.sha }} + build-args: | + EXTENTION_DEB=${{ env.INPUT_DEBNAME }} + CALL_FROM_EXTENTION="yes" + CALL_FROM_NODE="no" + PACKAGE=${{ inputs.packageName }} + outputs: type=docker,dest=/tmp/node_image_${{ env.INPUT_UBUNTUVERSION }}.tar + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: Upload node docker image artifacts + uses: actions/upload-artifact@v3 + with: + name: node_image + path: /tmp/node_image_${{ env.INPUT_UBUNTUVERSION }}.tar + retention-days: 1 + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + client-image: + name: Create Client Image + needs: [ workflow-setup, dind-image ] + runs-on: ubuntu-20.04 + env: + CACHE_KEY_CLIENT: ${{ needs.workflow-setup.outputs.CACHE_KEY_CLIENT }} + GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} + DIND_BUILD_ARG: ${{ needs.workflow-setup.outputs.DIND_BUILD_ARG }} + steps: + - name: Git checkout hyperledger/indy-test-automation + uses: actions/checkout@v3 + with: + repository: hyperledger/indy-test-automation + ref: ${{ env.TEST_AUTOMATION_BRANCH }} + + - name: Prepare image labels and tags + id: prep + shell: bash + run: | + DOCKER_IMAGE=ghcr.io/${{ env.GITHUB_REPOSITORY_NAME }}/client + TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${{ env.INPUT_UBUNTUVERSION }}" + echo "tags=${TAGS}" >> $GITHUB_OUTPUT + echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx + + - name: Build and cache image + uses: docker/build-push-action@v3 + with: + context: ./system/docker/client/ + file: ./system/docker/client/Dockerfile.${{ env.INPUT_UBUNTUVERSION }} + push: false + tags: ${{ steps.prep.outputs.tags }} + labels: | + org.opencontainers.image.source=${{ github.event.repository.html_url }} + org.opencontainers.image.created=${{ steps.prep.outputs.created }} + org.opencontainers.image.revision=${{ github.sha }} + build-args: | + LIBINDY_VERSION=${{ env.INPUT_LIBINDYVERSION}} + DIND_CONTAINER_REGISTRY=ghcr.io/${{ env.GITHUB_REPOSITORY_NAME }} + DIND_IMAGE_NAME=dind:${{ env.INPUT_UBUNTUVERSION }} + LIBSOVTOKEN_INSTALL=${{ env.INPUT_LIBSOVTOKEN_INSTALL }} + outputs: type=docker,dest=/tmp/client_image_${{ env.INPUT_UBUNTUVERSION }}.tar + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: Upload client docker image artifacts + uses: actions/upload-artifact@v3 + with: + name: client_image + path: /tmp/client_image_${{ env.INPUT_UBUNTUVERSION }}.tar + retention-days: 1 + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + get-test-modules: + name: Get Test Modules + runs-on: ubuntu-latest + outputs: + modules: ${{ steps.get-module-list.outputs.file_names }} + steps: + - name: Git checkout hyperledger/indy-test-automation + uses: actions/checkout@v3 + with: + repository: hyperledger/indy-test-automation + ref: ${{ env.TEST_AUTOMATION_BRANCH }} + + - name: Get Module List + id: get-module-list + uses: the-coding-turtle/ga-file-list@v0.4.1 + with: + directory: ${{ env.TEST_DIRECTORY }} + file_extension: "py" + + # ============================================== + # Include all tests by default. + # ============================================== + only_files_starts_with: "test,Test" + + # ============================================== + # Ignore specific test harnesses here + # ---------------------------------------------- + # Ignore tests by renaming the file for the + # test to have a prefix of "skip-". Line below + # is not really needed, but left in to make + # it clear the files are being ignored. + # ============================================== + ignore_files_starts_with: ${{ inputs.ignoreTests }} + + ### 1 Job in workflow per test + ### The tests rely on docker in docker with the fixed network name and fixed IP addresses. + MatrixTest: + name: MatrixTest + needs: [ workflow-setup, node-image, client-image, get-test-modules] + runs-on: ubuntu-20.04 + env: + GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} + strategy: + matrix: + module: ${{ fromJson(needs.get-test-modules.outputs.modules) }} + fail-fast: false + steps: + - name: Git checkout hyperledger/indy-test-automation + uses: actions/checkout@v3 + with: + repository: hyperledger/indy-test-automation + ref: ${{ env.TEST_AUTOMATION_BRANCH }} + + - name: Create docker network + run: | + docker network create --subnet="${{ env.NETWORK_SUBNET }}" "${{ env.NETWORK_NAME }}" + + - name: Download client artifact + uses: actions/download-artifact@v3 + with: + name: client_image + path: /tmp + + - name: Download node artifact + uses: actions/download-artifact@v3 + with: + name: node_image + path: /tmp + + - name: Load client and node image + run: | + docker load --input /tmp/client_image_${{ env.INPUT_UBUNTUVERSION }}.tar + docker load --input /tmp/node_image_${{ env.INPUT_UBUNTUVERSION }}.tar + + - name: ${{ matrix.module }} + id: test_Matrix + run: | + cd ./system/docker + + TEST_PARAMS="-l -v --junit-xml=${{ matrix.module }}-report.xml" + if [[ ${INCLUDE_PAYMENT_TESTS} == "true" ]]; then + TEST_PARAMS+="${TEST_PARAMS} --payments" + fi + + UBUNTU_VERSION="${{ env.INPUT_UBUNTUVERSION }}" \ + IMAGE_REPOSITORY="ghcr.io/${{ env.GITHUB_REPOSITORY_NAME }}/" \ + CLIENT_IMAGE="client:${{ env.INPUT_UBUNTUVERSION }}" \ + NODE_IMAGE="node-${{ env.INPUT_UBUNTUVERSION }}" \ + ./run.sh ${{ env.TEST_DIRECTORY }}/${{ matrix.module }}.py "${TEST_PARAMS}" ${{ env.NETWORK_NAME }} + + - name: Publish Test Report + if: success() || failure() + uses: scacap/action-surefire-report@v1 + continue-on-error: true + with: + check_name: ${{ matrix.module }} Test Report + github_token: ${{ secrets.GITHUB_TOKEN }} + report_paths: "*-report.xml" + + - name: Upload Detailed Test Failure Results + # The test runner only emits the detailed test results if the tests fail. + if: (steps.test_Matrix == 'failure') && failure() + uses: actions/upload-artifact@v3 + with: + name: detailed-test-result-test_consensus + path: test-result-indy-test-automation-${{ matrix.module }}.txt + retention-days: 5 \ No newline at end of file diff --git a/system/docker/node/Dockerfile.extention b/system/docker/node/Dockerfile.extention deleted file mode 100644 index 3614b9fd..00000000 --- a/system/docker/node/Dockerfile.extention +++ /dev/null @@ -1,65 +0,0 @@ -FROM fauust/docker-systemd:ubuntu-20.04 - -ARG DEBIAN_FRONTEND=noninteractive - -ARG uid=1000 -ARG user=indy - - -RUN apt-get update -y && apt-get install -y \ - apt-utils\ - git\ - ca-certificates \ - ssh\ - gnupg \ - apt-transport-https - -# Bionic-security-main for libssl1.0.0 -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 \ - && echo "deb http://security.ubuntu.com/ubuntu bionic-security main" >> /etc/apt/sources.list - -# sovrin repo -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 \ - && echo "deb https://repo.sovrin.org/deb bionic master" >> /etc/apt/sources.list - -# Hyperledger Artifactory -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9692C00E657DDE61 \ - && echo "deb https://hyperledger.jfrog.io/artifactory/indy focal dev rc master" >> /etc/apt/sources.list \ - && printf '%s\n%s\n%s\n' 'Package: *' 'Pin: origin hyperledger.jfrog.io' 'Pin-Priority: 1001' >> /etc/apt/preferences - -# Sovrin Artifactory -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3BC8C2DD662F1C45 \ - && echo "deb https://sovrin.jfrog.io/artifactory/deb focal dev rc master" >> /etc/apt/sources.list - -COPY * / - -ARG EXTENTION_DEB -RUN : ${EXTENTION_DEB:?"EXTENTION_DEB must be provided"} -ENV EXTENTION_DEB=${EXTENTION_DEB} -RUN apt-get update -y && \ - bash ./getDeps.sh ${EXTENTION_DEB} && \ - aptStr=$(cat /tmp/aptStr) && \ - echo "Installing dependancies:" && \ - echo ${aptStr} && \ - echo && \ - apt-get update -y && apt-get install -y ${aptStr} \ - # fix missing path to libursa - && ln -s /usr/lib/ursa/libursa.so /usr/lib/libursa.so - -RUN extention_package=$(find ./ -name "$EXTENTION_DEB" | head -n 1); \ - echo "Installing Extension ${extention_package} ..."; \ - dpkg -i "${extention_package}"; - -# network config -RUN echo " " >> /etc/indy/indy_config.py \ - && echo "NETWORK_NAME = 'sandbox'" >> /etc/indy/indy_config.py \ - && echo " " >> /etc/indy/indy_config.py \ - && echo "logLevel = 0" >> /etc/indy/indy_config.py \ - && echo " " >> /etc/indy/indy_config.py - -# Server side ssh configuration -RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config -COPY test_key.pub /root/.ssh/authorized_keys -RUN chmod 700 /root/.ssh && \ - chmod 600 /root/.ssh/authorized_keys - diff --git a/system/docker/node/Dockerfile.node b/system/docker/node/Dockerfile.node index cb6c1d30..4e79ef13 100644 --- a/system/docker/node/Dockerfile.node +++ b/system/docker/node/Dockerfile.node @@ -33,17 +33,16 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3BC8C2DD662F1C45 \ COPY * / +ARG PACKAGE +RUN if [ ! -z ${PACKAGE} ]; then echo "downloading ${PACKAGE}"; apt update && apt download ${PACKAGE}; fi + ARG EXTENTION_DEB RUN : ${EXTENTION_DEB:?"EXTENTION_DEB must be provided"} -ENV EXTENTION_DEB=${EXTENTION_DEB} -RUN apt-get update -y && bash ./getDepsNode.sh ${EXTENTION_DEB} && \ - aptStr=$(cat /tmp/aptStr) && \ - echo "Installing dependancies:" && \ - echo ${aptStr} && \ - echo && \ - apt install -y $(pwd)/${EXTENTION_DEB} $aptStr &&\ - # fix missing path to libursa - ln -s /usr/lib/ursa/libursa.so /usr/lib/libursa.so +ARG CALL_FROM_EXTENTION +RUN : ${CALL_FROM_EXTENTION:?"CALL_FROM_EXTENTION must be provided"} +ARG CALL_FROM_NODE +RUN : ${CALL_FROM_NODE:?"CALL_FROM_NODE must be provided"} +RUN EXTENTION_DEB=${EXTENTION_DEB} CALL_FROM_EXTENTION=${CALL_FROM_EXTENTION} CALL_FROM_NODE=${CALL_FROM_NODE} bash installDeps.sh # network config RUN echo " " >> /etc/indy/indy_config.py \ diff --git a/system/docker/node/Dockerfile.ubuntu-2004 b/system/docker/node/Dockerfile.ubuntu-2004 deleted file mode 100644 index 84a3532a..00000000 --- a/system/docker/node/Dockerfile.ubuntu-2004 +++ /dev/null @@ -1,128 +0,0 @@ -#FROM jrei/systemd-ubuntu:20.04 -# -# FROM systemd-ubuntu-20.04:latest -FROM fauust/docker-systemd:ubuntu-20.04 - -ARG DEBIAN_FRONTEND=noninteractive - -ARG uid=1000 -ARG user=indy - -# Install environment -RUN apt-get update -y && apt-get install -y \ - git \ - wget \ - python3-pip \ - python3-nacl \ - python-setuptools \ - python3-nacl \ - apt-transport-https \ - ca-certificates \ - ssh \ - vim \ - mc \ - stress \ - dbus \ - ## ToDo remove unused packages - libgflags-dev \ - libsnappy-dev \ - zlib1g-dev \ - libbz2-dev \ - liblz4-dev \ - libgflags-dev \ - && rm -rf /var/lib/apt/lists/* - -# pip<10.0.0 is important. pip==10.0.0 doesn't work. -RUN pip3 install -U \ - # 'pip<10.0.0' \ - pip \ - setuptools - -# Bionic-security-main for libssl1.0.0 -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 \ - && echo "deb http://security.ubuntu.com/ubuntu bionic-security main" >> /etc/apt/sources.list - - -# sovrin repo -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 \ - && echo "deb https://repo.sovrin.org/deb bionic master" >> /etc/apt/sources.list \ - && apt-get update -y - -# Hyperledger Artifactory -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9692C00E657DDE61 \ - && echo "deb https://hyperledger.jfrog.io/artifactory/indy focal dev rc master" >> /etc/apt/sources.list \ - && printf '%s\n%s\n%s\n' 'Package: *' 'Pin: origin hyperledger.jfrog.io' 'Pin-Priority: 1001' >> /etc/apt/preferences \ - && apt-get update -y - -# indy depedencies -ARG URSA_VERSION -RUN : ${URSA_VERSION:?"URSA_VERSION must be provided"} -ENV URSA_VERSION=${URSA_VERSION} - -ARG PYTHON3_PYZMQ_VERSION -RUN : ${PYTHON3_PYZMQ_VERSION:?"PYTHON3_PYZMQ_VERSION must be provided"} -ENV PYTHON3_PYZMQ_VERSION=${PYTHON3_PYZMQ_VERSION} - -ARG INDY_PLENUM_VERSION -RUN : ${INDY_PLENUM_VERSION:?"INDY_PLENUM_VERSION must be provided"} -ENV INDY_PLENUM_VERSION=${INDY_PLENUM_VERSION} - -ARG INDY_NODE_VERSION -RUN : ${INDY_NODE_VERSION:?"INDY_NODE_VERSION must be provided"} -ENV INDY_NODE_VERSION=${INDY_NODE_VERSION} - -RUN apt-get install -y \ - ursa=${URSA_VERSION} \ - python3-pyzmq=${PYTHON3_PYZMQ_VERSION} \ - indy-plenum=${INDY_PLENUM_VERSION} \ - indy-node=${INDY_NODE_VERSION} \ - rocksdb=5.8.8 \ - && rm -rf /var/lib/apt/lists/* \ - # fix missing path to libursa - && ln -s /usr/lib/ursa/libursa.so /usr/lib/libursa.so - -ARG TOKEN_PLUGINS_INSTALL -ENV TOKEN_PLUGINS_INSTALL=${TOKEN_PLUGINS_INSTALL} -ARG SOVTOKEN_VERSION -ENV SOVTOKEN_VERSION=${SOVTOKEN_VERSION:-1.2.0-dev1663181681} -ARG SOVTOKENFEES_VERSION -ENV SOVTOKENFEES_VERSION=${SOVTOKENFEES_VERSION:-${SOVTOKEN_VERSION}} -RUN echo "TOKEN_PLUGINS_INSTALL: ${TOKEN_PLUGINS_INSTALL}" -RUN if [ "${TOKEN_PLUGINS_INSTALL}" = "yes" ]; then \ - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3BC8C2DD662F1C45 \ - # && rm /etc/apt/sources.list.d/sovrin* \ - # && add-apt-repository "deb https://sovrin.jfrog.io/artifactory/deb focal ${SOVTOKEN_REPO_COMPONENT}" \ - && echo "deb https://sovrin.jfrog.io/artifactory/deb focal dev rc master" >> /etc/apt/sources.list \ - && apt-get update && apt-get install -y \ - # ToDo: - # - Need an Ubuntu 20.04 SOVRIN Build. - # sovrin=${SOVRIN_VERSION} \ - sovtoken=${SOVTOKEN_VERSION} \ - sovtokenfees=${SOVTOKENFEES_VERSION} \ - && rm -rf /var/lib/apt/lists/*; \ - fi - -ARG SOVRIN_INSTALL -ENV SOVRIN_INSTALL=$SOVRIN_INSTALL -COPY . . - -RUN echo "SOVRIN_INSTALL: ${SOVRIN_INSTALL}" -RUN if [ "${SOVRIN_INSTALL}" = "yes" ]; then \ - sovrin_package=$(find ./ -name "sovrin_*.deb" | head -n 1); \ - echo "Installing ${sovrin_package} ..."; \ - dpkg -i "${sovrin_package}"; \ - fi - -# network config -RUN echo " " >> /etc/indy/indy_config.py \ - && echo "NETWORK_NAME = 'sandbox'" >> /etc/indy/indy_config.py \ - && echo " " >> /etc/indy/indy_config.py \ - && echo "logLevel = 0" >> /etc/indy/indy_config.py \ - && echo " " >> /etc/indy/indy_config.py - -# Server side ssh configuration -RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config -COPY test_key.pub /root/.ssh/authorized_keys -RUN chmod 700 /root/.ssh && \ - chmod 600 /root/.ssh/authorized_keys - diff --git a/system/docker/node/getDepsNode.sh b/system/docker/node/getDepsNode.sh index 51ac2dc4..54e4fd61 100644 --- a/system/docker/node/getDepsNode.sh +++ b/system/docker/node/getDepsNode.sh @@ -1,7 +1,7 @@ function getDeps(){ echo "$(apt show ${1} 2>/dev/null | grep -P "Depends: " | sed 's~Depends:~~g;s~(~~g;s~)~~g;s~>~~g;s~<~~g' |tr -d " \t\n\r" | tr "," "\n")" } -aptStr=$(dpkg-deb -I $(pwd)/${EXTENTION_DEB} | grep -P "Depends: " | sed 's~Depends:~~g;s~(~~g;s~)~~g;s~>~~g;s~<~~g' | tr -d " \t\n\r" | tr "," "\n") +aptStr=$(dpkg-deb -I $(pwd)/${1} | grep -P "Depends: " | sed 's~Depends:~~g;s~(~~g;s~)~~g;s~>~~g;s~<~~g' | tr -d " \t\n\r" | tr "," "\n") plenumStr="$(getDeps $(echo "$aptStr" | grep plenum))" -echo -e "${aptStr} ${plenumstr}" | awk '!a[$0]++' > /tmp/aptStr \ No newline at end of file +echo -e "${aptStr} ${plenumStr}" | awk '!a[$0]++' > /tmp/aptStr \ No newline at end of file diff --git a/system/docker/node/installDeps.sh b/system/docker/node/installDeps.sh new file mode 100644 index 00000000..6c99e6be --- /dev/null +++ b/system/docker/node/installDeps.sh @@ -0,0 +1,18 @@ +#!/bin/bash +apt-get update -y +if [[ "${CALL_FROM_NODE}" == "\"yes\"" ]]; then + echo "node get Deps" + bash ./getDepsNode.sh ${EXTENTION_DEB} +fi + +if [[ "${CALL_FROM_EXTENTION}" == "\"yes\"" ]]; then + echo "sovrin get Deps" + bash ./getDeps.sh ${EXTENTION_DEB} +fi + +aptStr=$(cat /tmp/aptStr) +echo "Installing dependancies:" +echo "${aptStr}" +echo +apt install -y $(pwd)/${EXTENTION_DEB} ${aptStr} +ln -s /usr/lib/ursa/libursa.so /usr/lib/libursa.so \ No newline at end of file