From cda8edd5a00e5225ec2d45abd0d075854e5e8773 Mon Sep 17 00:00:00 2001 From: Timo Sairiala Date: Tue, 6 Feb 2024 09:56:36 +0200 Subject: [PATCH] update github action components - upload/download artifacts v3 -> v4 - jfrog-cli v3 -> v4 - remove cloud artifactory upload --- .../tiiuae-pixhawk-and-saluki-builder.yaml | 5 +- .../workflows/tiiuae-pixhawk-and-saluki.yaml | 118 ++++-------------- 2 files changed, 29 insertions(+), 94 deletions(-) diff --git a/.github/workflows/tiiuae-pixhawk-and-saluki-builder.yaml b/.github/workflows/tiiuae-pixhawk-and-saluki-builder.yaml index 79d45e6bebf5..b865d9ebb010 100644 --- a/.github/workflows/tiiuae-pixhawk-and-saluki-builder.yaml +++ b/.github/workflows/tiiuae-pixhawk-and-saluki-builder.yaml @@ -38,10 +38,9 @@ jobs: # run clone_public.sh if clone_public flag is provided ./clone_public.sh ./build.sh ../bin/ ${{ inputs.product }} - ls ../bin - name: Upload ${{ inputs.product }} - uses: actions/upload-artifact@v3.1.3 + uses: actions/upload-artifact@v4 with: - name: pixhawk + name: ${{ inputs.product }} path: bin/ retention-days: 1 diff --git a/.github/workflows/tiiuae-pixhawk-and-saluki.yaml b/.github/workflows/tiiuae-pixhawk-and-saluki.yaml index 8560e6a356cc..719543cc26dd 100644 --- a/.github/workflows/tiiuae-pixhawk-and-saluki.yaml +++ b/.github/workflows/tiiuae-pixhawk-and-saluki.yaml @@ -13,7 +13,7 @@ on: jfrog-upload: description: 'upload to Artifactory' required: false - default: true + default: false type: boolean saluki-v2-manual-fpga-version: description: 'saluki-v2 optional fpga version (e.g. sha-3b85ccc)' @@ -113,10 +113,11 @@ jobs: path: px4-firmware fetch-depth: 0 - name: Download pixhawk artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: pixhawk + name: saluki-* path: bin + merge-multiple: true - name: Run px4-firmware px4fwupdater build run: | set -eux @@ -126,7 +127,7 @@ jobs: ./build.sh ../bin/ px4fwupdater ls ../bin - name: Upload px4fwupdater to tmp storage - uses: actions/upload-artifact@v3.1.3 + uses: actions/upload-artifact@v4 with: name: pixhawk path: bin/ @@ -145,10 +146,10 @@ jobs: path: px4-firmware fetch-depth: 0 - name: Download pixhawk artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: pixhawk path: bin + merge-multiple: true - name: Firmware flasher - Container metadata id: containermeta # referenced from later step uses: docker/metadata-action@v5 @@ -255,10 +256,24 @@ jobs: echo "## Flash this px4 firmware to your Saluki by using fpga-flashing tool" >> $GITHUB_STEP_SUMMARY echo "fpga-flashing is separate tool: https://github.com/tiiuae/fpga-flashing/" >> $GITHUB_STEP_SUMMARY + echo "### Flash px4 firmware" >> $GITHUB_STEP_SUMMARY echo "To flash this px4 firmware and FPGA to your Saluki with fpga-flashing, you can use the following command:" >> $GITHUB_STEP_SUMMARY flash_tool_cmd='./flash.sh --update-package ' flash_tool_cmd+=$container_name - flash_tool_cmd+=' --fpga --px4' + flash_tool_cmd+=' --px4' + echo '```shell' >> $GITHUB_STEP_SUMMARY + echo "${flash_tool_cmd}" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + + # separator + echo '---' >> $GITHUB_STEP_SUMMARY + + echo "### Zeroize and flash FPGA and PX4" >> $GITHUB_STEP_SUMMARY + echo "To zeroize the device as new and flash px4 firmware, FPGA and RD certificate to your Saluki with fpga-flashing -tool, you can use the following command:" >> $GITHUB_STEP_SUMMARY + echo "please notice that FPGA flashing needs FlashPro connected" >> $GITHUB_STEP_SUMMARY + flash_tool_cmd='./flash.sh --update-package ' + flash_tool_cmd+=$container_name + flash_tool_cmd+=' --zeroize --fpga --px4 --rdc' echo '```shell' >> $GITHUB_STEP_SUMMARY echo "${flash_tool_cmd}" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY @@ -320,100 +335,21 @@ jobs: "saluki_v2_fpga_version=${{ needs.variables.outputs.saluki_v2_fpga_version }}" "saluki_v3_fpga_version=${{ needs.variables.outputs.saluki_v3_fpga_version }}" - artifactory: - name: upload builds to artifactory - if: ${{ github.event_name != 'workflow_dispatch' || inputs.jfrog-upload == true }} - runs-on: ubuntu-latest - needs: - - px4fwupdater - - fc_matrix - steps: - - name: Download pixhawk artifacts - uses: actions/download-artifact@v3 - with: - name: pixhawk - path: bin - - uses: jfrog/setup-jfrog-cli@v3 - env: - JF_ENV_1: ${{ secrets.ARTIFACTORY_CLOUD_TOKEN }} - - name: Upload px4-firmware build to Artifactory - env: - ARTIFACTORY_GEN_REPO: ssrc-gen-private-local - BUILD_NAME_PX4: px4-firmware - CI: true - run: | - set -exu - - pr_or_empty="" - latest_link="" - if [ ${{ github.event_name }} == 'pull_request' ]; then - latest_link="pr/" - pr_or_empty="pr/${{ github.head_ref || github.ref_name }}/" - fi - - newline=$'\n' - artifactory_links="| target | link | - |--------|------|" - artifactory_base_url="https://ssrc.jfrog.io/artifactory/" - - for pkg in $(find bin -type f|sort); do - - file_name=$(basename $pkg) - ext="${file_name##*.}" - target_path="" - pkg_name=$(echo $file_name | sed -r -e 's/-[0-9]+\.[0-9]+\.[0-9]+-.*//g') - - if [[ $file_name = px4_fmu* ]]; then - target_path="pixhawk" - elif [[ $file_name = ssrc_saluki* ]]; then - target_path="saluki" - else - echo "$pkg ignored" - continue - fi - - artifactory_path=$ARTIFACTORY_GEN_REPO/builds/px4-firmware/${target_path}/${pr_or_empty} - artifactory_latest_path=$ARTIFACTORY_GEN_REPO/builds/px4-firmware/${target_path}/${latest_link}latest/${pkg_name}.${ext} - - jfrog rt u --target-props COMMIT="$GITHUB_SHA" \ - --build-name "$BUILD_NAME_PX4" \ - --build-number "$GITHUB_SHA" \ - "$pkg" \ - "${artifactory_path}$file_name" - - # link to latest - jfrog rt cp --flat \ - "${artifactory_path}$file_name" \ - "${artifactory_latest_path}" - - # append every file to artifactory_links - artifactory_links+="${newline}| ${pkg_name} | ${artifactory_base_url}${artifactory_path}${file_name} |" - done - - jfrog rt build-publish "$BUILD_NAME_PX4" "$GITHUB_SHA" - jfrog rt bpr "$BUILD_NAME_PX4" "$GITHUB_SHA" "$ARTIFACTORY_GEN_REPO" \ - --status dev \ - --comment "development build" - - # save upload path to output for later use - echo "### Cloud Artifactory links:" >> $GITHUB_STEP_SUMMARY - echo "${artifactory_links}" >> $GITHUB_STEP_SUMMARY - artifactory-uae: name: upload builds to UAE artifactory - # temporarily disabled until we get new token from UAR - if: false + if: ${{ github.event_name != 'workflow_dispatch' || inputs.jfrog-upload == true }} runs-on: ubuntu-latest needs: - px4fwupdater - fc_matrix steps: - name: Download pixhawk artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: pixhawk + name: saluki-* path: bin - - uses: jfrog/setup-jfrog-cli@v3 + merge-multiple: true + - uses: jfrog/setup-jfrog-cli@v4 env: JF_ENV_1: ${{ secrets.UAE_ARTIFACTORY_TOKEN }} - name: Upload px4-firmware build to Artifactory