Deploy shiny app on shinyapp.io with package in private organization repo - github

I'm trying to deploy a shiny app to the shinyapps.io server, but keep getting an error relating to a custom-built package that is hosted in a private github repo owned by our organization (note that I have replaced the actual name of the package, company name, and private repo name in the error below):
error: Building package: [PACKAGE NAME]
################################ Begin Task Log
################################
################################# End Task Log
#################################
Error: Unhandled Exception: Child Task 530176316 failed: Error building
image: Error fetching [PACKAGE NAME] (1.0.2) source. Error accessing GitHub
repository ORGANIZATION/PRIVATE_REPO. HTTP 404: Not Found
I know the repo link is good, because installing via devtools::install_github("ORGANIZATION/PRIVATE_REPO, auth_token = token works.
I'm an admin for the organization page, and also made sure that token has both repo and admin:org scope.
I've also made sure to tick "Private Repository Access" in my shinyapps.io account page as stated here.
Anyone have any thoughts on what I might be doing wrong??
Thanks!

Create an .Rprofile file in your project folder that you would intend to deploy.
You would need to set that repo options in the .Rprofile. and add your private github link. Something like
# A sample .Rprofile file with two different package repositories.
local({
r <- getOption("repos")
r["CRAN"] <- "https://cran.rstudio.com/"
r["mycompany"] <- "http://rpackages.mycompany.com/"
options(repos = r)
})
This is well explained here. Package management in RStudio Connect.

It is necessary to enable private access to the repo in the shinyapps.io dashboard as shown here
But you also need to give the proper permissions to the organization from github -> settings -> applications
Select shinyapps from the applications list
And then grant access to the specific organization
And you are done!
rsconnect will automatically detect the source of the repo, provided it as installed with the auth_token parameter using devtools::install_github

Just in case, I found the above answer to allow for specific corporate repositories, not installing from a private github repo. For that, this link has this to say:
Go to Account >> Profile, then under github LINK the accounts, and allow private repo access.

Related

Project nuget feed in azure dev cannot be accessed from reader

I have created a Project scoped nuget feed in azure dev. I have some developers that I want them to be able to list/restore and read nuget packages so that they can add them in the projects they are working on.
I have added them in my organization (they are using an email address like outlook.com and gmail.com) without any project access and then from the nuget feed permissions I gave the permissions as Readers
When they try to run nuget list they get
Unable to load the service index for source https://pkgs.dev.azure.com/myorganizationname/e1f090d9-f848-428b-b774-7fd9dfc873ef/_packaging/Nuget-Test-Feed/nuget/v3/index.json.
Response status code does not indicate success: 404 (Not Found - VS800075: The project with id 'vstfs:///Classification/TeamProject/e1f090d9-f848-428b-b774-7fd9dfc873ef' does not exist, or you do not have permission to access it. (DevOps Activity ID: 09410946-865a-4d69-9b05-f1fd1d668891)).
Why they are not be able to access this feed?
Project nuget feed in azure dev cannot be accessed from reader
That is because the Project-scoped feeds inherit the visibility of the project.
So, if the user is not added to the project, will not access the feed.
To resolve this issue, please try to add the user to the project.
As test, I add my test use as Project Readers:
Then my test user could access the feed:

GitHub App access to other repositories in organization

I have a Github App created under an organization and is installed to a repository under the same organization. This app needs read access to other repositories in the same organization for fetching configuration. I tried reading a file from a different repository after authenticating using github3 login_as_app_installation API. I get below error
File "lib/python3.6/site-packages/github3/github.py", line 1981, in repository
json = self._json(self._get(url), 200)
File "lib/python3.6/site-packages/github3/models.py", line 156, in _json
raise exceptions.error_for(response)
github3.exceptions.NotFoundError: 404 Not Found
But this works if I install the app to every repository where I need read access. Can I achieve this without installing the app explicitly as there is no concept of Access Token at Organization level?
Installation token only allows access to the repository where the app is installed. If we need access to other repositories either we need to install the app to the repository or get access to it using the personal access token

dotnet restore failing - Unable to load the service index for source [package name]

I have a build in VSTS which is failing with the following error:
error : Unable to load the service index for source [source name] 2018-02-28T09:04:12.1080070Z /usr/share/dotnet/sdk/1.1.4/NuGet.targets(102,5)
error : Response status code does not indicate success: 402 (Payment Required - The user does not have a license for the extension ms.feed.
This happened after reducing the access level of the user who created the Package from Basic to Stakeholder in VSTS, which in turn removed the Package Management extension from that user also. Putting the access level back to Basic and giving them the Package Management extension resolves the issue, although this is not a long term fix as they've left the company now.
I've ensured that there are users that with the Package Management extension, and also with a PAT that has permissions for Packages. I then updated the password in the nuget.config file to be the aforementioned PAT token, however the build still fails with the above error if the user who set the Package is at Stakeholder level.
I'm guessing that the user set up something with their PAT which in some way links them to the package, but I'm struggling to find what this is/where it might be.
I'm running the build on a build agent hosted in Docker.
Any help would be much appreciated - thanks!
The 402 Payment Required status code means that the private feed/package is locked because the feed owner's subscription has expired.
If the owner of a private feed downgrades a paid subscription to a free one or if the subscription expires, any private feeds on the account will become read-only for a period of days. After this period, the feed will become locked, meaning private feeds cannot be accessed until the subscription is renewed or the feed is made public.
As a workaround, you could abandon the package and use a new user with the Package Management extension license to create a new package on same setting.
Here was solution for the same issue. For the developer having the issue, go to
nav to https://{YourOrgName1}.visualstudio.com/_settings/users
Click "Three dots" next to user Name > Manage Extensions
Click tab "Extensions" and enable "Package Management"
Have developer retry build.

Can I configure a Bluemix Continuous Delivery toolchain to use a private Github repository?

I have a private Github repository in a private Github organisation, and I'd like to configure Bluemix's "Continuous Integration" service to use that repository so that I can load source code from it to build in a delivery pipeline in that toolchain.
The "View docs" link for the GitHub tile in the toolchain points to a documentation page for the older DevOps Services, which doesn't give any information on configuring a GitHub repository in a toolchain.
When I try entering the URL for my repo, it comes up with this error:
The integration could not be set up. Check the settings and try again.
Reason: An error occurred while cloning the git repository. Error details: Unable to read the repository on: (URL removed). User is not authorized, or repository does not exist.
I'd expect to be given the option to authorise Bluemix against my account, but I'm not.
How can I access this repository?
It is possible to set up an integration with a private GitHub repository as long as you have authorized Bluemix with your GitHub account and have granted Bluemix permission in the org that owns the repo.
The first time you attempt to create a GitHub integration, you will be prompted to authorize with GitHub. On the GitHub authorization page, you have the option to select the orgs that you want to give Bluemix access to before you click the "Authorize" button.
It sounds like you've already gone through the initial authorization step and may have missed adding the org authorization. You can update the org authorization on GitHub's authorized applications page (https://github.com/settings/applications). Click the "IBM Bluemix Toolchains" application. On that page, under "Organization Access", grant access to the organization that owns the repo you want to integrate with. That should allow you to set up the integration.

I cannot link toolchain to different github organization

I have a github account: https://github.com/remkohdev
and am a member of several github organizations
I have added all organizations to the Bluemix DevOps Third Party applications authorizations.
But I cannot change the default github organization to a different organization when I enable the Toolchain on Bluemix, so that I can create/edit the source code to the repo in a different than default Github organization?
Error:
The integration could not be set up. Check the settings and try again.
Reason: Unable to update the git integration. An error occurred while cloning the git repository. Error details: Unable to read the repository on: https://github.com/eventquarry/server.git. User is not authorized, or repository does not exist.
When you authorized with GitHub you probably did not explicitly grant access to the eventquarry organization.
To fix this, first you need to revoke your token by logging into Github.com, then click settings > Authorized applications > Revoke "IBM Bluemix Toolchains". Now go back to Bluemix, and when you click on the GitHub tool you will see an “Authorize” button. Upon clicking, you will be taken to GitHub, and here you need to click "Grant Access" next to eventquarry (and all orgs you would like to grant access to) before clicking "Authorize application".
Now you should be able to fork/clone/link with the private repositories in the eventquarry organization.
The devops git folks responded with this:
Right now, we don't support the ability to create new organization repositories through the toolchain UI. Any new repos are created under the personal account of the user. It is possible to link to existing organization repos by typing in the repo URL in the field. (Org repos won't show up in the dropdown, but the URL can be entered manually.) Note that the user needs admin privileges on the repo they're linking to in order to have a fully functioning integration though. It's possible to link to a repo without admin privileges, but we can't create a webhook on the repo, so there's no way for us to be notified of commit events. Pipelines will only run manually if the user doesn't have admin privileges on the repo.
Let me know if this is helpful...