Whether Drone support configuring timeout value for build

3.8k views Asked by At

I setup a local drone server for our CI. And our project is a java project managed by maven. When run the mvn clean install command, maven will download all dependencies into ~/.m2 directory. The first time run this command will download a huge of data from maven remote repository which may take a very long time. In this case, I got below error on drone CI.

ERROR: terminal inactive for 15m0s, build cancelled

I understand that this message means there is no output on the console for 15 minutes. But it is a normal case in my build environment. I wander whether I can configure the 15m to be a larger value so I can build our project.

2

There are 2 answers

7
Brad Rydzewski On BEST ANSWER

My previous answer is outdated. You can now change the default timeout for each individual repository from the repository settings screen. This setting is only available to system administrators.


You can increase the terminal inactive timeout by passing DRONE_TIMEOUT=<duration> to each of your agents.

docker run -e DRONE_TIMEOUT=15m drone/drone:0.5 agent

The timeout value may be any valid Go duration string [1].

# 30 minute timeout
DRONE_TIMEOUT=30m

# 1 hour timeout
DRONE_TIMEOUT=1h

# 1 hour, 30 minute timeout
DRONE_TIMEOUT=1h30m

[1] https://golang.org/pkg/time/#ParseDuration

0
Senkwich On

Looking at the drone source code, it looks like they have environment variables DRONE_TIMEOUT and DRONE_TIMEOUT_INACTIVITY that you can use to configure the inactivity timeout. I tried putting it in my .drone.yml file and it didn't seem to do anything, so this may only be available at a higher level.

Here is the reference to the environment variable DRONE_TIMEOUT_INACTIVITY: https://github.com/drone/drone/blob/17e5eb50363f3fcdc0a0461162bee93041d600b7/drone/exec.go#L62

Here is the reference to the environment variable DRONE_TIMEOUT: https://github.com/drone/drone/blob/eee4fd1fd2556ac9e4115c746ce785c7364a6f12/drone/agent/agent.go#L95

Here is where the error is thrown: https://github.com/drone/drone/blob/5abb5de44aa11ea546db1d3846d603eacef7f0d9/agent/agent.go#L206