inbo / iassetR

Interact with the iAsset api using R
https://inbo.github.io/iassetR/
Other
0 stars 1 forks source link

Get Keyring to work with github actions #43

Closed SanderDevisscher closed 4 months ago

SanderDevisscher commented 4 months ago

I'am experiencing issues with getting get_records() to run with github actions. I get the following error:

Error in b__file_keyring_autocreate(self, private, keyring) : 
  The 'system' keyring does not exists, create it first!
Calls: source ... b_file_list -> <Anonymous> -> b__file_keyring_autocreate
Execution halted

in https://github.com/inbo/aspbo/actions/workflows/get_vespa_velutina_management.yaml. My latest run: https://github.com/inbo/aspbo/actions/runs/8615691797/job/23613099659

its seems the error occurs when the workflow runs the following code: https://github.com/inbo/aspbo/blob/afee4e3527ef617f9a1c6074242b838989d9ed71/src/Vespa%20velutina%20management/get_data_from_iAsset.Rmd#L33-L39

When I look at the keyring readme I see the following remark:

The envvar backend doesn’t support custom keyrings, so if you’re using one locally you’ll need to use the default keyring on GitHub.

This makes me suspect adding service = "iasset_password" is the cause of this issue.

PS I added "iasset_username" & "iasset_password" as github Actions secrets on the repository level.

PietrH commented 4 months ago

As I understand it, we are currently using the system keyring.

I believe it goes: keyring -> service -> username/password combinations

PietrH commented 4 months ago

From here: https://keyring.r-lib.org/index.html#github

Did you make changes to the workflow yml?

    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
      R_KEEP_PKG_SOURCE: yes
      MY_SECRET: ${{ secrets.my_secret }}
SanderDevisscher commented 4 months ago

Yes: https://github.com/inbo/aspbo/blob/91ebd108146117f50808609359109ea88679d3e4/.github/workflows/get_vespa_velutina_management.yaml#L80-L85

PietrH commented 4 months ago

Interesting, what happens if you don't set a service name for name value pairs in keyring?

You could also create an issue in keyring to see if we are missing something.

SanderDevisscher commented 4 months ago

This is costing me a lot of time can't we just revert to 8c012bfb40857cebacf90000623a51c2078b53ec ?

PietrH commented 4 months ago

The decision is up to you, keyring seems like the best solution to me.

The documentation of keyring makes it sound like it's easy to use within github actions, so maybe we should ask them for help.