Installing Jenkins Plugins to Docker Jenkins - linux

I have the following Dockerfile with jenkins as the base image:
FROM jenkins
USER root
ENV JENKINS_MIRROR http://mirrors.jenkins-ci.org
RUN for plugin in git-client git ws-cleanup ; do wget -O $JENKINS_HOME/plugins/${plugin}.hpi $JENKINS_MIRROR/plugins/${plugin}/latest/${plugin}.hpi ; done
EXPOSE 8080
I'm trying to install some additional plugins but it gives me an error saying no such file or directory
I then started and connected to the container of this build step in order to "debug" the error:
However, I could not find out the cause because every directory seems to exist. Furthermore, if I then run the for-loop manually in the bash, all plugins are installed correctly...
I further noticed, that the installation of the the plugins works, if I install them in the root directory as follows:
RUN for plugin in git-client git ws-cleanup ; do wget -O ${plugin}.hpi $JENKINS_MIRROR/plugins/${plugin}/latest/${plugin}.hpi ; done
However, this is the wrong place as they have to be placed in the directory $JENKINS_HOME/plugins
Why I am not able to install the plugins in $JENKINS_HOME/plugins?

I can't read your screenshots, but you don't seem to be following the official instructions. See https://github.com/cloudbees/jenkins-ci.org-docker under "Installing more tools". Note:
You should save the plugins to /usr/share/jenkins/ref/plugins
You could use a plugins.txt file instead, which contains the names of your plug-ins, and you can process with the provided plugins.sh script. This looks like:
COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/plugins.txt
I think the reason your approach wasn't working was to do with some processing in the start-up script.

install-plugins.sh is deprecated. I had to switch to jenkins-plugin-cli:
FROM jenkins/jenkins
...
RUN jenkins-plugin-cli \
--plugins \
git \
workflow-aggregator \
blueocean \
other-plugins
jenkins-plugin-cli also supports -f parameter, which gets the list of plugins as a file.
See Jenkins Official Documentation for details.

Related

How do I install Vim key bindings in Jupyter Notebook?

I have seen this answer. I went to the github page that the answer talks about and installed jupyter notebook extensions too. I execute this code on anaconda command shell like the github page asks me to:
# You may need the following to create the directoy
mkdir -p $(jupyter --data-dir)/nbextensions
# Now clone the repository
cd $(jupyter --data-dir)/nbextensions
git clone https://github.com/lambdalisue/jupyter-vim-binding vim_binding
chmod -R go-w vim_binding
However, the first line with mkdir throws an error:
The syntax of the command is incorrect.
Since I do not know how these commands work or what they do, can someone please help find a workaround?

Building WebLogic Docker Image in Ubuntu is not working

I have installed in virtual machine the Ubuntu 20.4 operating system. The docker version is 19.03.8.
I cloned the oracle repository with command below:
git clone https://github.com/oracle/docker-images.git
After that I downloaded the Oracle WebLogic Server 12.2.1.3 - Generic installer.
Than went to the WebLogic docker build directory and place the installer there with the commands below:
cd ./docker-images/OracleWebLogic/dockerfiles
mv ./path/to/fmw_12.2.1.3.0_wls_Disk1_1of1.zip ./12.2.1.3
In the end I run the build like below:
./buildDockerImage.sh -v 12.2.1.3 -g -s
In theory everything should be going right, but that is not the case.
I have the problem below:
pull access denied for oracle/serverjre, repository does not exist or may require 'docker login'
To fix the issue i did the following action:
I logged succefully https://container-registry.oracle.com/ and selected serverjre and accepted the license.
After that I made the following changes in the dockerFile:
#FROM oracle/serverjre:8
FROM container-registry.oracle.com/java/serverjre:8
Then I logged in the console like below
docker login container-registry.oracle.com
username:<SSO USERNAME>
password:<SSO PASSWORD>
In the end I run again the build like below, but still it throws the same error.
./buildDockerImage.sh -v 12.2.1.3 -g -s
Please help with some guidance. Thank you in advance.
P.S This is my first question, I am new here, please don't be hard on me.
From the command below:
./buildDockerImage.sh -v 12.2.1.3 -g -s
I see you are running the build with -g option which creates the images based on generic distribution.
Check this link for more information about the attributes in the link below:
https://github.com/oracle/docker-images/blob/master/OracleWebLogic/dockerfiles/12.2.1.3/README.md
This means you are using the DockerFile.generic. You need to do the modification in this file.
You need to do the following replacement:
#Line 30
#FROM oracle/serverjre:8 as builder
FROM container-registry.oracle.com/java/serverjre:8 as builder
# Line 69
#FROM oracle/serverjre:8
FROM container-registry.oracle.com/java/serverjre:8

(Node.js) --grpc_out: protoc-gen-grpc: %1 is not a valid Win32 application

I want to compile my .proto file into stubs, but when entering the command:
`protoc -I=. ./protos/dummy.proto
--js_out=import_style=commonjs,binary:./server --grpc_out=./server --plugin=protoc-gen-grpc=which grpc_tools_node_protoc_plugin
I got the following error :
--grpc_out: protoc-gen-grpc: %1 is not a valid Win32 application.
Thigs I have installed :
Windows 10
npm install -g grpc-tools
npm install google-protobuf
protoc
NOTE: I noticed there are a few similar questions already, but I didn't find one for Node.js, also the already asked questions all have different solutions.
On Windows, I messed around with the grpc-tools for Node a bit and came across some issues. I installed the tools (and the TS plugin) via npm install grpc-tools grpc_tools_node_protoc_ts --save-dev to my local node_modules/.bin folder. Thanks to this post, I can provide these solutions. This was my original shell script
#!/usr/bin/env bash
PROTO_DIR="./src/grpc/proto"
PROTOC_GEN_TS_PATH="./node_modules/.bin/protoc-gen-ts"
GRPC_TOOLS_NODE_PROTOC_PLUGIN="./node_modules/.bin/grpc_tools_node_protoc_plugin"
GRPC_TOOLS_NODE_PROTOC="./node_modules/.bin/grpc_tools_node_protoc"
# Generate JS and corresponding TS d.ts codes for each .proto file using the grpc-tools for Node.
$GRPC_TOOLS_NODE_PROTOC \
--plugin=protoc-gen-grpc="$GRPC_TOOLS_NODE_PROTOC_PLUGIN" \
--plugin=protoc-gen-ts="$PROTOC_GEN_TS_PATH" \
--js_out=import_style=commonjs,binary:"$PROTO_DIR" \
--ts_out="$PROTO_DIR" \
--grpc_out="$PROTO_DIR" \
-I "$PROTO_DIR" \
"$PROTO_DIR"/*.proto
If you just provide the plugin by its name, e.g. --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin, Windows will complain about an invalid Win32 application. You can solve this issue by adding the .cmd extension:
--plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin.cmd
Unfortunately, the following issue '.' Not an internal or external command, or a runnable program or batch file arises, which indicates that Windows cannot resolve the relative path to the plugin. Therefore, you have to provide the absolute path, e.g.
--plugin=protoc-gen-grpc=C:/.../<project-dir>/node_modules/.bin/grpc_tools_node_protoc_plugin.cmd
Now the real magic happens:
Because of a simple typo (I typed --plugin=proto-gen-grpc instead of --plugin=protoc-gen-grpc), I figured out that, if you have grpc-tools and additional plugins installed in your local Node environment, you can simply omit --plugin.
It seems that grpc_tools_node_protoc will automatically lookup the executables required to generate the code specified by the output flags --grpc_out, --js_out or --ts_out in ./node_modules/.bin/.
Therefore, I updated the following LOC in my script
$GRPC_TOOLS_NODE_PROTOC \
--js_out=import_style=commonjs,binary:"$PROTO_DIR" \
--ts_out="$PROTO_DIR" \
--grpc_out="$PROTO_DIR" \
-I "$PROTO_DIR" \
"$PROTO_DIR"/*.proto
Maybe, others could share their experience and more clarifications to this issue.
You can solve this issue by adding the .cmd extension:
--plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin.cmd
And the following issue '.' Not an internal or external command, or a runnable program or batch file, you can solve replacing the '.' by '%cd%':
--plugin=protoc-gen-grpc=%cd%/node_modules/.bin/grpc_tools_node_protoc_plugin.cmd
SIMPLE SOLUTION :
For me the "which" command was pointing to the wrong path so I removed it and replaced it with an absolute path to the plugin instead. It looks like this :
protoc -I=. ./protos/dummy.proto
--js_out=import_style=commonjs,binary:./server --grpc_out=./server --plugin=protoc-gen-grpc=C:\Users\myUser\AppData\Roaming\npm\node_modules\grpc-tools\bin\grpc_node_plugin.exe
Explanation :
I am not sure why this error (--grpc_out: protoc-gen-grpc: %1 is not a valid Win32 application) was happening, but I have an theory... The "which" command pointed to the folder and not to the .exe file. How do I know this? When I try to only run the command (in the terminal)
which grpc_tools_node_protoc_plugin
It returns the folder
/c/Users/myUser/AppData/Roaming/npm/grpc_tools_node_protoc_plugin
As grpc-tools has been installed globally (-g flag per OP), setting the plugin path beforehand works.
GRPC_TOOLS_PLUGIN="$HOME/AppData/Roaming/npm/grpc_tools_node_protoc_plugin.cmd" && \
protoc -I=. ./protos/*.proto \
--js_out=import_style=commonjs,binary:./server \
--grpc_out=./server \
--plugin=protoc-gen-grpc=$GRPC_TOOLS_PLUGIN
Thanks to both answers before me for pointers!
Tested and found to be working on Windows 10 Pro and Git Bash.
This piece of code worked for me.
protoc --js_out=import_style=commonjs,binary:./server ./proto/dummy.proto

OpenShift oc command line with Cygwin

I'm running Cygwin 64bit but can't seem to get OpenShift oc command line to work
I downloaded oc.tar.gz ( from here https://mirror.openshift.com/pub/openshift-v3/clients/3.6.173.0.5/linux/oc.tar.gz ), unzipped it and placed it in my path in /usr/bin
When I try to run: oc login I get the following.
-bash: /usr/bin/oc: cannot execute binary file: Exec format error
Do I need to somehow 'install' the executable ?
Any help would be much appreciated.
In addition to #Graham Dumpleton's answer:
open cygwin and check for directory /usr/local/bin
mkdir -p local/bin
$ cd /usr/local/bin
if it does not exists:
$ mkdir -p local/bin
finally extract the windows package:
$ cp /cygdrive/c/Users/me/Downloads/oc-3.5.5.31.24-windows.zip /usr/local/bin/
unzip oc-3.5.5.31.24-windows.zip
$ oc version
oc v3.5.5.31.24
kubernetes v1.5.2+43a9be4
features: Basic-Auth
Use the Windows binary from the following page:
https://github.com/openshift/origin/releases
From project homepage
https://www.cygwin.com/
Cygwin is not:
a way to run native Linux apps on Windows. You must rebuild your
application from source if you want it to run on Windows.
a way to magically make native Windows apps aware of UNIX®
functionality like signals, ptys, etc. Again, you need to build your
apps from source if you want to take advantage of Cygwin
functionality.

Composer & Cygwin

Composer doesn't run correctly in Cygwin if you try to install it "globally".
Putting composer.phar into /usr/local/bin/composer, then trying to run it will result in the error:
Could not open input file: /usr/local/bin/composer
Just tripped over the same problem and found a solution. Posting it here, just in case I'll ever have to look it up again.
Set up a bin directory right under /home/my-username:
cd ~
mkdir bin
Move the composer.phar (or any other of those nifty new PHP imps that are on the rise)
into the ~/bindirectory and make sure to set it's execution bit:
# Notice how I got rid of the superfluous `.phar` extension
mv /path/to/composer.phar ~/bin/composer
chmod +x ~/bin/composer
Tell cygwin to include your ~/bin directory in the search path:
Open up the file ~/.bash_profile and uncomment the following paragraph ...
# Set PATH so it includes user's private bin if it exists
if [ -d "${HOME}/bin" ] ; then
PATH="${HOME}/bin:${PATH}"
fi
Now, for the most important part:
A wrapper script that helps Win's native PHP resolve Unix style paths (which is causing
the problem after all as Windows doesn't know how to handle /cygdrive/... paths).
cd ~/bin
touch php
chmod +x php
After editing the wrapper script ~/bin/php should read:
#!/bin/bash
# e.g. php="/cygdrive/c/Program Files (x86)/php/php.exe"
php="/path/to/php.exe"
for ((n=1; n <= $#; n++)); do
if [ -e "${!n}" ]; then
# Converts Unix style paths to Windows equivalents
path="$(cygpath --mixed ${!n} | xargs)"
case 1 in
$(( n == 1 )) )
set -- "$path" "${#:$(($n+1))}";;
$(( n < $# )) )
set -- "${#:1:$((n-1))}" "$path" ${#:$((n+1)):$#};;
*)
set -- "${#:1:$(($#-1))}" "$path";;
esac
fi
done
"$php" "$#"
Now restart your shell and it should correctly invoke the PHP interpreter whenever it
stumbles upon a #!/usr/bin/env php shebang. Simply issue a:
composer --help
How about this one?
In ~/.bashrc, add: alias composer='php c:\\your\\path\\to\\composer.phar'
Restart cygwin or reload the bashrc by running source ~/.bashrc
Works for me using both Cygwin's native php.exe and XAMPP's Windows-specific one.
I think what might work is to build a proxy instead:
Put composer.phar in /usr/local/bin/composer.phar
Create a bash proxy as /usr/local/bin/composer with the following:
#!/bin/sh
c:/path/to/php c:/path/to/composer.phar $#
chmod +x /usr/local/bin/composer
Try this:
Install Cygwin PHP and use it to run composer in Cygwin.
You can choose one of two ways to work fine with PHP+Composer in Cygwin:
Install Cygwin PHP and install composer.phar in Cygwin.
Install Windows PHP and install Winodows Composer, then call then from Cygwin. (Windows XAMMP+Composer with alias in cmd)
Your problem is caused by that Cygwin Composer is ruining by Windows PHP on Cygwin, so it can not recognize the file path.
After install Cygwin PHP, the composer will integrates with Cygwin PHP then fit to Cygwin's filepath.
Cygwin PHP extensions for composer usage:
php
php-json
php-mbstring
php-phar
php-zip
php-posix
You can install other PHP extension when composer's package is needed such as php-xmlwriter, php-tokenizer, php-ctype.
Installation commands guide:
If you have already installed apt-cyg, there are installation command above:
apt-cyg install php php-json php-mbstring php-phar php-zip php-posix
apt-cyg install php-xmlwriter php-tokenizer php-ctype
Then install Composer via Cygwin PHP:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
chmod +x ./composer.phar
mv ./composer.phar /usr/bin/composer
composer -v
Conclusion
I recommend using Windows PHP + Windows Composer, and call then in Cygwin, it because the Cygwin PHP is not much stable than Windows PHP.
I had the same problem. After reading the final instruction from composer installer, it says that the $PATH variable should be reloaded. I rebooted my computer and then linked the Composer bin to /usr/local/bin.
First locate the composer bin :
/cygdrive/c/ProgramData/ComposerSetup/bin/composer
Then according to Seldaek answer, after trying a non-working symlink, I did :
nano /usr/local/bin/composer
#!/bin/sh
/cygdrive/c/ProgramData/ComposerSetup/bin/composer $#
chmod +x /usr/local/bin/composer
And it's working.
What I did (very simple):
Install Composer normally with the Windows installer
Open a Cygwin console an type composer you will see something like Could not open input file: /c/route/to/your/composer/installation/bin
Create an alias composer='composer.bat' on your bash profile or bashrc or whatever
Done
I'm running Windows 8.1
I was having this issue. Most of the responses were over my head but I fixed it with no problems.
Step 1) Reinstall Composer globally as per https://getcomposer.org/download/
Step 2) Leave it alone. All the special stuff you want to do, don't do that.
Step 3) Download the latest setup-xxx.exe from https://cygwin.com/
Step 4) Click it with your mouse.
NOTE: During step 5 you will feel a sudden urge to read instructions, browse the web for info and start checking little boxes on the menu. Don't do that.
Step 5) Click 'next' until it stops asking. It will look at your existing
settings, fix things up and add any missing dependencies.
This worked for me.
Getting composer to work globally inside Cygwin is a pain in the butt...
The solutions I have come up with:
Don't use it globally. If you are using the PHP CLI from a Windows installation, it won't recognize the Linux paths that Cygwin uses.
What I have done is put it in the base directory of all the projects I use composer with, and do ../composer.phar to run it.
It works fine this way, and it's almost globally available...
Download, and compile your own PHP binaries within Cygwin... Yea, kind of a overkill.
I solved the problem like this in a Cygwin/XAMPP setup:
Install composer.phar to XAMPP's php directory
Create an executable Bash script named composer in XAMPP's php directory:
#!/bin/bash
script_dir=$(cygpath -w $(dirname $0))
php "$script_dir/composer.phar" $#
It's important to use cygpath -w to convert the path to a path in Windows form.
Make sure XAMPP's php directory is accessible in Cygwin's $PATH:
$ export PATH=$PATH:/cygdrive/i/dev/server/xampp/php
Now it's possible to call composer from anywhere you like without problems:
$ composer -V
Composer version 264f433ca3f007d39568b3722b4bf418f58ba15b
I fixed it by adding a /usr/local/bin/composer file:
nano /usr/local/bin/composer
with the following content:
#!/bin/bash
/cygdrive/c/wamp/bin/php/php5.4.3/php "C:\wamp\bin\php\php5.4.3\composer"
Basically, you have to call PHP with a Windows style path, not a cygwin path.
The easiest way is to install composer using the Windows installer from their website and then copy the two files 'composer' and 'composer.phar' from "C:\ProgramData\Composer" into a directory which is in the PATH variable. E.g. you could copy the files into the /bin/ directory of cygwin. Afterwards you can again uninstall the "Windows version" of composer.
Update! This is what I did:
Install PHP and needed modules from the Cygwin Ports project
Download the latest composer snapshot
Rename 'composer.phar' to 'composer' and save it to /usr/local/bin
Open /bin/dash.exe and run '/usr/bin/rebaseall'
Also if 4. gives you an error, composer should run now
I suggest you use babun, it is based cygwin, but you can install package by pact, you can do this:
pact install php php-json php-phar
php -r "readfile('https://getcomposer.org/installer');" | php
then enjoy yourself.
I was having trouble getting Composer to work in Cygwin and none of the solutions above were resolving my problem. Eventually I stumbled across this comment in the Composer github bugs discussion:
Yeah TBH using php from cygwin isn't a great idea, cygwin is just too different an environment. Too many hacks that create failures.. In any case closing here as there isn't much we can do I'm afraid :)
I don't know precisely where composer/Cygwin/php was tripping up, but, broadly, my problem was that I had two conflicting installations of PHP in environmental variables, one from an installation of WAMP, and another installed with Cygwin. The Cygwin PHP installation seemed to be struggling with some sort of path issue. I removed it, using only the WAMP PHP, and composer ran in Cygwin just fine.

Resources