On https://gitlab.com
I created a private group called test-kirby-group.
I created a private project in that group called test-project-1
I created another private project in that group called test-sub-project
I instantiated both new projects with a default readme.
In test-kirby-group/test-project-1 , i added a .gitmodules file
[submodule "vendor/submodules/test-sub-project"]
path = submodules/test-sub-project
url = ../../test-group-kirby/test-sub-project.git
In test-kirby-group/test-project-1 , i added a .gitlab-ci.yml file
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- apk update && apk add git
- git submodule sync --recursive
- git submodule update --init --recursive
test:
script:
- pwd
- ls -al
- ls -al ../
- ls -al ../../
... I then checked the job output ...
Running with gitlab-runner 12.3.0 (a8a019e0)
on docker-auto-scale ed2dce3a
Using Docker executor with image ruby:2.5 ...
Pulling docker image ruby:2.5 ...
Using docker image sha256:e216e233b2581d7f45d2bc2c4dce4f1f293267b29c45bfd929d038a9a67b4058 for ruby:2.5 ...
Running on runner-ed2dce3a-project-15133453-concurrent-0 via runner-ed2dce3a-srm-1572642947-b5456b44...
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/test-group-kirby/test-project-1/.git/
Created fresh repository.
From https://gitlab.com/test-group-kirby/test-project-1
* [new ref] refs/pipelines/93160262 -> refs/pipelines/93160262
* [new branch] master -> origin/master
Checking out b624748a as master...
Updating/initializing submodules recursively...
$ apk update && apk add git
/bin/bash: line 89: apk: command not found
$ git submodule sync --recursive
$ git submodule update --init --recursive
$ pwd
/builds/test-group-kirby/test-project-1
$ ls -al
total 48
drwxrwxrwx. 3 root root 4096 Nov 1 21:17 .
drwxrwxrwx. 4 root root 4096 Nov 1 21:17 ..
drwxrwxrwx. 6 root root 4096 Nov 1 21:17 .git
-rw-rw-rw-. 1 root root 274 Nov 1 21:17 .gitlab-ci.yml
-rw-rw-rw-. 1 root root 141 Nov 1 21:17 .gitmodules
-rw-rw-rw-. 1 root root 18 Nov 1 21:17 README.md
$ ls -al ../
total 32
drwxrwxrwx. 4 root root 4096 Nov 1 21:17 .
drwxrwxrwx. 3 root root 4096 Nov 1 21:17 ..
drwxrwxrwx. 3 root root 4096 Nov 1 21:17 test-project-1
drwxrwxrwx. 3 root root 4096 Nov 1 21:17 test-project-1.tmp
$ ls -al ../../
total 24
drwxrwxrwx. 3 root root 4096 Nov 1 21:17 .
drwxr-xr-x. 1 root root 4096 Nov 1 21:17 ..
drwxrwxrwx. 4 root root 4096 Nov 1 21:17 test-group-kirby
Job succeeded
Question:
1. Should I expect to see a directory called vendor?
2. If so, why didn't it clone?
It seems that you may have not added the git submodule correctly.
In test-kirby-group/test-project-1 do the following:
Remove the current .gitmodules which was created manually
Run git submodule add <git#gitlab ...> <path/to/submodule>
You might need to now edit the generated .gitmodules from the above command to use a relative URL (i.e. what you already have url = ../../test-group-kirby/test-sub-project.git), for it to work with GitLab CI
You shouldn't need your current before_script, as long as you are using gitlab-runner v1.10+, you only need the following in your CI script:
variables:
GIT_SUBMODULE_STRATEGY: recursive
See Using Git submodules with GitLab CI for more information.
Related
I am using jenkins in a docker container and would like to start another instance, whenever I try to use docker command like
docker run -t -i ap/dashboard /bin/bash
I get this error:
bash: line 61: docker: command not found
How do I navigate to another container or solve this error?
I can clearly see that the vm creator was able to use the docker command by reading the /root/.ash_history
here are some details about the system:
[-] Specific release information:
3.3.1
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.3.1
PRETTY_NAME="Alpine Linux v3.3"
HOME_URL="http://alpinelinux.org"
BUG_REPORT_URL="http://bugs.alpinelinux.org"
Hostname:
b51cdbb7eebd
ENVIRONMENTAL #######################################
Environment information:
JENKINS_VOL=/var/lib/jenkins
JAVA_VERSION_BUILD=17
HOSTNAME=b51cdbb7eebd
JAVA_VERSION_MAJOR=8
JENKINS_HOME=/opt/jenkins
NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/java/jre/bin
JAVA_BASE=/usr/local/java
PWD=/
JAVA_HOME=/usr/local/java/jre
JAVA_PKG=server-jre
LANG=C.UTF-8
XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt
SHLVL=2
HOME=/root
PKG_URL=https://circle-artifacts.com/gh/andyshinn/alpine-pkg-glibc/6/artifacts/0/home/ubuntu/alpine-pkg-glibc/packages/x86_64
JENKINS_VERSION=1.637
JAVA_VERSION_MINOR=66
_=/usr/bin/env
[-] Available shells:
# valid login shells
/bin/sh
/bin/ash
/bin/bash
[+] We can read root's home directory!
total 76
drwx------ 5 root root 4.0K Aug 28 2018 .
drwxr-xr-x 1 root root 4.0K Nov 24 10:55 ..
-rw------- 1 root root 3.1K Aug 29 2018 .ash_history
-rw------- 1 root root 155 May 16 2016 .bash_history
drwxr-xr-x 2 root root 4.0K May 12 2016 .oracle_jre_usage
drwx------ 2 root root 4.0K Aug 28 2018 .ssh
-rwxr-xr-x 1 root root 46.0K Aug 28 2018 LinEnum.sh
drwxr-xr-x 3 root root 4.0K May 12 2016 dockerfiles
-rw-r--r-- 1 root root 0 Aug 28 2018 foo
Looks like we're in a Docker container:
10:net_prio:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
9:net_cls:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
8:freezer:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
7:devices:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
6:memory:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
5:blkio:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
4:cpuacct:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
3:cpu:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
2:cpuset:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
1:name=openrc:/docker
-rwxr-xr-x 1 root root 0 May 16 2016 /.dockerenv
[-] Anything juicy in the Dockerfile:
-rw-r--r-- 1 root root 617 May 12 2016 /root/dockerfiles/jenkins/Dockerfile
I tried many docker commands without hope
is it because that I'm already inside the container??
Try with docker run -t -i ap/dashboard /bin/ash.
Maybe your container does not use bash so you should try with /bin/sh which is a symcolic link to the default installed shell processor.
I try to set up FastRTPS inside a docker container. I wrote a Dockerfile which builds FastRTPS and it's dependencies from source and installs the libraries and delivered examples. But the examples do not work:
/opt# /usr/local/examples/C++/HelloWorldExample/bin/HelloWorldExample
/usr/local/examples/C++/HelloWorldExample/bin/HelloWorldExample: error while loading shared libraries: libfastrtps.so.1: cannot open shared object file: No such file or directory
As these library was built in this container and automatically installed, it must be somewhere and they are here:
root#6e544f0699cf:/opt# ls -la /usr/local/lib/
total 9196
drwxr-xr-x 1 root root 4096 Mar 26 22:02 .
drwxr-xr-x 1 root root 4096 Mar 26 22:02 ..
drwxr-xr-x 3 root root 4096 Mar 26 22:00 cmake
drwxr-xr-x 3 root root 4096 Mar 26 22:00 foonathan_memory
lrwxrwxrwx 1 root root 15 Mar 26 22:00 libfastcdr.so -> libfastcdr.so.1
lrwxrwxrwx 1 root root 20 Mar 26 22:00 libfastcdr.so.1 -> libfastcdr.so.1.0.12
-rw-r--r-- 1 root root 99504 Mar 26 22:00 libfastcdr.so.1.0.12
lrwxrwxrwx 1 root root 16 Mar 26 22:02 libfastrtps.so -> libfastrtps.so.1
lrwxrwxrwx 1 root root 21 Mar 26 22:02 libfastrtps.so.1 -> libfastrtps.so.1.10.0
-rw-r--r-- 1 root root 8133952 Mar 26 22:01 libfastrtps.so.1.10.0
-rw-r--r-- 1 root root 1158048 Mar 26 22:00 libfoonathan_memory-0.6.2.a
drwxrwsr-x 3 root staff 4096 Mar 26 21:37 python3.7
It is also possible to look into this library # nm -D /usr/local/lib/libfastrtps.so.1.
But the output of ldconfig is a bit strange:
# ldconfig -v | grep /usr/local/lib
ldconfig: Can't stat /usr/local/lib/x86_64-linux-gnu: No such file or directory
ldconfig: Path `/lib/x86_64-linux-gnu' given more than once
ldconfig: Path `/usr/lib/x86_64-linux-gnu' given more than once
ldconfig: /lib/x86_64-linux-gnu/ld-2.28.so is the dynamic linker, ignoring
/usr/local/lib:
Here I expected the libraries listed but they are not.
How to fix that?
EDIT 1
some extractions from the make output while building FastRTPS:
...
-- Installing: /usr/local/lib/libfastrtps.so.1.10.0
-- Installing: /usr/local/lib/libfastrtps.so.1
-- Installing: /usr/local/lib/libfastrtps.so
...
-- Installing: /usr/local/examples/C++/HelloWorldExample/bin/HelloWorldExample
-- Set runtime path of "/usr/local/examples/C++/HelloWorldExample/bin/HelloWorldExample" to ""
Why the runtime path is set to "" - nothing?
The last edit led to the issue and also to the solution.
CMake removes the RPATH. In case of the usage within a docker container, this stripping makes no sense and can be turned off as described in this post by adding this argument to the CMake configuration call:
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE
At the end my Dockerfile looks like this:
FROM fastrtps-core
WORKDIR /opt
RUN git clone https://github.com/eProsima/Fast-RTPS.git && \
export LDFLAGS="-Wl,--copy-dt-needed-entries" && \
mkdir build && \
cd build && \
cmake ../Fast-RTPS/examples \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE && \
cmake --build . --target install -j 16 && \
cd /opt && \
rm -rf build Fast-RTPS
Now the install-step output shows the correct runtime-path setting:
-- Installing: /usr/local/examples/C++/HelloWorldExample/HelloWorldExample
-- Set runtime path of "/usr/local/examples/C++/HelloWorldExample/HelloWorldExample" to "/usr/local/lib"
My use-case is versioning application changes on server because sometimes I need to rollback previous version before update, or before configuration changes.
This is my list of content:
dasper#debian:/usr/share/otrs$
drwxr-xr-x 6 root root 4096 Sep 18 16:56 .
drwxr-xr-x 109 root root 4096 Sep 18 13:13 ..
lrwxrwxrwx 1 root root 21 May 9 11:06 ARCHIVE -> /var/lib/otrs/ARCHIVE
drwxr-xr-x 4 root root 4096 Sep 11 15:53 bin
-rwx------ 1 root root 212450 Sep 18 16:06 .etckeeper
-rw-r--r-- 1 root root 1125 Jan 11 2019 .fetchmailrc.dist
drwx------ 8 root root 4096 Sep 18 16:06 .git
-rw-r--r-- 1 root root 932 Sep 18 15:40 .gitignore
drwxr-xr-x 9 root root 4096 Sep 11 15:53 Kernel
-rw-r--r-- 1 root root 104 Jan 12 2019 RELEASE
drwxr-xr-x 7 root root 4096 Sep 11 15:53 scripts
-rw-r--r-- 1 root root 0 Sep 18 15:36 testfile.txt
lrwxrwxrwx 1 root root 13 May 9 11:06 var -> /var/lib/otrs
I was trying etckeeper to auto commit after package manager make some changes, but git will as defaulte create only empty folder var/ and ARCHIVE/.
I was trying submodules, but then i don't know about changes in symlink folders (git add .) and submodule content can't lead to symlink folder.
My biggest issue is how to store these folders in git and how to clone/checkout in same structure.
Solution was easy & clean, i hope :)
apt-get install etckeeper
Make directory for repository. This is mounted to other disk
mkdir /BACKUP
cd /BACKUP
Initialize git repo & set worktree to root /. Now i can tracking whole system changes, not only /etc
git init
git config --path core.worktree /
My .gitignore inside /BACKUP:
# Ignore everything ~ whitelist
*
# But descend into directories
!*/
# Add /usr/share/otrs/ - main directory
!/usr/share/otrs/**
# Add /var/lib/otrs - symlink # Add /usr/share/otrs/var -> /var/lib/otrs
!/var/lib/otrs/**
...
# Add myself
!/.gitignore
# Add etckeeper staff
!/etc/.etckeeper/**
Add new line at the end of /etc/etckeeper/etckeeper.conf with path to repository:
ETCKEEPER_DIR=/BACKUP
At the end, remove unused repo initialized by etckeeper after installation:
cd /etc
rm -rf .git
rm .gitignore
Now you can make first inital commit: etckeeper commit
I have a docker container running Ubuntu Server. I am running Docker for Windows and I have the following version of Docker and Docker Compose respectively installed:
> docker-compose -v
docker-compose version 1.11.2, build f963d76f
> docker -v
Docker version 17.03.1-ce-rc1, build 3476dbf
This is what I have tried so far without success:
// The dojo linked file exists so I've tried to update it as per this answer (http://stackoverflow.com/a/1951752/719427)
> docker exec -it dockeramp_webserver_1 ln -sf /var/www/html/externals/dojo /var/www/html/externals/public_html/js/dojo
ln: failed to create symbolic link '/var/www/html/externals/public_html/js/dojo': No such file or directory
// I have deleted the previous linked file and then I tried to create a new one
> docker exec -it dockeramp_webserver_1 ln -s /var/www/html/externals/dojo /var/www/html/externals/public_html/js/dojo
ln: failed to create symbolic link '/var/www/html/externals/public_html/js/dojo': No such file or directory
// removed the directory name from the link name
> docker exec -it dockeramp_webserver_1 ln -s /var/www/html/externals/dojo /var/www/html/externals/public_html/js
ln: failed to create symbolic link '/var/www/html/externals/public_html/js': No such file or directory
Because the error keep saying the directory doesn't exists then I've checked if the error is right or wrong:
> docker exec -u www-data -it dockeramp_webserver_1 ls -la /var/www/html/externals/dojo
total 80
drwxr-xr-x 2 root root 0 Mar 25 15:09 .
drwxr-xr-x 2 root root 4096 Mar 25 15:09 ..
drwxr-xr-x 2 root root 0 Mar 25 15:09 dijit
drwxr-xr-x 2 root root 0 Mar 25 15:09 dojo
drwxr-xr-x 2 root root 0 Mar 25 15:09 dojox
drwxr-xr-x 2 root root 0 Mar 25 15:09 mmi
-rwxr-xr-x 1 root root 74047 Mar 25 15:09 tundra.css
> docker exec -u www-data -it dockeramp_webserver_1 ls -la /var/www/html/public_html/js
total 24
drwxr-xr-x 2 root root 4096 Mar 26 14:40 .
drwxr-xr-x 2 root root 4096 Mar 25 15:11 ..
-rwxr-xr-x 1 root root 7123 Mar 25 15:09 jquery.PrintArea.js
-rwxr-xr-x 1 root root 6141 Mar 25 15:11 quoteit_delegate_search.js
They both exists so ... what I am missing here? It's not supported in Windows just yet? I have found the development team added something called mfsymlinks in a previous version than mine.
The command is telling you that /var/www/html/externals/public_html does not exist. You only showed that the /var/www/html/externals/dojo and /var/www/html/public_html/js folders exist. I believe this is a simple typo in your commands.
First, the setup. I'm running a haneWin nfs server on a Windows Server 2012, mounting it at startup in a ubuntu server with this fstab entry ~ip~:/sharenfs /srv/share nfs rw 0 0
The umask is set on the windows server to 000, which indeed results in every user on ubuntu having rw access to the entire share.
Now here's the problem: I want to use the nfs share to store all our git repos so that the windows server can back them up together with all its data. In an earlier setup the ubuntu host provided a nfs share which worked perfect, but for storage reasons the windows server should host the share.
The git repos are supposed to be created automatically by redmine, which worked fine prior to the nfs change, but now it just fails silently. The logs dont provide any useful information.
But here's something that does provide information, if I create a new directory on the nfs share, run git init, the following comes out:
error: could not lock config file /srv/share/git/metatest/test1/.git/config: File exists
... (this line shows a total of 6 times)
error: could not lock config file /srv/share/git/metatest/test1/.git/config: File exists
Reinitialized existing shared Git repository in /srv/share/git/metatest/test1/.git/
The dir was completely empty! In fact running rm -rf .git; git init has the same output.
A ls -lAhR shows this
./.git:
total 22K
drwxrwxrwx 2 git git 4.0K Jun 5 17:07 branches/
-rw-rw-rw- 1 git git 53 Jun 5 17:07 config
-rw-rw-rw- 1 git git 21 Jun 5 17:07 config.lock
-rw-rw-rw- 1 git git 73 Jun 5 17:07 description
-rw-rw-rw- 1 git git 23 Jun 5 17:07 HEAD
drwxrwxrwx 2 git git 4.0K Jun 5 17:07 hooks/
drwxrwxrwx 2 git git 4.0K Jun 5 17:07 info/
drwxrwxrwx 4 git git 4.0K Jun 5 17:07 objects/
drwxrwxrwx 4 git git 4.0K Jun 5 17:07 refs/
./.git/branches:
total 0
./.git/hooks:
total 17K
-rwxrwxrwx 1 git git 452 Jun 5 17:07 applypatch-msg.sample*
-rwxrwxrwx 1 git git 896 Jun 5 17:07 commit-msg.sample*
-rwxrwxrwx 1 git git 189 Jun 5 17:07 post-update.sample*
-rwxrwxrwx 1 git git 398 Jun 5 17:07 pre-applypatch.sample*
-rwxrwxrwx 1 git git 1.7K Jun 5 17:07 pre-commit.sample*
-rwxrwxrwx 1 git git 1.3K Jun 5 17:07 prepare-commit-msg.sample*
-rwxrwxrwx 1 git git 1.4K Jun 5 17:07 pre-push.sample*
-rwxrwxrwx 1 git git 4.8K Jun 5 17:07 pre-rebase.sample*
-rwxrwxrwx 1 git git 3.6K Jun 5 17:07 update.sample*
./.git/info:
total 512
-rw-rw-rw- 1 git git 240 Jun 5 17:07 exclude
./.git/objects:
total 8.0K
drwxrwxrwx 2 git git 4.0K Jun 5 17:07 info/
drwxrwxrwx 2 git git 4.0K Jun 5 17:07 pack/
./.git/objects/info:
total 0
./.git/objects/pack:
total 0
./.git/refs:
total 8.0K
drwxrwxrwx 2 git git 4.0K Jun 5 17:07 heads/
drwxrwxrwx 2 git git 4.0K Jun 5 17:07 tags/
./.git/refs/heads:
total 0
./.git/refs/tags:
total 0
Interestingly though when redmine tries to create a repository the directory isnt even created. Again, it fails silently, no useful output.
When I try to run git add or from a remote pc push any changes from existing repos that where created when redmine did work, I get
fatal: error when closing sha1 file: Permission denied
This all makes absolutely no sense to me. Any ideas?
The question might not be entirely right about the cause of the problem. It turned out, that the gitolite installation had been broken by porting it over to a SMB mount, and then after moving it to an NFS mount the problem persisted.
I can't tell for sure if that's what happened, but right now it's working on an NFS share and this is my most probable explanation.
Another explanation would be that hanewin nfs was the problem, since right now running the Windows Server 2012 NFS Server it's working.