From 0f049b82f5a8e0a38b29706ed0bdb1b6229145a2 Mon Sep 17 00:00:00 2001 From: Shawn Carey Date: Fri, 11 Oct 2024 09:08:21 -0400 Subject: [PATCH 1/5] debug --- .../openziti-tunnel-build-action/gh-release/entrypoint.sh | 7 +++++++ .github/workflows/cmake.yml | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/actions/openziti-tunnel-build-action/gh-release/entrypoint.sh b/.github/actions/openziti-tunnel-build-action/gh-release/entrypoint.sh index 99ceafba..f08a7eec 100755 --- a/.github/actions/openziti-tunnel-build-action/gh-release/entrypoint.sh +++ b/.github/actions/openziti-tunnel-build-action/gh-release/entrypoint.sh @@ -61,6 +61,13 @@ if [ ! -d "${VCPKG_ROOT}/ports" ]; then "${VCPKG_ROOT}/bootstrap-vcpkg.sh" -disableMetrics fi +echo "======== here comes the env" +env +echo "======== that is all" +echo "======== here comes the df" +df +echo "======== that is it" + cmake -E make_directory ./build cmake \ --preset "${cmake_preset}" \ diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 82ddd9af..ec15998b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -20,7 +20,8 @@ jobs: build: runs-on: ${{ matrix.os }} name: build ${{ matrix.preset }} - env: {} + env: + "_VCPKG_BINARY_SOURCES": "clear;file,${{ github.workspace }}/vcpkg_cache,readwrite" strategy: fail-fast: false From b2faf0a835b1ed1c40eebd72c78e6145abfbc134 Mon Sep 17 00:00:00 2001 From: Shawn Carey Date: Fri, 11 Oct 2024 10:17:53 -0400 Subject: [PATCH 2/5] control vcpkg cache directory --- .github/actions/build/action.yml | 7 +++--- .../gh-release/entrypoint.sh | 25 +++++-------------- .../redhat-8/entrypoint.sh | 7 ++++++ .../redhat-9/entrypoint.sh | 7 ++++++ .../ubuntu-20.04/entrypoint.sh | 7 ++++++ .../ubuntu-22.04/entrypoint.sh | 7 ++++++ .github/workflows/cmake.yml | 2 +- .github/workflows/cpack.yml | 11 ++++++-- 8 files changed, 48 insertions(+), 25 deletions(-) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index bc8b08f3..cf49c701 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -42,9 +42,7 @@ runs: - uses: actions/cache@v4 with: key: deps-${{ inputs.preset }}-${{ hashFiles('./vcpkg.json') }} - path: | - ./vcpkg/packages - ./build/vcpkg_installed + path: ./vcpkg_cache - uses: lukka/run-cmake@v10.6 # pin version to avoid failed glibc dependency on ubuntu 20 runners. go back to @latest when ubuntu 22+ is adopted for runner os. if: runner.os != 'Linux' @@ -71,6 +69,9 @@ runs: - name: build ziti-edge-tunnel (linux) if: runner.os == 'Linux' uses: ./.github/actions/openziti-tunnel-build-action + env: + # map vcpkg cache so container uses the same directory as the rest of the workflow + "VCPKG_BINARY_SOURCES": "clear;files,/github/workspace/vcpkg_cache,readwrite" with: arch: ci-${{ inputs.preset }} config: ${{ inputs.config }} diff --git a/.github/actions/openziti-tunnel-build-action/gh-release/entrypoint.sh b/.github/actions/openziti-tunnel-build-action/gh-release/entrypoint.sh index f08a7eec..2055782a 100755 --- a/.github/actions/openziti-tunnel-build-action/gh-release/entrypoint.sh +++ b/.github/actions/openziti-tunnel-build-action/gh-release/entrypoint.sh @@ -48,25 +48,12 @@ for SAFE in \ git config --global --add safe.directory ${SAFE} done -export VCPKG_ROOT="${PWD}/vcpkg" -# ${VCPKG_ROOT}/packages will have been populated from outside of the container, by a different user. tell git it's ok. -git config --global --add safe.directory "${VCPKG_ROOT}" - -if [ ! -d "${VCPKG_ROOT}/ports" ]; then - # the packages/ directory may have been populated from cache by now - # but git clone refuses to clone into a non-empty directory, so get - # vcpkg without using clone - git init "${VCPKG_ROOT}" - (cd "${VCPKG_ROOT}"; git remote add -f origin https://github.com/microsoft/vcpkg; git checkout master) - "${VCPKG_ROOT}/bootstrap-vcpkg.sh" -disableMetrics -fi - -echo "======== here comes the env" -env -echo "======== that is all" -echo "======== here comes the df" -df -echo "======== that is it" +( + cd "${VCPKG_ROOT}" + git checkout master + git pull + ./bootstrap-vcpkg.sh -disableMetrics +) cmake -E make_directory ./build cmake \ diff --git a/.github/actions/openziti-tunnel-build-action/redhat-8/entrypoint.sh b/.github/actions/openziti-tunnel-build-action/redhat-8/entrypoint.sh index ea83cf47..4be0dacd 100755 --- a/.github/actions/openziti-tunnel-build-action/redhat-8/entrypoint.sh +++ b/.github/actions/openziti-tunnel-build-action/redhat-8/entrypoint.sh @@ -36,6 +36,13 @@ for SAFE in \ git config --global --add safe.directory ${SAFE} done +( + cd "${VCPKG_ROOT}" + git checkout master + git pull + ./bootstrap-vcpkg.sh -disableMetrics +) + cmake -E make_directory ./build ( [[ -d ./build ]] && rm -r ./build diff --git a/.github/actions/openziti-tunnel-build-action/redhat-9/entrypoint.sh b/.github/actions/openziti-tunnel-build-action/redhat-9/entrypoint.sh index aa991116..86d26bd4 100755 --- a/.github/actions/openziti-tunnel-build-action/redhat-9/entrypoint.sh +++ b/.github/actions/openziti-tunnel-build-action/redhat-9/entrypoint.sh @@ -36,6 +36,13 @@ for SAFE in \ git config --global --add safe.directory ${SAFE} done +( + cd "${VCPKG_ROOT}" + git checkout master + git pull + ./bootstrap-vcpkg.sh -disableMetrics +) + ( [[ -d ./build ]] && rm -r ./build cmake -E make_directory ./build diff --git a/.github/actions/openziti-tunnel-build-action/ubuntu-20.04/entrypoint.sh b/.github/actions/openziti-tunnel-build-action/ubuntu-20.04/entrypoint.sh index 1cb65f8f..0d6d562b 100755 --- a/.github/actions/openziti-tunnel-build-action/ubuntu-20.04/entrypoint.sh +++ b/.github/actions/openziti-tunnel-build-action/ubuntu-20.04/entrypoint.sh @@ -36,6 +36,13 @@ for SAFE in \ git config --global --add safe.directory ${SAFE} done +( + cd "${VCPKG_ROOT}" + git checkout master + git pull + ./bootstrap-vcpkg.sh -disableMetrics +) + [[ -d ./build ]] && rm -r ./build cmake \ -E make_directory \ diff --git a/.github/actions/openziti-tunnel-build-action/ubuntu-22.04/entrypoint.sh b/.github/actions/openziti-tunnel-build-action/ubuntu-22.04/entrypoint.sh index 0a1285c3..c5a3f4c5 100755 --- a/.github/actions/openziti-tunnel-build-action/ubuntu-22.04/entrypoint.sh +++ b/.github/actions/openziti-tunnel-build-action/ubuntu-22.04/entrypoint.sh @@ -36,6 +36,13 @@ for SAFE in \ git config --global --add safe.directory ${SAFE} done +( + cd "${VCPKG_ROOT}" + git checkout master + git pull + ./bootstrap-vcpkg.sh -disableMetrics +) + [[ -d ./build ]] && rm -r ./build cmake \ -E make_directory \ diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ec15998b..0ad22585 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -21,7 +21,7 @@ jobs: runs-on: ${{ matrix.os }} name: build ${{ matrix.preset }} env: - "_VCPKG_BINARY_SOURCES": "clear;file,${{ github.workspace }}/vcpkg_cache,readwrite" + "VCPKG_BINARY_SOURCES": "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite" strategy: fail-fast: false diff --git a/.github/workflows/cpack.yml b/.github/workflows/cpack.yml index 0cd36df1..9dcf9561 100644 --- a/.github/workflows/cpack.yml +++ b/.github/workflows/cpack.yml @@ -47,14 +47,13 @@ jobs: needs: set_matrix name: ${{ matrix.arch.rpm }} ${{ matrix.distro.name }} ${{ matrix.distro.version }} runs-on: ubuntu-20.04 - # build image name it from matrix values name:version unless override container is specified - container: ${{ matrix.distro.container || format('{0}:{1}', matrix.distro.name, matrix.distro.version) }} strategy: fail-fast: false matrix: ${{ fromJSON(needs.set_matrix.outputs.matrix) }} env: ZITI_DEB_TEST_REPO: ${{ vars.ZITI_DEB_TEST_REPO || 'zitipax-openziti-deb-test' }} ZITI_RPM_TEST_REPO: ${{ vars.ZITI_RPM_TEST_REPO || 'zitipax-openziti-rpm-test' }} + "VCPKG_BINARY_SOURCES": "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite" steps: - name: Debug action uses: hmarr/debug-action@v3 @@ -92,9 +91,17 @@ jobs: run: | mv -v ./.github/actions/openziti-tunnel-build-action/${DISTRO_LABEL}/* ./.github/actions/openziti-tunnel-build-action/ + - uses: actions/cache@v4 + with: + key: deps-${{ inputs.preset }}-${{ hashFiles('./vcpkg.json') }} + path: ./vcpkg_cache + # entrypoint.sh uses the value of arch to select the cmake preset - name: build binary and package uses: ./.github/actions/openziti-tunnel-build-action + env: + # map vcpkg cache so container uses the same directory as the rest of the workflow + "VCPKG_BINARY_SOURCES": "clear;files,/github/workspace/vcpkg_cache,readwrite" with: arch: ${{ matrix.arch.cmake }} config: RelWithDebInfo From 5a7310e566966714d9247c5688e2100f8516ca76 Mon Sep 17 00:00:00 2001 From: Shawn Carey Date: Fri, 11 Oct 2024 12:11:21 -0400 Subject: [PATCH 3/5] restore container in cpack workflow --- .github/workflows/cpack.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cpack.yml b/.github/workflows/cpack.yml index 9dcf9561..a1e4d791 100644 --- a/.github/workflows/cpack.yml +++ b/.github/workflows/cpack.yml @@ -47,6 +47,8 @@ jobs: needs: set_matrix name: ${{ matrix.arch.rpm }} ${{ matrix.distro.name }} ${{ matrix.distro.version }} runs-on: ubuntu-20.04 + # build image name it from matrix values name:version unless override container is specified + container: ${{ matrix.distro.container || format('{0}:{1}', matrix.distro.name, matrix.distro.version) }} strategy: fail-fast: false matrix: ${{ fromJSON(needs.set_matrix.outputs.matrix) }} From f72a33d239b19516d5056a7d69106a85abec106f Mon Sep 17 00:00:00 2001 From: Shawn Carey Date: Fri, 11 Oct 2024 12:47:07 -0400 Subject: [PATCH 4/5] use correct cache key --- .github/workflows/cpack.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cpack.yml b/.github/workflows/cpack.yml index a1e4d791..b1b8cb2c 100644 --- a/.github/workflows/cpack.yml +++ b/.github/workflows/cpack.yml @@ -93,9 +93,14 @@ jobs: run: | mv -v ./.github/actions/openziti-tunnel-build-action/${DISTRO_LABEL}/* ./.github/actions/openziti-tunnel-build-action/ + - name: get cache key + id: get_cache_key_preset + shell: bash + run: echo "preset=$(echo ${{ matrix.arch.cmake }} | sed -e 's/^ci-//')" >> $GITHUB_OUTPUT + - uses: actions/cache@v4 with: - key: deps-${{ inputs.preset }}-${{ hashFiles('./vcpkg.json') }} + key: deps-${{ steps.get_cache_key_preset.outputs.preset }}-${{ hashFiles('./vcpkg.json') }} path: ./vcpkg_cache # entrypoint.sh uses the value of arch to select the cmake preset From d99040243d7c10704ccc6bba012c59abb6166499 Mon Sep 17 00:00:00 2001 From: Shawn Carey Date: Fri, 11 Oct 2024 14:33:45 -0400 Subject: [PATCH 5/5] use unique key for cpack caches --- .github/workflows/cpack.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/cpack.yml b/.github/workflows/cpack.yml index b1b8cb2c..100ae8de 100644 --- a/.github/workflows/cpack.yml +++ b/.github/workflows/cpack.yml @@ -93,14 +93,9 @@ jobs: run: | mv -v ./.github/actions/openziti-tunnel-build-action/${DISTRO_LABEL}/* ./.github/actions/openziti-tunnel-build-action/ - - name: get cache key - id: get_cache_key_preset - shell: bash - run: echo "preset=$(echo ${{ matrix.arch.cmake }} | sed -e 's/^ci-//')" >> $GITHUB_OUTPUT - - uses: actions/cache@v4 with: - key: deps-${{ steps.get_cache_key_preset.outputs.preset }}-${{ hashFiles('./vcpkg.json') }} + key: deps-cpack-${{ matrix.arch.rpm }}-${{ matrix.distro.name }}-${{ matrix.distro.version }}-${{ hashFiles('./vcpkg.json') }} path: ./vcpkg_cache # entrypoint.sh uses the value of arch to select the cmake preset