Buildkite Windows agent cannot find git executable - windows

I'm having trouble getting the Windows build agent to run a build. The agent is unable to checkout my source code. (Im using Windows 10) See GitHub issue
I am seeing the following error when running a build:
Buildkite Error: There was an error running `git clone -v -- git#github.com:myorg/myrepo.git .` (exec: "git": executable file not found in %PATH%)
I have installed git using chocolatey and git is accessible in CMD and Powershell on the agent's host and I can see it in my path if I run gci env:Path in Powershell. git's directory is at the end here:
C:\Program Files\Docker\Docker\Resources\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cm...
From a build's logs in BK's web UI, I see the following environment variables printed out:
BUILDKITE=true
BUILDKITE_AGENT_ACCESS_TOKEN=xxx
BUILDKITE_AGENT_DEBUG=true
BUILDKITE_AGENT_ENDPOINT=https://agent.buildkite.com/v3
BUILDKITE_AGENT_ID=xxx
BUILDKITE_AGENT_NAME=DESKTOP-1
BUILDKITE_AGENT_PID=5180
BUILDKITE_ARTIFACT_PATHS=
BUILDKITE_BIN_PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27
BUILDKITE_BRANCH=fix/build
BUILDKITE_BUILD_CHECKOUT_PATH=builds\DESKTOP-1\myorg\myrepo
BUILDKITE_BUILD_CREATOR=Jason
BUILDKITE_BUILD_CREATOR_EMAIL=myemail#gmail.com
BUILDKITE_BUILD_ID=xxx
BUILDKITE_BUILD_NUMBER=18
BUILDKITE_BUILD_PATH=builds
BUILDKITE_BUILD_URL=https://buildkite.com/myorg/myrepo/builds/18
BUILDKITE_COMMAND=msbuild
BUILDKITE_COMMAND_EVAL=true
BUILDKITE_COMMIT=HEAD
BUILDKITE_GIT_CLEAN_FLAGS=-fxdq
BUILDKITE_GIT_CLONE_FLAGS=-v
BUILDKITE_HOOKS_PATH=hooks
BUILDKITE_JOB_ID=xxx
BUILDKITE_MESSAGE=First build
BUILDKITE_ORGANIZATION_SLUG=myorg
BUILDKITE_PIPELINE_DEFAULT_BRANCH=master
BUILDKITE_PIPELINE_PROVIDER=github
BUILDKITE_PIPELINE_SLUG=myrepo
BUILDKITE_PLUGINS_PATH=plugins
BUILDKITE_PROJECT_PROVIDER=github
BUILDKITE_PROJECT_SLUG=myorg/myrepo
BUILDKITE_PULL_REQUEST=false
BUILDKITE_PULL_REQUEST_REPO=
BUILDKITE_REPO=git#github.com:myorg/myrepo.git
BUILDKITE_REPO_SSH_HOST=github.com
BUILDKITE_RETRY_COUNT=0
BUILDKITE_SCRIPT_PATH=msbuild
BUILDKITE_SOURCE=ui
BUILDKITE_SSH_FINGERPRINT_VERIFICATION=true
BUILDKITE_TAG=
BUILDKITE_TIMEOUT=false
CI=true
PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
Note that PATH in that output is not the same as my PATH from the Powershell and does not include the path to gits binary.
Full build output:
Build environment variables 0s
BUILDKITE=true
BUILDKITE_AGENT_ACCESS_TOKEN=xxx
BUILDKITE_AGENT_DEBUG=true
BUILDKITE_AGENT_ENDPOINT=https://agent.buildkite.com/v3
BUILDKITE_AGENT_ID=xxx
BUILDKITE_AGENT_NAME=DESKTOP-1
BUILDKITE_AGENT_PID=5180
BUILDKITE_ARTIFACT_PATHS=
BUILDKITE_BIN_PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27
BUILDKITE_BRANCH=fix/build
BUILDKITE_BUILD_CHECKOUT_PATH=builds\DESKTOP-1\myorg\myrepo
BUILDKITE_BUILD_CREATOR=Jason
BUILDKITE_BUILD_CREATOR_EMAIL= myemail#gmail.com
BUILDKITE_BUILD_ID=xxx
BUILDKITE_BUILD_NUMBER=18
BUILDKITE_BUILD_PATH=builds
BUILDKITE_BUILD_URL=https://buildkite.com/myorg/myrepo/builds/18
BUILDKITE_COMMAND=msbuild
BUILDKITE_COMMAND_EVAL=true
BUILDKITE_COMMIT=HEAD
BUILDKITE_GIT_CLEAN_FLAGS=-fxdq
BUILDKITE_GIT_CLONE_FLAGS=-v
BUILDKITE_HOOKS_PATH=hooks
BUILDKITE_JOB_ID=xxx
BUILDKITE_MESSAGE=First build
BUILDKITE_ORGANIZATION_SLUG=myorg
BUILDKITE_PIPELINE_DEFAULT_BRANCH=master
BUILDKITE_PIPELINE_PROVIDER=github
BUILDKITE_PIPELINE_SLUG=myrepo
BUILDKITE_PLUGINS_PATH=plugins
BUILDKITE_PROJECT_PROVIDER=github
BUILDKITE_PROJECT_SLUG=myorg/myrepo
BUILDKITE_PULL_REQUEST=false
BUILDKITE_PULL_REQUEST_REPO=
BUILDKITE_REPO=git#github.com:myorg/myrepo.git
BUILDKITE_REPO_SSH_HOST=github.com
BUILDKITE_RETRY_COUNT=0
BUILDKITE_SCRIPT_PATH=msbuild
BUILDKITE_SOURCE=ui
BUILDKITE_SSH_FINGERPRINT_VERIFICATION=true
BUILDKITE_TAG=
BUILDKITE_TIMEOUT=false
CI=true
PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
Running global environment hook 0s
# Skipping, no hook script found at "hooks\environment.bat"
Running global pre-checkout hook 0s
# Skipping, no hook script found at "hooks\pre-checkout.bat"
Preparing build directory 0s
# Changing working directory to "builds\DESKTOP-1\myorg\myrepo"
⚠ Buildkite Warning: Could not performn `ssh-keygen` (exec: "ssh-keygen": executable file not found in %PATH%)
> git clone -v -- git#github.com:myorg/myrepo.git .
🚨 Buildkite Error: There was an error running `git clone -v -- git#github.com:myorg/myrepo.git .` (exec: "git": executable file not found in %PATH%)

Your build output doesn't seem to have those chocolatey paths:
PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27;
You might need to add an agent environment hook which adds the right directories to the path. Or try updating to the latest beta which might fix the issue.

Related

use k8s deepcopy-gen generate code failed

I am going to use k8s code-generator to generator deepcopy file and my project under GOPATH/src, but i seems not work and got a problem about GOROOT.
deepcopy-gen command is deepcopy-gen -i k8s_customize_controller/pkg/apis -p k8s_customize_controller/pkg/client -v 10
output blow:
[root#centos72-k8s code-generator]# deepcopy-gen -i k8s_customize_controller/pkg/apis -p k8s_customize_controller/pkg/client -v 10
I0122 02:51:04.609157 17278 parse.go:383] importPackage k8s_customize_controller/pkg/apis
I0122 02:51:04.609359 17278 parse.go:330] addDir k8s_customize_controller/pkg/apis
I0122 02:51:04.730397 17278 parse.go:404] unable to import "k8s_customize_controller/pkg/apis": package k8s_customize_controller/pkg/apis is not in GOROOT (/usr/local/go/src/k8s_customize_controller/pkg/apis)
I0122 02:51:04.730701 17278 main.go:82] Completed successfully.
unable to import "k8s_customize_controller/pkg/apis": package k8s_customize_controller/pkg/apis is not in GOROOT
it seems this problem about GOROOT?
how to resolve this problem?
I had similar issue with an error like this:
Generating deepcopy funcs
F1018 10:51:28.259741 74132 main.go:80] Error: Failed making a parser: unable to add directory "github.com/[my-git-account]/[repo-name]/pkg/apis/v1": No files for pkg "github.com/[my-git-account]/[repo-name]/pkg/apis/v1"
The problem was that I recently moved my github golang projects folders out of the $GOPATH/src folder (which is in my case is ~/go/src), because it worked well on vanilla Ubuntu and WSL Ubuntu, but it has challenges to update packages on MacOS - I moved all my project from the folder ~/go/src/github.com/[my-git-account]
(where the code-generator expected them) to the folder ~/dev/[my-git-account].
Solution I use to fix the error above - to create a symbolic link on my current github projects folder to the $GOPATH/src/github.com:
ln -s ~/dev/[my-git-account] $GOPATH/src/github.com
This way there is a folder $GOPATH/src/github.com/[my-git-account] (provided by the sym-link) with golang projects, where code-generator can find them.
Faced one drawback of this trick - in the IDE navigation to the method can move to the linked source (within SDK package by the link - not to the source code, opened in the IDE).

Error when I run this command "fx set core.qemu-x64"

ERROR at //third_party/openssh-portable/fuchsia/developer-keys/BUILD.gn:10:24: Could not read file.
manifest = read_file("//.fx-ssh-path", "list lines")
^---------------
I resolved this to "/home/shivkumar/fuchsia_os/fuchsia/.fx-ssh-path".
See //products/core.gni:102:3: which caused the file to be included.
"//third_party/openssh-portable/fuchsia/developer-keys:ssh_config",
^-----------------------------------------------------------------
ERROR: error running gn gen: exit status 1
This error means that the //.fx-ssh-path file does not exist, or is otherwise unreadable. This file is typically generated on source checkout when the integration manifest runs //tools/ssh-keys/gen-ssh-keys.sh as a jiri hook.
To correct the problem, use gen-ssh-keys.sh again to re-generate the file(s) before setting your build configuration:
$ tools/ssh-keys/gen-ssh-keys.sh
$ fx set core.qemu-x64
Note: Hooks are also run anytime you run jiri update so you could also resync the source tree to correct the issue.

Git dependency errors when using Composer with private VCS repository on IBM i

More details below, but I'm running into the following error when I issue a composer install or composer update command on a project which uses a custom VCS repository for an included project. This is on an IBM i v7r3 system via SSH session. I've run out of ideas on how to troubleshoot further, so here I am. Has anyone ever seen this error or have any ideas on how to troubleshoot further?
Error:
bash-4.4$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 113 installs, 0 updates, 0 removals
- Installing sshUser/myPackage (v1.0.26): Cloning a2db0666b1
[RuntimeException]
Failed to clone gitUser:/opt/git/myPackage.git, git was not found, check that
it is installed and in your PATH env.
Could not load program git:
Dependent module /usr/local/zendphp7/lib/libz.so.1(shr_64.o) could not be loaded.
File /usr/local/zendphp7/lib/libz.so.1 is not an
archive or the file could not be read properly.
System error: Exec format error
I have a remote IBM i server which has two users. The first user "gitUser" is used for my private Git repositories (headless). I then have another user "sshUser" which is used to SSH in with and do my typical work. I have SSH keys configured to simplify connections for both users and the "gitUser" ssh key doesn't require a password, so I can use it for automated scripting.
I have a private VCS repository included in my composer.json file for a project. So long as I have the entry in the "repository" section I'm getting the above error. This occurs even if I'm not requireing a package from the repository.
Repository Entry:
"repositories": [
{
"type": "vcs",
"url": "gitUser:/opt/git/myPackage.git"
}
]
Composer on the IBM i is up to date at 1.7.2.
It's clear the issue lies with git and the inability to find a dependency in libz.so.1.
However, if I follow the chain of dependencies for the version of Git in my path, all the appropriate files exist with adequate permissions:
bash-4.4$ which git
/QOpenSys/pkgs/bin/git
bash-4.4$ dump -X64 -H /QOpenSys/pkgs/bin/git
/QOpenSys/pkgs/bin/git:
***Loader Section***
Loader Header Information
VERSION# #SYMtableENT #RELOCent LENidSTR
0x00000001 0x000000df 0x0000433f 0x0000009d
#IMPfilID OFFidSTR LENstrTBL OFFstrTBL
0x00000006 0x00044910 0x00000a18 0x000449ad
***Import File Strings***
INDEX PATH BASE MEMBER
0 /QOpenSys/pkgs/lib:/QOpenSys/usr/lib
1 libz.so.1 shr_64.o
2 libiconv.so.2 shr_64.o
3 libcrypto.so.1.0.0 shr_64.o
4 libpthread.a shr_xpg5_64.o
5 libc.a shr_64.o
bash-4.4$
I can confirm there are no permission failures through out all of this. So this doesn't seem to be the result of inadequate permissions. Also, I do not think the issue lies within the user profile gitUser as if I issue a composer install or composer update from another machine (with appropriate keys), everything works flawlessly. So it seems to be specific to the IBM i and the sshUser profile.
I'm starting to think Composer is using a different git executable and the dependencies of that executable do not exist. Though I assume Composer would just use my path.
Note*: I tried specifying my LIBPATH in my ./.profile with the following. But it doesn't seem to make any difference:
LIBPATH=/usr/local/zendphp7/lib
LIBPATH=$LIBPATH:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib
export LIBPATH
When echoing:
bash-4.4$ echo $LIBPATH
/usr/local/zendphp7/lib:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib
bash-4.4$
If I don't add the above to my ./.profile, then echo $LIBPATH prints a blank line to screen.
Solution:
I just changed the symlink in the ZENDPHP7 directory structure to the repo version. Alternatively you can manipulate your library path, but I couldn't figure out the proper way to do it on IBM i.
bash-4.4$ pwd
/usr/local/zendphp7/lib
bash-4.4$ ln -s /QOpenSys/pkgs/lib/libz.so.1 ./libz.so.1
bash-4.4$ ls -la /usr/local/zendphp7/lib/libz.so.1
lrwxrwxrwx 1 dl 0 56 Oct 11 14:21 /usr/local/zendphp7/lib/libz.so.1 -> /QOpenSys/pkgs/lib/libz.so.1
bash-4.4$
I'm guessing something is off with your path when you do the install. Is it maybe looking at the Zend PHP libraries rather than the expected ones in /usr/lib?
Notice that the errors shows a path of /usr/local/zendphp7/lib/ libz.so.1(shr_64.o) while your git dump instead shows /QOpenSys/pkgs/lib:/QOpenSys/usr/lib.

iron fuctions: fn build for iron/go can't load package github.com/x/y

I am trying to run basic commands given in https://github.com/iron-io/functions.
I created a fuc.go and funct.yaml file successfully but when I try to execute fn build, I get below error:
Running prebuild command: docker run --rm -v /home/evr:/go/src/github.com/x/y -w /go/src/github.com/x/y iron/go:dev go build -o func
can't load package: package github.com/x/y: C source files not allowed when not using cgo or SWIG: swap_sll.c
error running docker build: exit status 1
I got the cause for the above issue
Actually it was looking for data directory of iron function which I had specified a specific path instead of ${PWD} and was executing fn build in another working dirctory. So have to execute fn build in that directory where data directory is present (specific path which I specified).

How to Install Vim Plugins in a Windows Environment

I am just getting started with Vim and setting up the environment with some of the plugins recommended by http://vimawesome.com/. I downloaded and placed plug.vim in C:\Program Files\Vim\vim74\autoload
and in C:\Program Files\Vim\vimfiles\plugin I put the git master branch nerdtree-master and renamed it to nerdtree. In the _vimrc file, which is otherwise working, I put
Plug 'scroloose/nerdtree
and
Plug 'nerdtree
Neither of these commands worked. And I receive this error:
Error detected while processing C:\Program Files\Vim\_vimrc:
line 7:
E492: Not an editor command: Plug 'nerdtree'
Error detected while processing
C:\Program Files\Vim\vim74\plugin\nerdtree\lib\nerdtree\path.vim:
I finally figured out that I had forgot to wrap the line Plug 'nerdtree' with
call plug#begin('~/.vim/plugged')
Plug 'nerdtree'
call plug#end()
Although .vim is a Linux path, Vim or Vim-Plug was able to recognize the path. I then received an error that Git must be installed. I already had Git installed, so I simply added C:\Program Files\Git\bin to the system environment variable %PATH%. After restarting Vim I typed
:PlugInstall
in the Vim editor.
The vim-plug plugin manager got to work and printed:
- Finishing ... Done!
x nerdtree:
Cloning into 'C:\Users\labbedz7\.vim\plugged\nerdtree'...
remote: Invalid username or password.
fatal: Authentication failed for 'https://git::#github.com/vim-scripts/nerdtree.git/'
Now, Git did not "authenticate" because the string in Plug 'String' refers to the GitHub URL path: http://github.com/String. By changing to the actual path: scrooloose/nerdtree I was able to run :PlugInstall again.
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree'
call plug#end()
This resulted in:
Updated. Elapsed time: 5.706874 sec.
[=]
- Finishing ... Done!
- nerdtree: Checking connectivity... done
I then added these lines to _vimrc:
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
Nerdtree is now running! It starts in Windows\System32 and is a bit slow to load, but it is running.

Resources