Run, Gitlab, Run!

Trying to understand Continuous Integration – The Sequel

I planned to write about gitlab runner this week but it seems like Adam has already covered it in his post so no work for me, yay so I decided to make a sequel, or more accurately, an experiment.

As Adam said, to setup a runner, you must be admin. Thus I tried to make a dummy repo on gitlab to try it out. Turns out, when I go to the settings page, the shared runners are already enabled by default, and it seems like there’s no option to choose which runner to use.

shared_runners

So do I simply push a .yml file and the the runner will magically works just like that? Let’s find out!

First I made a python function in a file named tes.py (because I’m not familiar with testing in ruby yet, let alone rails):

def run(s):
   return 'Run,'+s+', Run!'

and a unit test, named test_tester.py:

class TestStringMethods(unittest.TestCase):
   def test_run(self):
      self.assertEqual(tes.run('Gitlab'), 'Run, Gitlab, Run!')

aand of course, the .yml:

before_script:
  - python -v
  - which python

unittest:
  script:
    - python -m unittest test_tester

After I pushed them, something’s happening!

pipeline
Tico used runner! It failed : (

It’s okay, don’t panic, all according to keikaku*. Of course I deliberately missed a space there, it’s totally intentional. I did it to check what will happen if the test failed. Chill guys.

(In case you didn’t notice, there’s a missing space character in the return value of the run(s) function)

Anyways here’s what it looks like when not failing:

not_fail

And I totally didn’t spent 15 minutes to fix one space. Honest!

Conclusion:

  • Seems like shared runners are enabled by default
  • We only need to push a .yml file and everything will works automagically
  • Just to make sure, once again, the bug was intentional. Believe me please 😦

*) TL note: keikaku means plan

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s