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

Add Hetzner Cloud driver #1811

Merged
merged 1 commit into from
Aug 2, 2019
Merged

Conversation

decentral1se
Copy link
Contributor

@decentral1se decentral1se commented Mar 7, 2019

Closes #1791.

@gundalow

This comment has been minimized.

@LKaemmerling

This comment has been minimized.

@decentral1se

This comment has been minimized.

@decentral1se decentral1se changed the title WIP: Hetzner driver WIP: Hetzner Cloud driver Mar 10, 2019
@vutkin

This comment has been minimized.

@decentral1se

This comment has been minimized.

@decentral1se

This comment has been minimized.

@decentral1se

This comment has been minimized.

@decentral1se decentral1se changed the title WIP: Hetzner Cloud driver Add Hetzner Cloud driver Apr 24, 2019
@decentral1se decentral1se requested a review from webknjaz as a code owner April 24, 2019 15:41
@decentral1se

This comment has been minimized.

@decentral1se decentral1se force-pushed the add-hetzner-driver branch 3 times, most recently from e213648 to cb59e51 Compare April 24, 2019 15:53
@decentral1se
Copy link
Contributor Author

decentral1se commented Apr 24, 2019

How to manual test this:

$ git clone -b add-hetzner-driver https://github.com/ansible/molecule
$ cd molecule
$ pip install -e .'[hetznercloud]'
$ molecule init -r hcloudtest -d hetznercloud && cd hcloudtest
$ export HCLOUD_TOKEN=<MYTOKEN>
$ export MOLECULE_NO_LOG=False; export MOLECULE_DEBUG=True
$ molecule test

@webknjaz

This comment has been minimized.

@webknjaz webknjaz closed this Apr 24, 2019
@webknjaz webknjaz reopened this Apr 24, 2019
@decentral1se

This comment has been minimized.

@LKaemmerling

This comment has been minimized.

@decentral1se
Copy link
Contributor Author

Current status is then: there are endless issues with running the full functional test suite on the CI. SSH connection issues, machines not responding, docker networks randomly failing, incorrect passwords (really unsure how this is happening). And all the while, all the tests pass locally. I think I will abandon this for now.

@LKaemmerling
Copy link

Really sad to hear this. @decentral1se is there something we could do to help you finish this? We plan to add more modules to ansible in the near future and also use molecule internal, so we would like to push this forward :)

@decentral1se
Copy link
Contributor Author

@LKaemmerling I'm glad Hetzner intend to use Molecule. I don't use Hetzner Cloud services as I did when I first started this work. So, I have no reason to continue to work on it since I won't use it for the forseeable future. Probably some paid staff from Hetzner can pick up this work and fight the CI issues.

@decentral1se
Copy link
Contributor Author

Also, Hetzner could just pay me.

@LKaemmerling
Copy link

@decentral1se would it be possible that you rerun the tests? I guess I have found something. We have set the Temporary Token Service to a max token lifetime of 60min. After this 60min all resources created will be destroyed. This could be a reason because I saw the last run takes ~1h 2 min. (https://travis-ci.com/ansible/molecule/jobs/215355197)

@ssbarnea
Copy link
Member

I propose making a fork and enabling travis with hertzner credentials and running on a daily cron, so we can see it works reliably enough.

@LKaemmerling
Copy link

I guess i have found the problem.

@decentral1se you said that the tests are working locally. I can confirm this. The tests on the CI fail because of the parallelism from travis.

You have something like the instance name (instance, instance-1 and instance-2) hardcoded. This will cause problems when running the same tests multiple times in parallel.

Because the modules work primarily with the instance name, you will have the following behavior when running the same tests in parallel. Hopefully, I can show it to you with the following sample:

Travis CI:
Job 1 (functional tests on Python 3.7): Started at 10:00
---> Will create server instance
---> Will work with this server
Job 2 (functional tests on Python 2.7): Started at 10:05
--> Will create server instance -->Attention: It will get the Server from Job1! (Because the name need to be unique and the ansible modules follow the idempotency principle)
--> Will work with this server
Job 1: At 10:20
--> All tests are done, will remove the server
--> Finished
Job 2: ERR! The server was removed, no connection (or another error)

As far as I see it, it is not a problem with our Hetzner Cloud, it is rather a problem with the CI and the errors only occur during these tests because we are the first cloud provider where the tests are done in the CI.

@decentral1se
Copy link
Contributor Author

There's our --parallel functionality and then there is also the Travis CI job parallelization. You've probably nailed the issue here. The solution might then be: isolate all hetzner functional tests and put them in a single job that only runs once (no parallel stuff at all on any layer). A fork is no solution IMHO. I'm not starting this unless @ssbarnea is OK with the proposed direction.

@ssbarnea
Copy link
Member

@decentral1se what kind of changes are you expecting? I am already scared about the current complexity related to sharding.

The reality is that we need to make resources unique for each travis job. Mainly the hertz driver should run even when running with "tox -p auto".

@decentral1se
Copy link
Contributor Author

decentral1se commented Jul 17, 2019

Perhaps we follow your direction, and a single cron job that runs nightly.

We do this "for now" and can at least see what is failing. Then the infrastructure will be in place when more CI resources are available to really lock it down. We keep the API keys and users to rely on real quality Q&A for the driver by keeping it available to use. Later, we get it running rock solid.

So, TLDR; an additional build in the cron job to run them all in serial execution. I will use a pytest marker to group them. At the end of the day, all the other drivers don't even run, so we'll be just as good as them.

Just thinking out loud ...

PS. Note to safe: some fix attempts over at https://github.com/LKaemmerling/molecule/commits/add-hetzner-driver to watch out for.

@decentral1se decentral1se reopened this Jul 17, 2019
@decentral1se decentral1se changed the title WIP WIP WIP Add Hetzner Cloud driver 🔥 WIP WIP WIP WIP WIP WIP Add Hetzner Cloud driver 🔥 Jul 17, 2019
@decentral1se decentral1se force-pushed the add-hetzner-driver branch 3 times, most recently from dfe8f05 to 38d3e5f Compare July 18, 2019 18:38
@decentral1se
Copy link
Contributor Author

OK, I've added fixes from @LKaemmerling and enabled the tests on only a single job (due to lack of CI resources. All the tests pass, see https://travis-ci.com/ansible/molecule/jobs/217346476). The CI is very unreliable right now, so I re-running the other jobs which failed for unrelated issues (that's off-topic for this PR). Can I get final reviews and then let's merge this.

@decentral1se decentral1se changed the title WIP WIP WIP WIP WIP WIP Add Hetzner Cloud driver 🔥 Add Hetzner Cloud driver Jul 19, 2019
@decentral1se decentral1se requested a review from themr0c July 19, 2019 21:00
@decentral1se
Copy link
Contributor Author

CI failing due to #2177 (unrelated).

@decentral1se
Copy link
Contributor Author

OK, final approach is then to #2191 and get a clean CI build here.

@decentral1se
Copy link
Contributor Author

@ssbarnea let's merge this, it's green 🔥 🔥 🔥

@ssbarnea ssbarnea merged commit 6c34d80 into ansible:master Aug 2, 2019
@ssbarnea ssbarnea added this to the 2.22 milestone Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add hetzner driver
6 participants