diff --git a/.azure-pipelines-templates/install.yml b/.azure-pipelines-templates/install.yml index a411604bdc25..8b8fb5444165 100644 --- a/.azure-pipelines-templates/install.yml +++ b/.azure-pipelines-templates/install.yml @@ -1,24 +1,21 @@ steps: - script: | - sudo chmod a+w /opt - ninja install cmake -L .. 2>/dev/null | grep CMAKE_INSTALL_PREFIX: | cut -d = -f 2 > /tmp/install_prefix + cpack -V -G DEB + PKG=`ls *.deb` + cp $PKG $(Build.ArtifactStagingDirectory) + echo "##vso[task.setvariable variable=pkgname]$PKG" workingDirectory: build - displayName: 'Install' + displayName: 'Make .deb package' - script: | + sudo apt -y install ./$(pkgname) cat /tmp/install_prefix | xargs ./test_install.sh workingDirectory: build displayName: Test installed CCF -- script: | - INSTALL_PREFIX=`cat /tmp/install_prefix` - tar czf $(Build.ArtifactStagingDirectory)/ccf.tar.gz ${INSTALL_PREFIX##/opt/} - displayName: Create release tarball - workingDirectory: /opt - - task: PublishPipelineArtifact@1 inputs: - path: $(Build.ArtifactStagingDirectory)/ccf.tar.gz - artifact: ccf.tar.gz + path: $(Build.ArtifactStagingDirectory)/$(pkgname) + artifact: $(pkgname) displayName: 'Publish CCF Install' \ No newline at end of file diff --git a/.azure-pipelines-templates/release.yml b/.azure-pipelines-templates/release.yml index 60ea78892298..30022e94f41a 100644 --- a/.azure-pipelines-templates/release.yml +++ b/.azure-pipelines-templates/release.yml @@ -11,7 +11,7 @@ jobs: - task: DownloadPipelineArtifact@2 inputs: source: current - patterns: '**/ccf*.tar.gz' + patterns: '**/ccf*.deb' path: $(Build.ArtifactStagingDirectory) - task: GitHubRelease@0 @@ -21,7 +21,7 @@ jobs: action: 'create' target: '$(Build.SourceVersion)' tagSource: 'auto' - assets: $(Build.ArtifactStagingDirectory)/**/ccf.tar.gz + assets: $(Build.ArtifactStagingDirectory)/**/ccf*.deb assetUploadMode: 'delete' isDraft: true isPreRelease: true diff --git a/CMakeLists.txt b/CMakeLists.txt index 86684314159c..5498153331f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,8 @@ set(ENV{BETTER_EXCEPTIONS} 1) message(STATUS "CCF version=${CCF_VERSION}") message(STATUS "CCF release version=${CCF_RELEASE_VERSION}") +include(${CCF_DIR}/cmake/cpack_settings.cmake) + # Set the default install prefix for CCF. Users may override this value with the # cmake command. For example: # diff --git a/cmake/cpack_settings.cmake b/cmake/cpack_settings.cmake new file mode 100644 index 000000000000..32886cbd783e --- /dev/null +++ b/cmake/cpack_settings.cmake @@ -0,0 +1,18 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache 2.0 License. + +include(InstallRequiredSystemLibraries) +set(CPACK_PACKAGE_NAME "ccf") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Confidential Consortium Framework") +set(CPACK_PACKAGE_CONTACT "https://github.com/Microsoft/CCF") +set(CPACK_RESOURCE_FILE_LICENSE "${CCF_DIR}/LICENSE") +set(CPACK_PACKAGE_VERSION ${CCF_RELEASE_VERSION}) +set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) + +# CPack variables for Debian packages +set(CPACK_DEBIAN_PACKAGE_DEPENDS + "open-enclave (>=0.10.0), libuv1 (>= 1.18.0), libc++1-8, libc++abi1-8, libcurl4" +) +set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) + +include(CPack) diff --git a/getting_started/setup_vm/app-dev.yml b/getting_started/setup_vm/app-dev.yml index 39c52f15f186..3feca506d590 100644 --- a/getting_started/setup_vm/app-dev.yml +++ b/getting_started/setup_vm/app-dev.yml @@ -14,12 +14,9 @@ - import_role: name: llvm_repo tasks_from: install.yml - - import_role: - name: ccf_run - tasks_from: install.yml - import_role: name: ccf_build tasks_from: install.yml - import_role: name: ccf_install - tasks_from: install.yml \ No newline at end of file + tasks_from: deb_install.yml \ No newline at end of file diff --git a/getting_started/setup_vm/app-run.yml b/getting_started/setup_vm/app-run.yml index 3518718b9050..ba9c69fae7d8 100644 --- a/getting_started/setup_vm/app-run.yml +++ b/getting_started/setup_vm/app-run.yml @@ -14,9 +14,6 @@ - import_role: name: llvm_repo tasks_from: install.yml - - import_role: - name: ccf_run - tasks_from: install.yml - import_role: name: ccf_install - tasks_from: install.yml \ No newline at end of file + tasks_from: deb_install.yml \ No newline at end of file diff --git a/getting_started/setup_vm/roles/ccf_install/tasks/deb_install.yml b/getting_started/setup_vm/roles/ccf_install/tasks/deb_install.yml new file mode 100644 index 000000000000..445dd8f5b5c5 --- /dev/null +++ b/getting_started/setup_vm/roles/ccf_install/tasks/deb_install.yml @@ -0,0 +1,23 @@ +- name: Include vars + include_vars: common.yml + +- name: Install CCF + apt: + deb: "{{ ccf_deb_url }}" + become: yes + +- name: Copy cchost + copy: + src: "/opt/ccf-{{ ccf_ver }}/bin/cchost" + dest: "/usr/bin/cchost" + remote_src: true + mode: a=rx + become: true + when: run_only|bool + +- name: Remove release + apt: + deb: ccf + state: absent + become: true + when: run_only|bool \ No newline at end of file diff --git a/getting_started/setup_vm/roles/ccf_install/vars/common.yml b/getting_started/setup_vm/roles/ccf_install/vars/common.yml index 65baecb8eb31..93c99b0ea25d 100644 --- a/getting_started/setup_vm/roles/ccf_install/vars/common.yml +++ b/getting_started/setup_vm/roles/ccf_install/vars/common.yml @@ -4,3 +4,4 @@ ccf_tarball: "ccf.tar.gz" ccf_suffix: "{{ 'latest/download' if ccf_ver == 'latest' else 'download/ccf-' + ccf_ver }}" ccf_url: "https://github.com/microsoft/CCF/releases/{{ ccf_suffix }}/{{ ccf_tarball }}" ccf_prefix: "/opt/openenclave" +ccf_deb_url: "https://github.com/microsoft/CCF/releases/{{ ccf_suffix }}/ccf_{{ ccf_ver }}_amd64.deb" diff --git a/tests/test_install.sh b/tests/test_install.sh index 496cf944d65d..96ef37ddd522 100755 --- a/tests/test_install.sh +++ b/tests/test_install.sh @@ -18,7 +18,6 @@ cd nested/run python3.7 -m venv env source env/bin/activate python -m pip install -U -r "$INSTALL_PREFIX"/bin/requirements.txt -pip freeze > "$INSTALL_PREFIX"/bin/requirements.txt # Start ephemeral network in the background network_info_file="network_info.txt"