From c5104c3dc1b1d1e57d0d964a07575a7ebc3a5ed2 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Tue, 4 Jan 2022 10:57:23 +1000 Subject: [PATCH 1/2] terraform-providers: update-provider script - add nixpkgs path for nix-prefetch --- .../networking/cluster/terraform-providers/update-provider | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/networking/cluster/terraform-providers/update-provider b/pkgs/applications/networking/cluster/terraform-providers/update-provider index 47206914f7a9..0cbb855da200 100755 --- a/pkgs/applications/networking/cluster/terraform-providers/update-provider +++ b/pkgs/applications/networking/cluster/terraform-providers/update-provider @@ -149,7 +149,7 @@ if [[ -z ${vendorSha256} ]]; then vendorSha256=null elif [[ -n ${old_vendor_sha256} || ${vendor} == 1 ]]; then echo "=== Calculating vendorSha256 ===" - vendorSha256=$(nix-prefetch "{ sha256 }: (import ../../../../.. {}).terraform-providers.${provider_name}.go-modules.overrideAttrs (_: { vendorSha256 = sha256; })") + vendorSha256=$(nix-prefetch -I nixpkgs=../../../../.. "{ sha256 }: (import ../../../../.. {}).terraform-providers.${provider_name}.go-modules.overrideAttrs (_: { vendorSha256 = sha256; })") # Deal with nix unstable if [[ ${vendorSha256} == sha256-* ]]; then vendorSha256=$(nix --extra-experimental-features nix-command hash to-base32 "${vendorSha256}") From bcd238a0270f593283a5c502f99f8b9317e7963d Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Tue, 4 Jan 2022 10:57:23 +1000 Subject: [PATCH 2/2] .github/workflows/update-terraform-providers.yml: init weekly update of terraform providers which can also be run manually --- .../workflows/update-terraform-providers.yml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/update-terraform-providers.yml diff --git a/.github/workflows/update-terraform-providers.yml b/.github/workflows/update-terraform-providers.yml new file mode 100644 index 000000000000..58a08aa111ca --- /dev/null +++ b/.github/workflows/update-terraform-providers.yml @@ -0,0 +1,47 @@ +name: "Update terraform-providers" + +on: + schedule: + - cron: "14 3 * * 1" + workflow_dispatch: + +jobs: + tf-providers: + if: github.repository_owner == 'NixOS' && github.ref == 'refs/heads/master' # ensure workflow_dispatch only runs on master + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: cachix/install-nix-action@v16 + - name: setup + id: setup + run: | + echo ::set-output name=title::"terraform-providers: update $(date -u +"%Y-%m-%d")" + - name: update terraform-providers + run: | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" + pushd pkgs/applications/networking/cluster/terraform-providers + ./update-all-providers + git commit -m "${{ steps.setup.outputs.title }}" providers.json + popd + - name: create PR + uses: peter-evans/create-pull-request@v3 + with: + body: | + Automatic update of terraform providers. + + Created by [update-terraform-providers](https://github.com/NixOS/nixpkgs/blob/master/.github/workflows/update-terraform-providers.yml) action. + + @ofborg build terraform-full + branch: terraform-providers-update + delete-branch: false + draft: true + title: ${{ steps.setup.outputs.title }} + token: ${{ secrets.GITHUB_TOKEN }} + - name: comment on failure + uses: peter-evans/create-or-update-comment@v1 + if: ${{ failure() }} + with: + issue-number: 153416 + body: | + Automatic update of terraform providers [failed](https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }}).