Gitlab

Prerequisites

  • Have a Kyso account - either on kyso.io or on your company's private Kyso installation.
  • Create a Kyso access token - follow these instructions.
  • Ensure your directory (or folders) contains a valid kyso.yaml file. Check the following instructions for more info.

How to integrate Kyso and Gitlab Actions

  1. 1.
    Create a .gitlab-ci.yml file in your Gitlab repository.
  2. 2.
    Copy the following YAML contents into .gitlab-ci.yml:
1
image: node:16.14.0
2
3
upload_to_kyso:
4
script:
5
- npm install -g kyso
6
- kyso --version
7
- kyso login --kysoInstallUrl https://kyso.io --provider kyso --username [email protected] --token 44b09650-1e39-4b35-955b-c534ff687626
8
- kyso push
Copied!

Example in Action

Below is an example Gitlab repository that demos how you can commit your work to Kyso using Gitlab's CI/CD pipelines, with instructions on how to set up your first Kyso action.
Kyle O Shea / airtable-sales · GitLab
GitLab
This repository contains a single jupyter notebook report. Demo specifications:
  • User: Kyle O'Shea
  • Organization to publish to: kyle-o-shea
  • Team with the organization: general
Based on this information, our kyso.yaml should be as follows. Pay special attention to the organization, team and type properties.
1
main: index.html
2
title: "Graphing Data From Airtable"
3
description: "This guide will walk you through how to connect to an Airtable base from a Jupyter notebook, pull in your data and plot it, all with python."
4
organization: kyle-o-shea
5
team: general
6
type: jupyter
Copied!
We, as Kyle O'Shea, and following these instructions, have generated an access token and logged into Kyso.
That token is currently revoked for security reasons ;)
Because we have the following .gitlab-ci.yml file in the repository, on push, this report will be published to Kyso:
1
image: node:16.14.0
2
3
upload_to_kyso:
4
script:
5
- npm install -g kyso
6
- kyso --version
7
- kyso login --kysoInstallUrl https://kyso.io --provider kyso --username [email protected] --token 44b09650-1e39-4b35-955b-c534ff687626
8
- kyso push
Copied!
On Gitlab, a Docker image is created to run our job. We can check out the pipeline logs at https://gitlab.com/kyle201/airtable-sales/-/jobs/2612978268 and should see something like this:
1
Running with gitlab-runner 15.1.0~beta.20.g62206bb2 (62206bb2)
2
on green-2.shared.runners-manager.gitlab.com/default ns46NMmJ
3
Resolving secrets
4
00:00
5
Preparing the "docker+machine" executor
6
Using Docker executor with image node:16.14.0 ...
7
Pulling docker image node:16.14.0 ...
8
Using docker image sha256:b426ce8b7669391d2b17144e06723bca91cd71420a11a0102e62dc9db43775b6 for node:16.14.0 with digest [email protected]:61b6cc81ecc3f94f614dca6bfdc5262d15a6618f7aabfbfc6f9f05c935ee753c ...
9
Preparing environment
10
00:03
11
Running on runner-ns46nmmj-project-36085766-concurrent-0 via runner-ns46nmmj-shared-1655731537-6d7b5c8c...
12
Getting source from Git repository
13
00:01
14
$ eval "$CI_PRE_CLONE_SCRIPT"
15
Fetching changes with git depth set to 20...
16
Initialized empty Git repository in /builds/kyle201/airtable-sales/.git/
17
Created fresh repository.
18
Checking out db8b4165 as master...
19
Skipping Git submodules setup
20
Executing "step_script" stage of the job script
21
00:28
22
Using docker image sha256:b426ce8b7669391d2b17144e06723bca91cd71420a11a0102e62dc9db43775b6 for node:16.14.0 with digest [email protected]:61b6cc81ecc3f94f614dca6bfdc5262d15a6618f7aabfbfc6f9f05c935ee753c ...
23
$ npm install -g kyso
24
added 234 packages, and audited 235 packages in 19s
25
33 packages are looking for funding
26
run `npm fund` for details
27
found 0 vulnerabilities
28
$ kyso --version
29
kyso/1.4.1 linux-x64 node-v16.14.0
30
$ kyso login --kysoInstallUrl https://kyso.io --provider kyso --username [email protected] --token a738c892-56aa-4200-bdc4-3ac4cf4e301d
31
Logged successfully
32
$ kyso push
33
Uploading report '.'
34
Founded 9 files:
35
Processing .DS_Store
36
Processing .gitignore
37
Processing .gitlab-ci.yml
38
Processing Readme.md
39
Processing environment.yml
40
Processing images
41
Processing images/preview.png
42
Processing kyso.yaml
43
Processing main.ipynb
44
Uploading files. Wait a moment..
45
🎉🎉🎉 Report was uploaded to
46
https://kyso.io/kyle-o-shea/general/graphing-data-from-airtable
47
🎉🎉🎉
48
Cleaning up project directory and file based variables
49
00:00
50
Job succeeded
Copied!
As the report is public, you can see the result here.
Last modified 13d ago