diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..619e9bd4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +# Referenced from: +# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot + +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/perlbrew.sha256 b/.github/workflows/perlbrew.sha256 deleted file mode 100644 index d9992912..00000000 --- a/.github/workflows/perlbrew.sha256 +++ /dev/null @@ -1 +0,0 @@ -c3996e4fae37a0ae01839cdd73752fb7b17e81bac2a8b39712463a7d518c4945 perlbrew.sh diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 88c8bc95..5ee5ffce 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -71,7 +71,7 @@ jobs: # singularity so that paths used are misleading/unclear - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install OS dependencies" run: | @@ -94,7 +94,7 @@ jobs: echo DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus" >> $GITHUB_ENV - name: "Cache Singularity images" - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.SINGULARITY_CACHEDIR }} key: ${{ runner.os }}-singularity @@ -134,7 +134,7 @@ jobs: - name: "Cache Perl" id: cache-perl - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.PERL_CACHE }} key: ${{ runner.os }}-${{ matrix.perl }}-perl @@ -142,10 +142,8 @@ jobs: - name: "Install Perlbrew" if: steps.cache-perl.outputs.cache-hit != 'true' run: | - curl -sSL https://install.perlbrew.pl -o perlbrew.sh - sha256sum -c .github/workflows/perlbrew.sha256 export PERLBREW_ROOT=${{ env.PERL_CACHE }} - sh perlbrew.sh + ./scripts/install_perlbrew.sh source ${{ env.PERL_CACHE }}/etc/bashrc perlbrew available diff --git a/Changes b/Changes index 97d3cd9a..c5911c02 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,20 @@ Unreleased +Release 3.24.1 (2024-10-04) + + - Fix handling of undefined data release strategy + - Improve error handling when listing collections (add early returns). + - Move Perlbrew install to a script so that it can be used by both + GitHub Actions and Docker. + - Added .github/dependabot.yml file to auto-update GitHub actions + - Following a release on 07/09/2024, see https://metacpan.org/dist/App-perlbrew/changes + the checksum of the script served by https://install.perlbrew.pl had changed. + https://install.perlbrew.pl is a redirect to raw + https://github.com/gugod/App-perlbrew/blob/master/perlbrew-install, so + the change originates from GitHub and can be trusted. Our CI flow compares + the checksum of the downloaded script to the expected value. We now store + an updated expected checksum value, which corresponds to the latest release. + Release 3.24.0 (2024-09-02) - populate_wtsi_irods_groups now sets ss__human group membership if diff --git a/bin/populate_wtsi_irods_groups.pl b/bin/populate_wtsi_irods_groups.pl index 7aad7e04..0e0690bb 100755 --- a/bin/populate_wtsi_irods_groups.pl +++ b/bin/populate_wtsi_irods_groups.pl @@ -166,7 +166,8 @@ sub _uid_to_irods_uid { @members = map { _uid_to_irods_uid($_) } map { @{ $group2uids->{$_} || [$_] } } @dags; } - elsif ($study->data_release_strategy ne $MANAGED_TYPE) { + elsif (defined $study->data_release_strategy and + $study->data_release_strategy ne $MANAGED_TYPE) { @members = @public; } else { diff --git a/lib/WTSI/NPG/iRODS/BatonClient.pm b/lib/WTSI/NPG/iRODS/BatonClient.pm index c30353ce..4984d0e0 100644 --- a/lib/WTSI/NPG/iRODS/BatonClient.pm +++ b/lib/WTSI/NPG/iRODS/BatonClient.pm @@ -918,37 +918,35 @@ sub _list_collection { my $response = $self->communicate($spec); $self->validate_response($response); - my @all_specs; + if ($response->{error}) { + if ($response->{error}->{code} == $ITEM_DOES_NOT_EXIST) { + return (undef, undef); + } - if ($response->{error} && - $response->{error}->{code} == $ITEM_DOES_NOT_EXIST) { - @all_specs = (undef, undef); + $self->logconfess('Error listing collection: ', $self->encode($response)); } - else { - my @object_specs; - my @collection_specs; - if (!exists $response->{contents}) { - $self->logconfess('The returned path spec did not have ', - 'a "contents" key: ', $self->encode($response)); - } + my @object_specs; + my @collection_specs; - my @contents = @{delete $response->{contents}}; - push @collection_specs, $response; + if (!exists $response->{contents}) { + $self->logconfess('The returned path spec did not have ', + 'a "contents" key: ', $self->encode($response)); + } - foreach my $path (@contents) { - if (exists $path->{data_object}) { - push @object_specs, $path; - } - else { - push @collection_specs, $path; - } - } + my @contents = @{delete $response->{contents}}; + push @collection_specs, $response; - @all_specs = (\@object_specs, \@collection_specs); + foreach my $path (@contents) { + if (exists $path->{data_object}) { + push @object_specs, $path; + } + else { + push @collection_specs, $path; + } } - return @all_specs; + return (\@object_specs, \@collection_specs); } # Return two arrays of path specs, given a collection path to recurse diff --git a/scripts/install_perlbrew.sh b/scripts/install_perlbrew.sh new file mode 100755 index 00000000..cf5f76e5 --- /dev/null +++ b/scripts/install_perlbrew.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -ex + +PERLBREW_ROOT=${PERLBREW_ROOT:-"/app/perlbrew"} +export PERLBREW_ROOT + +PERLBREW_SHA256="8f254651d2eee188199b3355228eb67166974716081b794ca93b69c8f949c38d" +curl -sSL https://install.perlbrew.pl -o ./perlbrew.sh +sha256sum ./perlbrew.sh | grep "$PERLBREW_SHA256" +/bin/bash ./perlbrew.sh +rm ./perlbrew.sh diff --git a/scripts/perlbrew.sha256 b/scripts/perlbrew.sha256 new file mode 100644 index 00000000..2623e110 --- /dev/null +++ b/scripts/perlbrew.sha256 @@ -0,0 +1 @@ +8f254651d2eee188199b3355228eb67166974716081b794ca93b69c8f949c38d perlbrew.sh