Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runner docker volumes #861

Merged
merged 24 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ RUN curl --location https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
&& apt-get clean \
&& rm --recursive --force /var/lib/apt/lists/*

# INSTALL DOCKER
RUN curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh && \
&& apt-get clean \
&& rm --recursive --force /var/lib/apt/lists/*

0x2b3bfa0 marked this conversation as resolved.
Show resolved Hide resolved
# INSTALL PYTHON
ARG PYTHON_VERSION=3
RUN add-apt-repository universe --yes \
Expand Down
10 changes: 8 additions & 2 deletions src/drivers/gitlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const ProxyAgent = require('proxy-agent');

const { fetchUploadData, download, exec } = require('../utils');

const { IN_DOCKER, CI_PIPELINE_ID } = process.env;
const { IN_DOCKER, CI_PIPELINE_ID, CML_GL_DOCKER_VOLUMES } = process.env;
DavidGOrtega marked this conversation as resolved.
Show resolved Hide resolved
const API_VER = 'v4';
class Gitlab {
constructor(opts = {}) {
Expand Down Expand Up @@ -186,6 +186,11 @@ class Gitlab {

const { protocol, host } = new URL(this.repo);
const { token } = await this.registerRunner({ tags: labels, name });

let dockerVolumesTpl = '';
CML_GL_DOCKER_VOLUMES.split(',').forEach((vol) => {
dockerVolumesTpl += `--docker-volumes ${vol} `;
});
const command = `${bin} --log-format="json" run-single \
--builds-dir "${workdir}" \
--cache-dir "${workdir}" \
Expand All @@ -195,7 +200,8 @@ class Gitlab {
--wait-timeout ${idleTimeout} \
--executor "${IN_DOCKER ? 'shell' : 'docker'}" \
--docker-image "iterativeai/cml:${gpu ? 'latest-gpu' : 'latest'}" \
--docker-runtime "${gpu ? 'nvidia' : ''}" \
${gpu ? '--docker-runtime nvidia' : ''} \
casperdcl marked this conversation as resolved.
Show resolved Hide resolved
${dockerVolumesTpl} \
${single ? '--max-builds 1' : ''}`;

return spawn(command, { shell: true });
Expand Down