Manually Assign a GitLab Project (VSCode) - visual-studio-code

I want to use the GitLab VS Code Extension with a private project.
I added my account, generated the token and saved it in VsCode.
When I click on the extension I can see the name of my project but it's marked as "no gitLab project".
When I right click on it, I can select "Manually Assign a GitLab Project" and then I have a textbox to fill. I tried with the local path of my project (where the .git file is), I tried with the link I use in the browser to get to my project and the link I use to clone it, but I always get "Cannot find project with path ..."
What's the right way of setting my project?

I had the same issue tyring to connect with , I have linked vsCode to GitLab with following steps:
On vsCode CMD + P , type: > Gitlab: Add Account to VS Code
Add URL to Gitlab instance: it is not necessarily https://gitlab.com, it could be something different, like for example https://gitlab.company-name.com/ (IMPORTANT to put the right link)
Paste your GitLab personal Access Token
In case you do not have an access token yet, just go here https://gitlab.com/-/profile/personal_access_tokens or https://gitlab.xxxxx.com/-/profile/personal_access_tokens and create new access token, you just need api & api_user that's the default, you can add more premissions if you need, put the expiration time to next month, year or whatever date in the future
Then you suppose to see the project(s) in your gitlab account on vscode.

Related

I am trying to get vscode extension gitlab workflow to connect, but get invalid url error

When I launch VSCode with the GitLab workflow extension, I get this error message:
Invalid URL: git#gitlab.com:#####/######.git/
(I have removed address with #).
If I right click and open folder in terminal, I can git push.
When I set up extension, I accepted the GitLab instance and pasted my personal access token.
Do you think I cloned the wrong URL?
This is about GitLab VS Code Extension, code at gitlab-org/gitlab-vscode-extension
First, you should not paste a token for an SSH URL: a token is only used as password for HTTPS URL.
Second, this is followed by gitlab-org/gitlab-vscode-extension issue 385 (initially about HTTPS URL, but with questions around SSH URL as well)
It recommends:
checking the gitlab.instanceUrl setting, or the presence of instanceUrl in your VS Code settings.json.
reviewing the extension logs (CMD+SHIFT+P and enter GitLab: Show extension logs command)
trying to start the VS Code editor, but make sure that the GitLab sidebar is hidden during the start (make sure that you are on, for example, the "explorer" tab when you are closing the VS Code editor so it will start on the "explorer" tab): just to avoid any extension initialization bug.
The error:
[info]: Found gitlab.com in the PAT list and git remotes, using it as the instanceUrl
was seen in gitlab-org/gitlab-vscode-extension issue 307.
And lead to issue 281.
I suggest telling it clearly on the readme to avoid group name in the URL configuration as it is taken from the workspace name.
Note that GitLab 15.0 (May 2022) offers an alternative:
Multiple account support for GitLab Workflow in VS Code
When setting up GitLab Workflow for VS Code, you must provide a token to authenticate to GitLab. This token authenticates you to your GitLab instance as a particular user for checking out code, seeing issues, reviewing merge requests, and more.
In GitLab Workflow 3.44, you can now use multiple tokens to authenticate to the same GitLab instance. This can be great for users who have both work and personal accounts, or accounts with separated duties.
We’ve also improved key storage for tokens, which will now be stored in VS Code’s SecretStorage, and is backed by your operating system keychain.
See Documentation and Issue.
And See GitLab 15.1 (June 2022) adds:
GitLab.com sign-in for GitLab Workflow for VS Code
Getting started with GitLab Workflow for VS Code has been challenging: install the extension, only to learn you needed to follow several extra steps to set the extension up properly. The most difficult aspect of getting started was generating a personal access token with the right scope and adding it to the extension.
Release v3.47.0 of GitLab Workflow now supports OAuth for GitLab.com, removing the need to manually generate a token. This is a huge step in making it easier for you to start using GitLab inside of VS Code.
See Documentation and Epic.

Google Cloud Functions: Project layout for Github publishing

I'm starting with Google Cloud Functions, and I want to use a real editor + github instead of the inline editor.
For an existing Google App Engine Flex(php) project, I've modified it so that it publish on PubSub some data about user.
I want to write a set of functions :
One function that update BigQuery, and post on a topic that a user data has been updated
Subscribed to this update : Several functions would run on query on BigQueries and store the result in Firebase (for a mobile app to display the data statistics)
Here are some basic questions I couldn't find any answer :
How can I organise my project? What is the expected layout so that GCP can fetch the project from github and run it ?
[Optional] Can I have multiple file for one function to organise my code ?
I've found this : https://github.com/PrinceCornNM/generator-firebase-cloud-functions
but I also read that the Function for firebase was somehow incompatible on a stackoverflow post.
Here is how I made it work :
Setup the Github Repository
Create a repo on Githup, checkout from my IDE
Create a folder with the name of the function 'processNewTroncQueteur'
Create a package.json and index.js in this folder, and copy the content of my working function from Google Cloud Function
Commit
Check my repository as an example : https://github.com/dev-mansonthomas/RedCrossQuestCloudFunctions
Sync my Github Repo with Google Source Control
Go to https://source.cloud.google.com/
"New Repository", "Connect external repository"
Select your GCP Project, then choose github, check the checkbox for consent, and click "Connect to GitHub" (follow instructions)
Choose the project on GitHub, and click "Connect Selected Repository"
(I had to try twice, the first time I got an error without details)
Create your Cloud Function from Source Control
Go to https://console.cloud.google.com/functions/
New Function
Choose Name, Memory, Trigger, Runtime, and region (advanced)
Choose "Cloud Source Repository" for "Source Code"
Repository : Copy/Paste the repo name from "Google Cloud Repository", you can find it, in the upper left corner of the screen, when you're in the repo. For me it's: github_dev-mansonthomas_RedCrossQuestCloudFunctions
I used, Branch/Master
Directory with source code : the name of the folder 'processNewTroncQueteur'
function to execute: 'processNewTroncQueteur'
Create, and I've tested it and it works.

How can I setup access to a private github repository in Openshift 3?

Well, i'm using Openshift to host a node.js application, and some things need to be private. So i need to let Openshift acess my Git repository in private.
I found some tutorials in the internet, but no one helped me.
I tried using PuTTY, i used Git Bash, but i failed everytime.
Everytime i get this error from Openshift:
error: build error: failed to fetch requested repository "myrepository.git" with provided credentials
(i changed the repository url in the error)
Well, what can i do to setup Openshift to acess a private repository?
I'm using OpenShift 3.
It took me a bit of time to figure it out, since the last step is missing in the configuration.
In order to give OpenShift 3 access to a private github repository, I performed the following:
> oc secrets new-basicauth github-credentials --username=<yourgithubusername> --password=<yourgithubpassword>
It returns:
secret/github-credentials
Then (and here is the missing part) from the Openshift 3 web interface:
Click on Build
Click on your application's link
On the top right, click on Action and select Edit
Underneath Git Repository URL, click on Advanced Options
In Source Secrets, select github-credentials
Click on Save at the bottom of the screen.
You can try this solution:
consider that I am using openshift version 3.11
So, on the left side menu click on "Builds" then "Builds" again, then click on the name of your project, now click on the action button and select "edit" option. now click on "Show advanced options", in the Build Secret Section "Create New Secret", put a new secret name and the user name and password that you use for the private repository. Now select a build secret that you have created. That is all!

Change Artifacts Explore Link in Visual Studio Team Services

I have successfully created a build within Visual Studio Team Services. One step of the build is to copy the outcome (artifact) to a Drop Folder which contains all versions of the artifact for that build. So far so good.
As you can see in the following image. I am using a File share as the Artifact Type and then I specify the path where the artifact has to be copied.
Now the issue. When I go to the build summary and click on the artifact tab, I can see the explore link. Clicking on that link will pop up the following:
The browser cannot open the following location due to this browser's
security settings. You will need to copy the location and open it
manually.
The location is: file://BuildServer/BuildDrops/MyArtifactName/[version
here]
OK to copy the location to your clipboard.
So I set up an FTP server in such a way that the ftp://BuildServer/BuildDrops/ URL is pointing to the same path specified in the Copy Publish Artifact build task.
But I see no way to modify the link to use my custom URL.
Ideally, the Copy Publish Artifact task should accept a variable, let's say, Artifact Link Base URL so I can pass the value for the base URL and the link will use this value instead.
Anyway, my question.
Is there any way to modify the link whatsoever?
There isn’t the way or feature to modify the artifact link URL in Visual Studio Team Services.
You can build a custom extension (https://www.visualstudio.com/en-us/docs/integrate/extensions/overview_ to build a FTP URL according to build artifact download URL, then generate a hyperlink to navigate to corresponding FTP site.
Extension sample for build results: https://github.com/Microsoft/vsts-extension-samples/tree/master/build-results-enhancer

how to setup remote host for jenkins parameterized remote trigger plugin

How do you setup the remote host field for Jenkins Parameterized Remote Trigger Plugin? The documentation doesn't seem clear to me, and this explanatory blog post has some Jenkins UI features that I can't locate.
This article suggests going to Manage Jenkins > Configure Credentials to add a Domain, but when I go there I see no "Add Domain" button:
The plugin wiki shows screenshots of a section on a page labelled "Parameterized Remote Trigger Configuration". How do I view this section in Jenkins, where is it? I thought it might be in Manage Jenkins > Manage Plugins, but there is no "Manage" or "Configure" button there:
How do I add a "Host" to my Parameterized Remote Trigger Plugin so that I can use it in a Jenkins job?
Update: The official Parameterized Remote Plugin has gone stale and may not fully work. sap-production appears to be maintaining a much more up-to-date version here. You can install it on your instance by cloning the repo then running mvn package. Then install the ./target/Parameterized-Remote-Trigger.hpi file using Manage Jenkins > Manage Plugins > Advanced (tab) > Upload Plugin
It appears that the Jenkins UI has changed over time. Here is how it works now.
Add The Domain
On the left sidebar of the main Jenkins UI, click Credentials > System > Add domain
Name the domain whatever you like, then click Add > Hostname
Fill in the IP or hostname of the remote Jenkins instance in "Includes"
Set Up Credentials
The previous step leaves you on a page with an "Add Credentials" button. Click that. If you can't find it, then you can locate it from the main view via: Credentials > System > Your Domain
If not already selected, then select "Username with password". Choose a scope.
Fill in all the fields as shown. I personally recommend creating a new user on the remote Jenkins and generating an API token and using that here, but you could also just generate an API token for your own user. Click OK.
Configure Parameterized Remote Trigger Plugin
From the main Jenkins page click Manage Jenkins > Configure System, then scroll down to the Parameterized Remote Trigger Configuration section and click Add.
Fill out at least the Authentication and Remote address and port properties, then click Save.
Add Build Step In Job
Open an existing Jenkins job or create a new one, scroll down to the Build section, and add the build step Trigger a remote parameterized job:
Select your host, and fill the rest of the values in.
This is well documented on the plugin's wiki page. See the "System configuration option" section. If you're having trouble with one of the fields specifically, please add more detail to your question.