List of commits:
Subject Hash Author Date (UTC)
Tutorials updates (artifacts and CI) 36ee6f7b792f32a8567c3f2f31088559ab6cd27a Catalin(ux) M. BOIE 2020-08-05 06:16:33
Added Markdown test 23455db9b6ce8a82245f06de6e3d7c7e6b706464 Catalin(ux) M. BOIE 2020-07-31 05:41:46
Some SELinux cosmetic 3bafeaa06231a67dcc66d37b50a6f5411b2bfbf9 Catalin(ux) M. BOIE 2020-07-31 05:41:28
Mostly cosmetic plus some tests 1a538fff7a4886395612471211eeca0c091e6864 Catalin(ux) M. BOIE 2020-07-31 05:41:02
Added a custom Markdown parser 67b9687fb858ba1018d58edd276836a0411acd1e Catalin(ux) M. BOIE 2020-07-31 05:39:49
Add an index variable to rg_template_table f310f34a6c9a2a029d479d14d86e8ea2393ee3dd Catalin(ux) M. BOIE 2020-07-31 05:39:29
Mostly cosmetic in Source page cac471307a58104fbfa7838b34a7e2ffd2e05260 Catalin(ux) M. BOIE 2020-07-31 05:38:48
Do not log bots connections ef9cdff6a0cbd559f1833e46a66cbbbe726d3d99 Catalin(ux) M. BOIE 2020-07-31 05:38:13
Comparison update b67344452d66b2ed8ef53f65470d53f8b40fe59e Catalin(ux) M. BOIE 2020-07-31 05:37:38
Minor fix for a variable type mismatch a0680065333729b91558e77a6df4403ce8f5b1a5 Catalin(ux) M. BOIE 2020-07-31 05:37:20
Minor git fixes a21b35cd0f87b844fe5ce4b8b2e14fab2506296e Catalin(ux) M. BOIE 2020-07-31 05:36:43
Docker updates d3e9cd4e358cac2d4018dcf7dc681288445a679f Catalin(ux) M. BOIE 2020-07-31 05:36:08
Admin report improvements b527baab12e2e08998672559b0f33fc6df15e74c Catalin(ux) M. BOIE 2020-07-31 05:35:25
Cosmetic 30c879d625b094a33bd9a2165c67a8a11e802f42 Catalin(ux) M. BOIE 2020-07-31 05:34:19
Builder, worker and web updates for artifacts c82a7143a24ec987e0d98bb58327ef15bc602d0d Catalin(ux) M. BOIE 2020-07-31 05:30:44
Prevent bots to create accounts 3eacd8103e9a039f3f8585a59c27fdff6fd66ca4 Catalin(ux) M. BOIE 2020-07-08 05:25:37
css: Force the footer to the bottom using flex f89dddc9fa6b2c131448996cc51349e00224eea6 Catalin(ux) M. BOIE 2020-07-04 04:15:03
docs: css tweaks d270a286b160bb5de39ade5d99a58fe26e03b2d5 Catalin(ux) M. BOIE 2020-06-30 17:21:02
Improved admin report 9fa82cc2878886c2195cdd3f334dd532b3ea6a22 Catalin(ux) M. BOIE 2020-06-28 10:19:24
First version of artifacts ad6b6c75aab8d485ea45c1d851f23d83587d6931 Catalin(ux) M. BOIE 2020-06-27 13:11:17
Commit 36ee6f7b792f32a8567c3f2f31088559ab6cd27a - Tutorials updates (artifacts and CI)
Author: Catalin(ux) M. BOIE
Author date (UTC): 2020-08-05 06:16
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2020-08-05 06:16
Parent(s): 23455db9b6ce8a82245f06de6e3d7c7e6b706464
Signer:
Signing key:
Signing status: N
Tree: 0e018a521f182f46ef22f0aca43808085419ea5d
File Lines added Lines deleted
inc/demo.inc.php 7 2
root/themes/default/doc/demo/demos/TODO/1.html 10 7
root/themes/default/doc/demo/demos/artifacts/0/main.html 4 4
root/themes/default/doc/demo/demos/artifacts/blendergraph/main.html 62 0
root/themes/default/doc/demo/demos/artifacts/blendergraph/name.html 1 0
root/themes/default/doc/demo/demos/artifacts/define/main.html 48 19
root/themes/default/doc/demo/demos/artifacts/python1/name.html 0 1
root/themes/default/doc/demo/demos/artifacts/see/main.html 2 4
root/themes/default/doc/demo/demos/ci-1/0/main.html 1 1
root/themes/default/doc/demo/demos/ci-1/about/main.html 5 6
root/themes/default/doc/demo/demos/ci-1/add_hook/main.html 9 9
root/themes/default/doc/demo/demos/ci-1/python1/main.html 52 31
root/themes/default/doc/demo/demos/ci-1/python1/name.html 1 0
root/themes/default/doc/demo/demos/ci-1/trigger/main.html 8 8
root/themes/default/doc/demo/list.html 19 17
File inc/demo.inc.php changed (mode: 100644) (index be8375d..f86d76e)
... ... $rg_demos = array(
146 146 array( array(
147 147 'page' => 'trigger', 'page' => 'trigger',
148 148 'prev' => 'add_hook', 'prev' => 'add_hook',
149 'next' => 'python1'
150 ),
151 array(
152 'page' => 'python1',
153 'prev' => 'trigger',
149 154 'next' => '' 'next' => ''
150 155 ) )
151 156 ), ),
 
... ... $rg_demos = array(
175 180 array( array(
176 181 'page' => 'see', 'page' => 'see',
177 182 'prev' => 'define', 'prev' => 'define',
178 'next' => 'python1'
183 'next' => 'blendergraph'
179 184 ), ),
180 185 array( array(
181 'page' => 'python1',
186 'page' => 'blendergraph',
182 187 'prev' => 'see', 'prev' => 'see',
183 188 'next' => '' 'next' => ''
184 189 ) )
File root/themes/default/doc/demo/demos/TODO/1.html copied from file root/themes/default/doc/demo/demos/artifacts/python1/main.html (similarity 89%) (mode: 100644) (index 9b7ad47..3c16e96)
1 TODO: this text will be used when we will produce rpm and deb repositories.
2
1 3 <div class="demo_page_title">@@demo::page_name@@</div> <div class="demo_page_title">@@demo::page_name@@</div>
2 4
3 5 In this tutorial we will create a Python package and we will In this tutorial we will create a Python package and we will
4 upload the .rpm and the .tgz files to the artifacts web area.<br />
6 upload the .rpm and the .tgz files to PyPI repository.<br />
7 <br />
5 8
6 9 The steps were copied from The steps were copied from
7 10 <a href="https://packaging.python.org/tutorials/packaging-projects/" target="_blank">https://packaging.python.org/tutorials/packaging-projects/</a>.<br /> <a href="https://packaging.python.org/tutorials/packaging-projects/" target="_blank">https://packaging.python.org/tutorials/packaging-projects/</a>.<br />
11 <br />
8 12
9 13 We assume you already created a repository on rocketgit.com, named We assume you already created a repository on rocketgit.com, named
10 14 <b>prj1</b>.<br /> <b>prj1</b>.<br />
11 15
12 16 Now, clone your repository: Now, clone your repository:
13 <div class="term">git clone https://rocketgit.com/user/YOURUSERNAME/prj1
17 <div class="term">git clone @@base_url@@@@login_ui::homepage@@/prj1
14 18 cd prj1 cd prj1
15 19 </div> </div>
16 20 <br /> <br />
 
... ... setuptools.setup(
41 45 description="A small example package", description="A small example package",
42 46 long_description="bla bla bla", long_description="bla bla bla",
43 47 long_description_content_type="text/markdown", long_description_content_type="text/markdown",
44 url="https://rocketgit.com/user/YOURUSERNAME/prj1",
48 url="@@base_url@@@@login_ui::homepage@@/prj1",
45 49 packages=setuptools.find_packages(), packages=setuptools.find_packages(),
46 50 classifiers=[ classifiers=[
47 51 "Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
 
... ... git commit -m "First commit"
85 89
86 90 Now, it is time to define a webhook which, when you do a git push, will Now, it is time to define a webhook which, when you do a git push, will
87 91 generate a job which will be sent to one of the workers.<br /> generate a job which will be sent to one of the workers.<br />
88 The worker will start
89 the build environment (a VM, for example) and will run my_build_script.sh
90 inside that build environment.<br />
91 So, click <a href="/op/settings/wh/add/build/generic" target="_blank">here</a>
92 The worker will start a build environment (a VM, for example)
93 and will run <b>my_build_script.sh</b> inside it.<br />
94 Click <a href="/op/settings/wh/add/build/generic" target="_blank">here</a>
92 95 (opens in a new tab) (opens in a new tab)
93 96 or go to <b>Settings</b> main menu, or go to <b>Settings</b> main menu,
94 97 click on <b>Webhooks</b> submenu and then press <b>Add</b>. click on <b>Webhooks</b> submenu and then press <b>Add</b>.
File root/themes/default/doc/demo/demos/artifacts/0/main.html changed (mode: 100644) (index 252a2ba..dd2dc04)
1 1 <div class="demo_page_title">@@demo::page_name@@</div> <div class="demo_page_title">@@demo::page_name@@</div>
2 2
3 3 This tutorial will teach you how to make available to you and to others This tutorial will teach you how to make available to you and to others
4 the output of running code: artifacts.<br />
4 the output of running your code (artifacts).<br />
5 5 For example, you can push your repository and, automatically, generate For example, you can push your repository and, automatically, generate
6 a .PDF, an archive, a .rpm or a .deb file. And then expose them on your
7 repository page to be available to others.<br />
6 a .PDF, an archive, a .rpm or a .deb file and then expose them on your
7 repository page.<br />
8 8 <br /> <br />
9 9
10 10 Check first the <a href="/op/doc/demo/ci-1" target="_blank"> Check first the <a href="/op/doc/demo/ci-1" target="_blank">
11 11 Continuous Integration tutorial</a> Continuous Integration tutorial</a>
12 to learn the basics.<br />
12 to learn the how to trigger a build when you push your code.<br />
13 13 <br /> <br />
14 14
File root/themes/default/doc/demo/demos/artifacts/blendergraph/main.html added (mode: 100644) (index 0000000..d7c5bbe)
1 <div class="demo_page_title">@@demo::page_name@@</div>
2
3 In this tutorial we will show you how to generate an image based on a
4 Python script using the great
5 <a href="https://www.blender.org" target="_blank">Blender</a>
6 3D application.<br />
7 This will allow you to automatically have an up-to-date image
8 available for your users just by pushing your Python script.<br />
9 <br />
10
11 Go to
12 <a href="@@base_url@@@@login_ui::homepage@@/op/repo/create" target="_blank">My repositories / Create</a>
13 and create a private repository named <b>blendergraph</b>.<br />
14 <br />
15
16 Go to
17 <a href="@@base_url@@@@login_ui::homepage@@/op/settings/wh/add/build/generic" target="_blank">Settings / Webhooks / Add</a>
18 to add a webhook. This is the way your code will be run and will
19 generate the image when you push into your repository.<br />
20 Set repository filter to <b>blendergraph</b>, add a description,
21 select <b>Push</b> as the trigger event, select <b>fedora-32-x86_64</b> as
22 the environment, add <b>blender</b> to the packages section and set the first command
23 to be <b>make</b>; then press <b>Add</b> button.<br />
24 Now, this hook will be executed at your next push.<br />
25 <br />
26
27 Clone the main <b>blendergraph</b> repository:
28 <div class="term">git clone https://rocketgit.com/user/catalinux/blendergraph
29 cd blendergraph
30 </div>
31 And change the origin remote to yours:
32 <div class="term">git remote remove origin
33 git remote add origin @@base_url@@@@login_ui::homepage@@/blendergraph
34 </div>
35 <br />
36
37 Look around in the repository, especialy in the <b>Makefile</b> and
38 <b>rocketgit/artifacts</b> files.
39 You will see that the Makefile is generating .png and .blend files from
40 the .py files.
41 The artifacts file collects all .png and .blend files and uploads them in
42 a directory with the name of the push branched file (we are using
43 @@refname_short@@ variable.<br />
44 <br />
45
46 We are ready to do our first push:
47 <div class="term">git push origin master
48 </div>
49 <br />
50
51 After few minutes, if you check your
52 <a href="" target="_blank">Artifacts</a>
53 area of your repository, you should see the folder <b>master</b> and,
54 inside it, the .png and .blend files, with the correct content type.<br />
55 You can click the .png file and look at it.<br />
56 If the artifacts are not there, check your webhook and see the last output.
57 It allows you to debug what went wrong.<br />
58 <br />
59
60 As an exercise, change something in the .py file, commit and push.
61 You will see after few minnutes your newly generated image.<br />
62
File root/themes/default/doc/demo/demos/artifacts/blendergraph/name.html added (mode: 100644) (index 0000000..19a8bac)
1 How to generate an image when you push a Blender Python script
File root/themes/default/doc/demo/demos/artifacts/define/main.html changed (mode: 100644) (index 79a7fde..feaf1c2)
1 1 <div class="demo_page_title">@@demo::page_name@@</div> <div class="demo_page_title">@@demo::page_name@@</div>
2 2
3 3 Defining artifacts is a very simple operation. Defining artifacts is a very simple operation.
4 After you finish generating your files (for example after build),
5 you need to create a directory named <b>rocketgit</b> and inside
6 it to create a file named <b>artifacts</b>. The format of the file is:<br />
7 <div class="term">local file path (relative to the git build directory)
8 map = where to map the file in the artefacts web space
4 To achieve this, you need to have a file named <b>artifacts</b>
5 in <b>rocketgit</b> directory, in your project directory.<br />
6 You can have this file in git or you can generate it at build time.<br />
7 <br />
8
9 The format of the file is:<br />
10 <div class="term">local_file_path
11 map = where to map the file in the artifacts web space
9 12 map = another place where to map the same file map = another place where to map the same file
10 ...
11 map = some dir/ -
13 content_type = put_here_a_content_type # optional
14 regex = \.(png|gif|jpg)$ # optional, used only if local_file_path ends with '/'
12 15 </div> </div>
13 16
14 Indent the map files with any amount of spaces/tabs.<br >
15 If the <b>map</b> line ends with '/' char, the file name will not be changed.
17 <b>local_file_path</b> is a file or a directory relative to the repository root
18 directory. Its use is to specify where to look for files.
19 If it is a directory, you must append a <b>/</b> char.<br />
20 Indent the attributes with any amount of spaces/tabs.<br />
21 The <b>map</b> attribute will map your artifacts to a hierarchy which will be
22 available in <b>Artifacts</b> sectorion of your repository.
23 If the <b>map</b> line ends with '/' char, the file name will not be changed.<br />
16 24 Inside the <b>map</b> line, you can use the following variables, which will Inside the <b>map</b> line, you can use the following variables, which will
17 25 be replaced by their values: be replaced by their values:
18 26 <ul> <ul>
19 27 <li>env - The environment string (example: debian-10-amd64)</li> <li>env - The environment string (example: debian-10-amd64)</li>
20 <li>head - hash of the push which triggered the build (example: 58139c7a3b50e08815d5ae97dd6d15dcbfd96000)</li>
28 <li>head - hash of the last commit (example: 58139c7a3b50e08815d5ae97dd6d15dcbfd96000)</li>
21 29 <li>refname - referance name where the commits were pushed (example: ref/heads/main)</li> <li>refname - referance name where the commits were pushed (example: ref/heads/main)</li>
22 30 <li>refname_short - short reference name where the commits were pushed (example: main)</li> <li>refname_short - short reference name where the commits were pushed (example: main)</li>
23 31 <li>hook_id - The id of the hook which triggered the build (example: 734)</li> <li>hook_id - The id of the hook which triggered the build (example: 734)</li>
24 <li>uid - The uid of the user which pushed (example: 34)</lib>
32 <li>uid - The uid of the user which pushed (example: 34)</li>
33 <li>original_path - the local_file_path string</li>
34 <li>original_path_no_ext - the local_file_path string, but without extention</li>
25 35 </ul> </ul>
26 36
27 Variables must be enclosed between <b>@@</b> strings.<br />
37 Variables must be enclosed between <b>@@</b> chars (example: @@env@@).<br />
38 <br />
39
40 Optionaly, you can add <b>regex</b> attribute to filter what files you want to
41 declare as artifacts. It makes sense when <b>local_file_path</b>
42 is a directory.<br />
43 <br />
44
45 Again, optionaly, you can also set a proper content type by adding
46 a <b>content_type</b> attribute.
47 It will be usefull when someone will try to download your artifacts,
48 to allow a proper application to be used to open the file.
49 If not specified, it will be autodetected.<br />
50 <br />
28 51
29 52 An example: An example:
30 53 <div class="term">build/my_cool_script.sh <div class="term">build/my_cool_script.sh
 
... ... build/my_docs.pdf
35 58 map = docs/@@refname_short@@/My new name.pdf map = docs/@@refname_short@@/My new name.pdf
36 59 map = docs/latest/My new name.pdf map = docs/latest/My new name.pdf
37 60 content_type = application/pdf content_type = application/pdf
61
62 ./
63 map = docs/@@refname_short@@/
64 regex = \.xyz$
65 content_type = application/xyz
38 66 </div> </div>
39 67
40 The above example will upload the local file build/my_cool_script.sh
41 to the server in the directory dir1/debian-10-amd64/main/my_cool_script.sh
42 (please note, without the build/ dir).<br />
43 Also, it will upload the file my_docs.pdf in two places, changing
68 The above example will upload the file <b>build/my_cool_script.sh</b>
69 to the server in the directory <b>dir1/debian-10-amd64/main/my_cool_script.sh</b>
70 (please note that the <b>build/</b> string is stripped).<br />
71 Also, it will upload the file <b>my_docs.pdf</b> in two places, changing
44 72 the name at the same time.<br /> the name at the same time.<br />
45 Optionaly, you can also set a proper content type. It will be usefull
46 when someone will try to download your artifacts. If not specified,
47 it will be autodetected.
73 Finally, it will scan the root project directory (<b>./</b>), select all files
74 with <b>.xyz</b> extention and set the content type to <b>application/xyz</b>.
75 Please note that the search is not recursive: only the files in the specified
76 directory are tested.
File root/themes/default/doc/demo/demos/artifacts/python1/name.html deleted (index ddbf2cf..0000000)
1 How to generate artifacts for a Python package
File root/themes/default/doc/demo/demos/artifacts/see/main.html changed (mode: 100644) (index 5e1fcac..5cf807a)
... ... the artifacts file (<b>rocketgit/artifacts</b>) file will be taken in
5 5 consideration and the artifacts will be upload to the server.<br /> consideration and the artifacts will be upload to the server.<br />
6 6 <br /> <br />
7 7
8 You can find them in you repository page by choosing the <b>Artifacts</b> menu.<br />
9 You can browse the tree of artifacts, download or delete them.<br />
10 <br />
8 You can find them in you repository page by clicking the <b>Artifacts</b> menu.<br />
9 You can browse the tree of artifacts and download them.<br />
11 10
12 See the examples in the next chapters.
File root/themes/default/doc/demo/demos/ci-1/0/main.html changed (mode: 100644) (index e91061f..c3ed52a)
... ... Continuous Integration automatically can:
13 13 <ul> <ul>
14 14 <li>Build and test your changes on different operating systems and <li>Build and test your changes on different operating systems and
15 15 architectures</li> architectures</li>
16 <li>Deploy a build that passed the test using your script</li>
16 <li>Deploy a build that passed the tests, using your custom script</li>
17 17 <li>Add custom labels to the build and test steps to easily identify <li>Add custom labels to the build and test steps to easily identify
18 18 what gone wrong.</li> what gone wrong.</li>
19 19 </ul> </ul>
File root/themes/default/doc/demo/demos/ci-1/about/main.html changed (mode: 100644) (index 4e89e82..2603c01)
... ... when you push a branch of your repository and your tests pass.<br/ >
9 9 First, you will have to create an account and then a repository and First, you will have to create an account and then a repository and
10 10 setup your local environment for Git and SSH. Also, we assume that you setup your local environment for Git and SSH. Also, we assume that you
11 11 already cloned the repository locally. already cloned the repository locally.
12 These steps are not covered by this tutorial.<br />
12 These steps are not covered by this tutorial (see the hints on the repo page).<br />
13 13 <br /> <br />
14 14
15 Now, we assume you are in the just cloned repository local folder.
15 Now, we assume you are in the just cloned repository's local folder.
16 16 We can start with a simple application, stored in file 'main.sh': We can start with a simple application, stored in file 'main.sh':
17 17 <div class="term">#!/bin/bash <div class="term">#!/bin/bash
18 18
 
... ... case "${1}" in
22 22 c) echo "C" ;; c) echo "C" ;;
23 23 *) echo "BAD" ;; *) echo "BAD" ;;
24 24 esac esac
25
26 25 </div> </div>
27 26
28 27 As you can see, it is a simple script. Now, we will add another script, As you can see, it is a simple script. Now, we will add another script,
 
... ... if [ "`./main.sh b`" != "B" ]; then
40 39 fi fi
41 40
42 41 echo "Tests passed!" echo "Tests passed!"
43
44 42 </div> </div>
43 <br />
45 44
46 45 Next, we will add the deploy script, 'deploy.sh': Next, we will add the deploy script, 'deploy.sh':
47 46 <div class="term">#!/bin/bash <div class="term">#!/bin/bash
 
... ... Next, we will add the deploy script, 'deploy.sh':
49 48 for s in server1 server2 server3; do for s in server1 server2 server3; do
50 49 rsync -a main.sh ${s}:/usr/local/bin/ rsync -a main.sh ${s}:/usr/local/bin/
51 50 done done
52
53 51 </div> </div>
54 52
55 'deploy.sh' will propagate our main.sh file to multiple servers.
53 <b>deploy.sh</b> script will propagate our <b>main.sh</b> file to multiple
54 servers.
File root/themes/default/doc/demo/demos/ci-1/add_hook/main.html changed (mode: 100644) (index 8ca6828..7067fa3)
1 1 <div class="demo_page_title">@@demo::page_name@@</div> <div class="demo_page_title">@@demo::page_name@@</div>
2 2
3 Next step is to add a webhook that will trigger our test and deploy
3 The next step is to add a webhook that will trigger our test and deploy
4 4 phases when a push is taking place.<br /> phases when a push is taking place.<br />
5 5 <br /> <br />
6 To add this hook, you have to go login and then to to
6 To add this hook, you have to login and go to
7 7 <b>Settings / Webhooks / Add</b> menu.<br /> <b>Settings / Webhooks / Add</b> menu.<br />
8 Than, choose 'build' as the hook type by clinking 'Generic' link.<br />
8 Then, scroll to <b>build</b> type and click <b>Generic</b> link.<br />
9 9 Now, you can choose what repository and branch we want to add this hook to. Now, you can choose what repository and branch we want to add this hook to.
10 10 Please note that both fields are regular expressions. So, with a single hook Please note that both fields are regular expressions. So, with a single hook
11 11 you can cover more/all repositories and branches.<br /> you can cover more/all repositories and branches.<br />
 
... ... Just type your repository name. For branch, leave it empty, meaning that
13 13 any branch will trigger the hook.<br /> any branch will trigger the hook.<br />
14 14 Then, type a description to easy remember what the hook is for, for example: Then, type a description to easy remember what the hook is for, for example:
15 15 "This will deploy main.sh to the servers".<br /> "This will deploy main.sh to the servers".<br />
16 Now, you have to choose what events will trigger the hook: we will use 'Push'
17 event.<br />
16 Now, you have to choose what events will trigger the hook:
17 we will use <b>Push</b> event.<br />
18 18 Next, you will have to choose a build environments. For our example, Next, you will have to choose a build environments. For our example,
19 we will use only one environment, 'debian-8.2-i386'.
19 we will use only one environment, 'debian-10-amd64'.
20 20 You will use multiple build environments when you want to be sure You will use multiple build environments when you want to be sure
21 21 your application will work across a full range of distributions and your application will work across a full range of distributions and
22 22 architectures combinations.<br /> architectures combinations.<br />
 
... ... bash scripts.<br />
26 26 Now, what is left is to specify what commands we want to execute. Now, what is left is to specify what commands we want to execute.
27 27 First command will be './test.sh' and we will check the checkbox First command will be './test.sh' and we will check the checkbox
28 28 "Abort on fail?". Why? Because if the test does not pass, we will "Abort on fail?". Why? Because if the test does not pass, we will
29 not do the deploy step.
29 not want to execute the deploy step.
30 30 Optionally, you can add some labels which will be added to your last commit Optionally, you can add some labels which will be added to your last commit
31 31 in that branch.<br /> in that branch.<br />
32 For the second command you will type './deploy.sh'. Now, press 'Add'.
33 We are ready to use the hook.<br />
32 For the second command you will type './deploy.sh'.<br />
33 Then, press 'Add'. We are ready to use the hook.<br />
File root/themes/default/doc/demo/demos/ci-1/python1/main.html renamed from root/themes/default/doc/demo/demos/artifacts/python1/main.html (similarity 50%) (mode: 100644) (index 9b7ad47..e53a384)
1 1 <div class="demo_page_title">@@demo::page_name@@</div> <div class="demo_page_title">@@demo::page_name@@</div>
2 2
3 3 In this tutorial we will create a Python package and we will In this tutorial we will create a Python package and we will
4 upload the .rpm and the .tgz files to the artifacts web area.<br />
4 automatically upload the resulting .tar.gz and .whl files to
5 the PyPI repository.<br />
6 <br />
5 7
6 8 The steps were copied from The steps were copied from
7 9 <a href="https://packaging.python.org/tutorials/packaging-projects/" target="_blank">https://packaging.python.org/tutorials/packaging-projects/</a>.<br /> <a href="https://packaging.python.org/tutorials/packaging-projects/" target="_blank">https://packaging.python.org/tutorials/packaging-projects/</a>.<br />
10 <br />
8 11
9 12 We assume you already created a repository on rocketgit.com, named We assume you already created a repository on rocketgit.com, named
10 13 <b>prj1</b>.<br /> <b>prj1</b>.<br />
11 14
12 Now, clone your repository:
13 <div class="term">git clone https://rocketgit.com/user/YOURUSERNAME/prj1
15 If you do not have an account on PyPI, go
16 <a href="https://pypi.org/account/register/" target="_blank">there</a>
17 and create one.<br />
18 To be able to push your packages to PyPI, you need to create an API token.
19 Go <a href="https://pypi.org/manage/account/#api-tokens" target="_blank">there</a>
20 and press <b>Add API token</b>;
21 fill in any name you want, and, for <b>Scope</b>, select
22 <b>Entire account (all projects)</b> and press <b>Add token</b>.<br />
23 Copy the API token to clipboard because you will need it later.<br />
24 <br />
25
26 Clone your repository:
27 <div class="term">git clone @@base_url@@@@login_ui::homepage@@/prj1
14 28 cd prj1 cd prj1
15 29 </div> </div>
16 30 <br /> <br />
 
... ... Create a file named <b>my_build_script.sh</b> with the following content:
21 35 # Build the package # Build the package
22 36 python3 setup.py sdist bdist_wheel python3 setup.py sdist bdist_wheel
23 37
24 # Instruct RocketGit to use those files
25 mkdir -p rocketgit
26 echo "dist/" > rocketgit/artifacts
27 echo " map = @@refname_short@@/latest/" >> rocketgit/artifacts
28 echo " map = @@refname_short@@/@@head@@/" >> rocketgit/artifacts
38 # Upload package
39 python3 -m twine upload dist/*
29 40 </div> </div>
30 41 It is the script which will get executed when you will run <b>git push</b>.<br /> It is the script which will get executed when you will run <b>git push</b>.<br />
31 42 <br /> <br />
 
... ... setuptools.setup(
41 52 description="A small example package", description="A small example package",
42 53 long_description="bla bla bla", long_description="bla bla bla",
43 54 long_description_content_type="text/markdown", long_description_content_type="text/markdown",
44 url="https://rocketgit.com/user/YOURUSERNAME/prj1",
55 url="@@base_url@@@@login_ui::homepage@@/prj1",
45 56 packages=setuptools.find_packages(), packages=setuptools.find_packages(),
46 57 classifiers=[ classifiers=[
47 58 "Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
 
... ... And the initialization file, <b>__init__.py</b>:
76 87 </div> </div>
77 88 <br /> <br />
78 89
79 Now, we will add all the files to git:
90 We will add all the files to git:
80 91 <div class="term">cd .. <div class="term">cd ..
81 92 git add . git add .
82 93 git commit -m "First commit" git commit -m "First commit"
83 94 </div> </div>
84 95 <br /> <br />
85 96
86 Now, it is time to define a webhook which, when you do a git push, will
97 It is time to define a webhook which, when you do a git push, will
87 98 generate a job which will be sent to one of the workers.<br /> generate a job which will be sent to one of the workers.<br />
88 The worker will start
89 the build environment (a VM, for example) and will run my_build_script.sh
90 inside that build environment.<br />
91 So, click <a href="/op/settings/wh/add/build/generic" target="_blank">here</a>
99 The worker will start a build environment (a VM, for example)
100 and will run <b>my_build_script.sh</b> inside it.<br />
101 Click <a href="/op/settings/wh/add/build/generic" target="_blank">here</a>
92 102 (opens in a new tab) (opens in a new tab)
93 103 or go to <b>Settings</b> main menu, or go to <b>Settings</b> main menu,
94 104 click on <b>Webhooks</b> submenu and then press <b>Add</b>. click on <b>Webhooks</b> submenu and then press <b>Add</b>.
95 105 From the list, go to type <b>build</b> line and click "Generic".<br /> From the list, go to type <b>build</b> line and click "Generic".<br />
96
97 106 For <b>Repository</b> input field For <b>Repository</b> input field
98 107 set <b>prj1</b> or leave it empty to allow the webhook to execute for all set <b>prj1</b> or leave it empty to allow the webhook to execute for all
99 your projects. Add a description (if you want), select <b>Push</b> trigger
108 your projects. Add a description to easily identify the webhook.
109 Because we need to authenticate ourselves to PyPI, we need to set the API token:
110 go to <b>Secrets</b> area, set the <b>Name</b> field to <b>TWINE_USERNAME</b>
111 and the <b>Value</b> field to <b>__token__</b>.
112 Go to the next secret line and set the name to <b>TWINE_PASSWORD</b> and, for the value,
113 paste the PyPI token you have in your clipboard. It must start with <b>pypi-</b>.<br />
114 Select <b>Push</b> trigger
100 115 event, select <b>debian-10-amd64</b> environment, add <b>python-setuptools event, select <b>debian-10-amd64</b> environment, add <b>python-setuptools
101 python-setuptools-wheel python3-setuptools python3-wheel</b> to the
116 python-setuptools-wheel python3-setuptools python3-wheel twine</b> to the
102 117 <b>Packages to install</b> section (we add all the possible names to cover <b>Packages to install</b> section (we add all the possible names to cover
103 all distributions), and, for the first command,
118 all distributions - invalid names are ignored), and, for the first command,
104 119 input <b>bash my_build_script.sh</b>. Finally, click <b>Add</b> button.<br /> input <b>bash my_build_script.sh</b>. Finally, click <b>Add</b> button.<br />
120 <br />
105 121
106 Now, we can go back to terminal, and run:
122 We can go back to terminal, and run:
107 123 <div class="term">git push</div> <div class="term">git push</div>
124 <br />
108 125
109 If everything went OK, after few minutes, you can check the artifacts area:
110 go to <b>My repositories</b> in the main menu, find <b>prj1</b> and click
111 on it, then click on <b>Artifacts</b> submenu.<br />
112 If everything went OK, you will find your packages there.<br />
113 If not, you will go back to the webhooks page, click on the newly added
114 one and expand the <b>Last output</b> area and you will understand
115 what went wrong.<br />
126 If everything went OK, after few minutes, you can check the Webhooks area:
127 go to <b>Settings</b> in the main menu and go to <b>Webhooks</b> submenu.
128 Scroll to your webhook, and expand <b>Last output</b> area: here you will
129 find the output of the package installation process and the output of
130 your <b>my_build_script.sh</b> script. From this log, you can figure out
131 why something went wrong or you can find that your upload was a success.<br />
132 <br />
133
134 Go to
135 <a href="https://pypi.org/manage/projects/" target="_blank">PyPI</a>
136 and you should see your package uploaded there.<br />
137 To install your newly uploaded package, on any machine, use:
138 <div class="term">python3 -m pip install example-pkg-YOUR-USERNAME-HERE
139 </div>
116 140 <br /> <br />
117 141
118 You can directly install the package, by copying the URL behind <b>Download</b>
119 link of the <b>.whl</b> file and running:
120 <div class="term">python3 -m pip install PASTE_HERE_THE_LINK_FROM_CLIPBOARD</div>
121 Now, you can just use it:
142 To use it:
122 143 <div class="term">python3 <div class="term">python3
123 144 &gt;&gt;&gt; import prj1 &gt;&gt;&gt; import prj1
124 145 &gt;&gt;&gt; prj1.hello(); &gt;&gt;&gt; prj1.hello();
File root/themes/default/doc/demo/demos/ci-1/python1/name.html added (mode: 100644) (index 0000000..cf56b1e)
1 How to push to PyPI your Python package
File root/themes/default/doc/demo/demos/ci-1/trigger/main.html changed (mode: 100644) (index 74e6b42..5df8d75)
... ... You will have to add, commit and push these files:
10 10 git add *.sh git add *.sh
11 11 git commit -m "First commit" git commit -m "First commit"
12 12 git push origin master git push origin master
13
14 13 </div> </div>
15 14
16 If the push is successfully, the hook will be triggered in background.
15 If the push was done successfully, the hook will be triggered in background.
17 16 You can go to <b>Settings / Webhooks</b> and you can check the "Last output" You can go to <b>Settings / Webhooks</b> and you can check the "Last output"
18 17 field to see the last output of the trigger. If the hook did not finished, field to see the last output of the trigger. If the hook did not finished,
19 18 the text "n/a" will appear.<br /> the text "n/a" will appear.<br />
 
... ... Command[./deploy.sh]:
39 38 ./deploy.sh: line 4: rsync: command not found ./deploy.sh: line 4: rsync: command not found
40 39 ./deploy.sh: line 4: rsync: command not found ./deploy.sh: line 4: rsync: command not found
41 40 ./deploy.sh: line 4: rsync: command not found ./deploy.sh: line 4: rsync: command not found
42
43 41 </div> </div>
44 42
45 As you can see the tests passed, but you forgot to add rsync in the list of
43 As you can see the tests passed, but we forgot to add <b>rsync</b> to the list of
46 44 packages to be installed. Just go to <b>Settings / Webhook / List</b> and packages to be installed. Just go to <b>Settings / Webhook / List</b> and
47 edit your hook: in "packages to install" text box, add 'rsync' next to 'bash'
45 edit your hook: in "Packages to install" text box, add 'rsync' next to 'bash'
48 46 and press 'Edit' button.<br /> and press 'Edit' button.<br />
49 Now, we are ready to push again. Because you changed nothing in the repository,
47 Now, we are ready to push again. Because we changed nothing in the repository,
50 48 the push will succeed but will not trigger the hook. So, just do a fake the push will succeed but will not trigger the hook. So, just do a fake
51 49 change: change:
52 50 <div class="term">echo "Documentation is important" > README <div class="term">echo "Documentation is important" > README
 
... ... rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=
111 109 ssh: Could not resolve hostname server3: No address associated with hostname ssh: Could not resolve hostname server3: No address associated with hostname
112 110 rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync: connection unexpectedly closed (0 bytes received so far) [sender]
113 111 rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1] rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]
114
115 112 </div> </div>
116 113
117 114 You can see that our 'deploy.sh' script was called, 'rsync' was present You can see that our 'deploy.sh' script was called, 'rsync' was present
 
... ... but failed because our server names are fake.<br/>
119 116 <br /> <br />
120 117
121 118 That's it! You are now able to setup a test & deploy system to help you That's it! You are now able to setup a test & deploy system to help you
122 with the boring manual procedure.
119 with the boring manual procedures.<br />
120 <br />
121
122 Next sections will show you some practical examples.
File root/themes/default/doc/demo/list.html changed (mode: 100644) (index f2b4424..55977e0)
1 1 <div class="main_title">Tutorials - learn about RocketGit</div> <div class="main_title">Tutorials - learn about RocketGit</div>
2 2
3 3 <div class="islands"> <div class="islands">
4 <div class="island">
5 <div class="island_title">Configuration</div>
6 <a href="/op/doc/demo/config">Fine tune your RocketGit instance</a>
7 </div>
4 <a href="/op/doc/demo/config">
5 <div class="island">
6 <div class="island_title">Configuration</div>
7 Fine tune your RocketGit instance
8 </div>
9 </a>
8 10
9 <div class="island">
10 <div class="island_title">Webhooks</div>
11 Soon...
12 </div>
11 <a href="/op/doc/demo/ci-1">
12 <div class="island">
13 <div class="island_title">Continuous Integration</div>
14 Automatically run operations on push
15 </div>
16 </a>
13 17
14 <div class="island">
15 <div class="island_title">Continuous Integration</div>
16 <a href="/op/doc/demo/ci-1">The basics</a>
17 </div>
18
19 <div class="island">
20 <div class="island_title">Artifacts</div>
21 <a href="/op/doc/demo/artifacts">How to define and make them available</a>
22 </div>
18 <a href="/op/doc/demo/artifacts">
19 <div class="island">
20 <div class="island_title">Artifacts</div>
21 Generate content and make it available
22 </div>
23 </a>
23 24 </div> </div>
25
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/catalinux/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/rocketgit

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main