Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannguyen4 committed Sep 25, 2024
1 parent 538b2d2 commit 33a70d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 43 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/jfrog-filespec.json

This file was deleted.

31 changes: 12 additions & 19 deletions .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,43 +30,36 @@ jobs:
# We want this environment variable to be available when calling a reusable workflow
# so we convert it to a job output so the reusable workflow can access it
python-tag: ${{ env.PYTHON_TAG }}
env:
JFROG_FILESPEC_NAME: jfrog-filespec.json
runs-on: ubuntu-22.04
steps:
- uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: ${{ secrets.JFROG_PLATFORM_URL }}
JF_ACCESS_TOKEN: ${{ secrets.JFROG_ACCESS_TOKEN }}

- uses: actions/checkout@v4
with:
sparse-checkout-cone-mode: false
sparse-checkout: .github/workflows/${{ env.JFROG_FILESPEC_NAME }}

- name: Get shortened commit hash of this workflow run
# versioningit commit sha is always 8 chars long it seems
# We assume this prints out a sha that is at most 8 chars
run: echo SHORT_GITHUB_SHA=$(git rev-parse --short ${{ github.sha }}) >> $GITHUB_ENV

- name: Set filespec variables
# TODO: set using env var?
run: echo SPEC_VARS_FLAG='--spec-vars="repo_name=${{ vars.JFROG_GENERIC_REPO_NAME }};branch=${{ github.ref_name }};commit_sha=${{ env.SHORT_GITHUB_SHA }};python_tag=${{ env.PYTHON_TAG }}"' >> $GITHUB_ENV
run: echo SHORT_GITHUB_SHA=$(echo ${{ github.sha }} | cut -c1-8) >> $GITHUB_ENV

- name: Look for wheel built with default settings in JFrog
# AQL has the option to exclude patterns from search results
# but it doesn't allow regex, so we can't filter out any type of label in a wheel name
# Example: we want to filter out "unoptimized" and "dsym" but in case we add more labels, we want to use regex
# to handle those new labels without updating the regex.
run: echo $(jf rt search "${{ vars.JFROG_GENERIC_REPO_NAME }}/${{ github.ref_name }}/*${{ env.SHORT_GITHUB_SHA }}*${{ env.PYTHON_TAG }}*manylinux*x86_64*.whl" | jq '.[].path' | grep --invert-match "${{ env.SHORT_GITHUB_SHA }}\.") > file_matches.txt
shell: bash

- name: Count artifacts
id: count_num_artifacts_found
# We use AQL because we want to exclude builds if they have special labels, like unoptimized builds
# We can't use a search pattern to exclude strings, as far as I know
run: echo num_artifacts=$(jf rt search --count --spec=./${{ env.JFROG_FILESPEC_NAME }} ${{ env.SPEC_VARS_FLAG }}) >> $GITHUB_OUTPUT
working-directory: .github/workflows
run: echo num_artifacts=$(echo file_matches.txt | wc -l) >> $GITHUB_OUTPUT

- name: Cannot determine which artifact to use, fail out
- name: Multiple artifacts found, not sure which one to use. Fail out
if: ${{ steps.count_num_artifacts_found.outputs.num_artifacts > 1 }}
run: exit 1

- name: Found the exact artifact in JFrog, downloading...
if: ${{ steps.count_num_artifacts_found.outputs.num_artifacts == 1 }}
run: jf rt download --flat --fail-no-op --spec=./${{ env.JFROG_FILESPEC_NAME }} ${{ env.SPEC_VARS_FLAG }}
run: jf rt download --flat --fail-no-op "$(cat file_matches.txt)"
working-directory: .github/workflows

- name: Pass to valgrind job
Expand Down

0 comments on commit 33a70d3

Please sign in to comment.