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

Explicitly specify the name of the container running tests in Jenkins #316

Merged
merged 5 commits into from Jan 17, 2019
Merged

Explicitly specify the name of the container running tests in Jenkins #316

merged 5 commits into from Jan 17, 2019

Conversation

paramsingh
Copy link
Collaborator

No description provided.

@paramsingh
Copy link
Collaborator Author

@brainzbot retest this please

Copy link
Collaborator

@alastair alastair left a comment

Choose a reason for hiding this comment

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

Looks good, but I think we just need --name in one place.

@@ -46,14 +46,14 @@ function run_tests {

# create database and user once
echo "creating user and database"
docker-compose -f $COMPOSE_FILE_LOC -p $COMPOSE_PROJECT_NAME run --rm $TEST_CONTAINER_NAME \
docker-compose -f $COMPOSE_FILE_LOC -p $COMPOSE_PROJECT_NAME run --rm $TEST_CONTAINER_NAME --name $TEST_CONTAINER_REF\
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 need --name here - we're already using --rm. This container only runs init_db and then quits and removes itself.

dockerize \
-wait tcp://db:5432 -timeout 60s bash -c \
"cd /code && cp config.py.example config.py && ls -lR && python manage.py init_db"

# run tests
echo "running tests"
docker-compose -f $COMPOSE_FILE_LOC -p $COMPOSE_PROJECT_NAME run $TEST_CONTAINER_NAME \
docker-compose -f $COMPOSE_FILE_LOC -p $COMPOSE_PROJECT_NAME run $TEST_CONTAINER_NAME --name $TEST_CONTAINER_REF \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we add a comment saying why we explicitly set a name? (so that we have a consistent name so that we can use docker cp later in the script)

The only thing we have to be sure about here is that the containers gets removed properly after it runs, and that different runs of the tests don't conflict with each other. I think that we're OK here:

  • the project name contains the jenkins tag, which increases for each time that jenkins runs a job (and this is always how it's run in the past, without problems)
  • the cleanup function stops and removes all containers with the project name, so this should be removed as well with no problems

@paramsingh paramsingh merged commit a602d31 into metabrainz:master Jan 17, 2019
@paramsingh paramsingh deleted the jenkins-fix branch January 17, 2019 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants