Skip to content
This repository was archived by the owner on Sep 7, 2020. It is now read-only.

Feature/issue 1381 boardfarm in gitlab ci#1483

Closed
odkq wants to merge 52 commits intomasterfrom
feature/issue-1381-boardfarm-in-gitlab-ci
Closed

Feature/issue 1381 boardfarm in gitlab ci#1483
odkq wants to merge 52 commits intomasterfrom
feature/issue-1381-boardfarm-in-gitlab-ci

Conversation

@odkq
Copy link
Collaborator

@odkq odkq commented Jun 24, 2020

@arnout arnout added this to the M3 - Workable product milestone Jun 25, 2020
@arnout arnout linked an issue Jun 25, 2020 that may be closed by this pull request
4 tasks
rmelotte added a commit that referenced this pull request Jun 26, 2020
To run the boardfarm tests, we need an image containing boardfarm.

Add an image that contains all the boardfarm dependencies, fetch a
specific commit (the latest one from the master branch) and install
it.

The dockerfile was adapted from the existing work on:
#1483

Also add the image to .gitlab-ci to get it built automatically.

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
rmelotte added a commit that referenced this pull request Jun 29, 2020
When a command failed to run, raise an exception early, and add the
stdout and stderr output of the command in the message.

These changes were taken and adapted from:
#1483

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
rmelotte added a commit that referenced this pull request Jun 29, 2020
When a command failed to run, raise an exception early, and add the
stdout and stderr output of the command in the message.

These changes were taken and adapted from:
#1483

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
rmelotte added a commit that referenced this pull request Jun 29, 2020
When a command failed to run, raise an exception early, and add the
stdout and stderr output of the command in the message.

These changes were taken and adapted from:
#1483

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
rmelotte added a commit that referenced this pull request Jun 29, 2020
When a command failed to run, raise an exception early, and add the
stdout and stderr output of the command in the message.

These changes were taken and adapted from:
#1483

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
rmelotte added a commit that referenced this pull request Jun 29, 2020
When a command failed to run, raise an exception early, and add the
stdout and stderr output of the command in the message.

These changes were taken and adapted from:
#1483

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
rmelotte added a commit that referenced this pull request Jun 29, 2020
When a command failed to run, raise an exception early, and add the
stdout and stderr output of the command in the message.

These changes were taken and adapted from:
#1483

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
@odkq odkq marked this pull request as ready for review June 29, 2020 15:16
Copy link
Collaborator

@arnout arnout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a full review - just a few loose comments. Please also see my comments in #1492 (review) where they're relevant for this one.

I don't really like this docker compose approach to launch several containers. Indeed, it forces us to duplicate the "knowledge" of which containers to use between the compose.yml file and the boardfarm config file. However, I do look how the compose yml file describes how to launch the container much better than how the shell script does it. So I'm all for using that rather than shell scripts to launch our containers. Wouldn't it be possible to make two compose.yml files, one for boardfarm itself and one for prplmesh, and do a compose boardfarm which launches boardfarm which launches two times compose prplmesh which luanches agent resp. controller?

dctest.sh Outdated
@@ -0,0 +1,14 @@
#!/bin/bash

function dc {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dc is already an existing tool (decimal calculator, I think), so better call it something unique. "compose" for example.

dctest.sh Outdated
if [ $# -eq 0 ]; then
dc up boardfarm
else
if [ $1 == "-h" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe shellcheck will complain here...

Suggested change
if [ $1 == "-h" ]; then
if [ "$1" == "-h" ]; then

version: '3'
services:
controller:
image: registry.gitlab.com/prpl-foundation/prplmesh/prplmesh-runner
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need an explicit tag here as well. Is there a way for docker-compose to get variables that get expanded? Like ARG in Dockerfile?

Comment on lines 4 to 16
image: registry.gitlab.com/prpl-foundation/prplmesh/prplmesh-runner
privileged: true # For the creation of the bridge to work
container_name: controller
environment:
- USER=$USER
- INSTALL_DIR=$ROOT_DIR/build/install
- ROOT_DIR=$ROOT_DIR
expose:
- "5000"
- "8002"
volumes:
- "$ROOT_DIR:$ROOT_DIR"
entrypoint: ["/root/entrypoint.sh", "/usr/bin/start-controller-agent"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG, this is a lot more readable than the stupid run script we have now... Nice!

rootdir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..'))


class PrplMeshCompose(PrplMeshBase):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should define a new class. Instead, change the PrplMeshDocker class to use compose instead of naked docker.

rmelotte added a commit that referenced this pull request Jun 30, 2020
When a command failed to run, raise an exception early, and add the
stdout and stderr output of the command in the message.

These changes were taken and adapted from:
#1483

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
rmelotte added a commit that referenced this pull request Jun 30, 2020
When a command failed to run, raise an exception early, and add the
stdout and stderr output of the command in the message.

These changes were taken and adapted from:
#1483

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
@odkq odkq force-pushed the feature/issue-1381-boardfarm-in-gitlab-ci branch from 87ddfba to 2ff49e2 Compare June 30, 2020 14:56
odkq and others added 8 commits July 1, 2020 10:39
test requirements and controller

Signed-off-by: odkq <pablo@odkq.com>
Signed-off-by: odkq <pablo@odkq.com>
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
Signed-off-by: odkq <pablo@odkq.com>
Export $ROOT_DIR into images

Signed-off-by: odkq <pablo@odkq.com>
Signed-off-by: odkq <pablo@odkq.com>
For dumpcap

Signed-off-by: odkq <pablo@odkq.com>
With this, many instances can be launched. Each one get's the name
configured in the .json file, with the 'unique id' being the user.

Also, a volume is mapped where the tests expect the output log to
reside, from them to /tmp/user/beerocks/logs

Changed the entrypoint for boardfarm image to run the script and and
made a small shell script wrapper

Signed-off-by: odkq <pablo@odkq.com>
Signed-off-by: odkq <pablo@odkq.com>
odkq added 19 commits July 24, 2020 13:10
Signed-off-by: odkq <pablo@odkq.com>
…ithub.com/prplfoundation/prplMesh into feature/issue-1381-boardfarm-in-gitlab-ci

Signed-off-by: odkq <pablo@odkq.com>
Signed-off-by: odkq <pablo@odkq.com>
To test dctest.py

Signed-off-by: odkq <pablo@odkq.com>
…ithub.com/prplfoundation/prplMesh into feature/issue-1381-boardfarm-in-gitlab-ci

Signed-off-by: odkq <pablo@odkq.com>
added tag 'boardfarm-compose' to dctest_one_test target

Signed-off-by: odkq <pablo@odkq.com>
This allows for gitlab-ci to report a failing test

Signed-off-by: odkq <pablo@odkq.com>
Use 'latest' tag when testing locally (not in gitlab-ci)

Signed-off-by: pablo <pablo@odkq.com>
Forward the variable so it is used to tag the images for the runner and
agent inside boardfarm container

Signed-off-by: pablo <pablo@odkq.com>
After running dctest.py, make sure the files created while building
boardfarm (as root) can be removed later by gitlab-runner

Signed-off-by: pablo <pablo@odkq.com>
before exiting the script.

Adding it in .gitlab-ci.yml did not work as when the script fails next
lines are not executed

Signed-off-by: pablo <pablo@odkq.com>
When it runs inside gitlab-ci, the directory is /tmp/beerocks/logs, not
/tmp/<user>/beerocks/logs

Signed-off-by: pablo <pablo@odkq.com>
Signed-off-by: pablo <pablo@odkq.com>
To /builds/prpl-foundation/prplMesh which is the one expected by the
runner and binaries built

Signed-off-by: pablo <pablo@odkq.com>
Signed-off-by: pablo <pablo@odkq.com>
Setting the current uid and the group id of docker (to be able to access
the docker socket), this makes all the files created by the boardfarm
installation deletable by the gitlab-ci user

Signed-off-by: pablo <pablo@odkq.com>
This appeared after merging from master

Signed-off-by: pablo <pablo@odkq.com>
@rmelotte
Copy link
Collaborator

rmelotte commented Aug 3, 2020

@odkq can you please:

Then we will have to cleanup the history (at least the easy parts), merge it, then do additional cleanup like removing the old boardfarm test, and integrating #1556.

@rmelotte rmelotte marked this pull request as draft August 3, 2020 14:50
odkq added 4 commits August 3, 2020 17:26
Alternative entrypoint for the runner image when running as a regular user

Signed-off-by: pablo <pablo@odkq.com>
Signed-off-by: pablo <pablo@odkq.com>
Signed-off-by: pablo <pablo@odkq.com>
Signed-off-by: pablo <pablo@odkq.com>
"run", "start-controller")
time.sleep(self.delay)
self.controller_entity = \
ALEntityDocker(self.name, is_controller=True, compose=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ALEntityDocker(self.name, is_controller=True, compose=True)
ALEntityDocker(self.name, device=self, is_controller=True, compose=True)

odkq pushed a commit that referenced this pull request Aug 6, 2020
To run the boardfarm tests, we need an image containing boardfarm.

Add an image that contains all the boardfarm dependencies, fetch a
specific commit (the latest one from the master branch) and install
it.

The dockerfile was adapted from the existing work on:
#1483

Also add the image to .gitlab-ci to get it built automatically.

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
odkq pushed a commit that referenced this pull request Aug 6, 2020
When a command failed to run, raise an exception early, and add the
stdout and stderr output of the command in the message.

These changes were taken and adapted from:
#1483

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
@rmelotte
Copy link
Collaborator

Superseded by #1587

@rmelotte rmelotte closed this Aug 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TASK] Integrate boardfarm in gitlab-ci

3 participants