Deffiss / testenvironment-docker

MIT License
117 stars 30 forks source link

Is it possible to run this on Azure Pipelines? #29

Open rasert opened 4 years ago

rasert commented 4 years ago

I would like to run this on Microsoft-hosted agent on Azure Pipelines. Is it possible?

jzabroski commented 4 years ago

@rasert Have you tried it yet?

jzabroski commented 4 years ago

As far as possible - maybe. But does it make sense? Azure Functions max runtime timeout is 10 minutes. Why would you do that? I'm curious because in my two projects I maintain, I get a decent amount of support requests for Azure Functions in scenarios where I would never expect AF to be used. The only thing that makes sense to me is that some high-level architect at a company mandated everyone use AF for everything.

Deffiss commented 4 years ago

@rasert So it is possible to use this library everywhere where you have an access to Docker. For example, I used it with GitlabCI (as Docker in Docker), Jenkins and AppVeyor. Theoretically, it might even work if you have Docker daemon exposed on a remote machine (but I didn't try this scenario yet, there might be some issues). The only thing that you need to supply is the address to Docker daemon. On Windows by default it is npipe://./pipe/docker_engine, on Linux unix:///var/run/docker.sock but you can expose it on tcp socket as well. BTW, we are going to migrate the existing build pipeline from AppVeyor to GitHub Actions and I believe it should work there as well.

jzabroski commented 4 years ago

BTW, I did more research on this and Azure Functions does seem to support running a docker container as an option. I guess in some ways that is superior to using Azure Functions directly.

See: https://medium.com/faun/running-azure-functions-in-a-docker-container-a-beginners-guide-f921c150eab4

What I'm not clear on is how this even works. How does azure functions environment settings like FUNCTION_EXTENSION_VERSION interplay with your docker image's runtime version?

dgvives commented 3 years ago

Just an update, Yes it is possible to run CI tests on Azure Pipelines. You need to generate images compatible with the build agent used on Azure Pipelines and made them available for the agent to download when executing tests on pipeline. I used docker hub for that and several images within a single manifest for local and CI/CD.

Container is created while executing tests and removed afterwards. Not the same as running an Azure Function within a container.

2020-12-18T15:32:24.5586699Z ##[group]Operating System
2020-12-18T15:32:24.5586916Z Microsoft Windows Server 2019
2020-12-18T15:32:24.5587089Z 10.0.17763
2020-12-18T15:32:24.5587215Z Datacenter
2020-12-18T15:32:24.5587350Z ##[endgroup]