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

[CI] enable nightly test runs #906

Merged
merged 1 commit into from
Nov 23, 2020
Merged

[CI] enable nightly test runs #906

merged 1 commit into from
Nov 23, 2020

Conversation

dpakach
Copy link
Contributor

@dpakach dpakach commented Nov 20, 2020

Fixes #895

Enable nightly test runs in CI.

.drone.star Outdated Show resolved Hide resolved
@phil-davis phil-davis self-requested a review November 20, 2020 04:25
@owncloud owncloud deleted a comment from update-docs bot Nov 20, 2020
.drone.star Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Nov 20, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@dpakach dpakach self-assigned this Nov 20, 2020
@dpakach dpakach marked this pull request as ready for review November 20, 2020 05:45
Copy link
Contributor

@phil-davis phil-davis left a comment

Choose a reason for hiding this comment

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

LGTM. We will only really know after merging.

@dpakach after I merge this, please

  • do a PR with [docs-only] to verify that it works as expected.
  • do a [tests-only] PR for something small, and we can verify that all pipelines run as expected in the CI of the PR
  • then merge something and see what happens to both the merge CI and the cron CI

@phil-davis phil-davis merged commit d1543f7 into master Nov 23, 2020
@delete-merged-branch delete-merged-branch bot deleted the enable-nightly-test branch November 23, 2020 05:30
ownclouders pushed a commit that referenced this pull request Nov 23, 2020
Merge: d5e889e 8d5b521
Author: Phil Davis <phil@jankaritech.com>
Date:   Mon Nov 23 11:15:49 2020 +0545

    Merge pull request #906 from owncloud/enable-nightly-test

    [CI] enable nightly test runs
@wkloucek
Copy link
Contributor

wkloucek commented Nov 23, 2020

I'm having problems with this line: if ctx.build.cron != "": It prevents me to convert the starlark to yml. Is there a reason you didn't use if ctx.build.event == "cron": ?

@phil-davis
Copy link
Contributor

phil-davis commented Nov 23, 2020

We found a post where the build.cron attribute was "documented". https://discourse.drone.io/t/starlark-context-not-have-some-detailed-info/6087/2

The source code https://github.com/drone/drone-convert-starlark/blob/master/plugin/args.go has cron as one of the attributes, and it should be a starlark.String

I guess drone is a nerd-project - the source code is the documentation.

But locally I get the error:

$ drone starlark
2020/11/23 15:06:05 "build" struct has no .cron attribute

I guess my local drone does not have the current drone-convert-starlark

@dpakach
Copy link
Contributor Author

dpakach commented Nov 23, 2020

@phil-davis seems like only these attributes are available when converting

"context"(build = "build"(branch = "master", commit = "", event = "push", message = "", ref = "refs/heads/master", source = "", target = ""), repo = "repo"(name = "", namespace = "", slug = ""))

@dpakach
Copy link
Contributor Author

dpakach commented Nov 23, 2020

@wkloucek, I think in this case your approach works better,
Please review this PR #923

@wkloucek
Copy link
Contributor

Yeah, finding reliable information on drone is really cumbersome. The main issue for me is, that I can not convert to yml anymore.

Are you ok with using if ctx.build.event == "cron": as long as we don't specify cron names? It think this is what the build.cron should contain!?

We also could make a PR to @micbar because he is already "maintaining" a working drone cli micbar/drone-cli@f0e9e08

@phil-davis
Copy link
Contributor

After installing the latest drone-cli:

$ curl -L https://github.com/drone/drone-cli/releases/latest/download/drone_linux_amd64.tar.gz | tar zx
$ sudo install -t /usr/local/bin drone
$ drone --version
drone version 1.2.4

I get:

$ drone starlark
2020/11/23 15:21:10 starlark evaluation error:
Traceback (most recent call last):
  .drone.star:201:15: in main
Error: "build" struct has no .cron attribute

So at least the error message has more information.

I wonder how I install the latest drone-convert-starlark as a plugin to drone-cli?

@phil-davis
Copy link
Contributor

https://github.com/drone/drone-cli/blob/master/drone/starlark/starlark.go

There is "starlark" knowledge built-in to the drone-cli repo. And that only has a subset of the ctx attributes that are available in the extension. Code-duplication - I guess the drone-cli stuff could have the other attributes added and maybe they will "just work".

@micbar
Copy link
Contributor

micbar commented Nov 23, 2020

see harness/drone-cli#175

@phil-davis
Copy link
Contributor

phil-davis commented Nov 23, 2020

Also note for future readers.
https://github.com/owncloud/activity/blob/master/.drone.star#L969

								if (params['cron'] == ''):
									result['trigger']['ref'] = [
										'refs/pull/**',
										'refs/tags/**'
									]
									for branch in config['branches']:
										result['trigger']['ref'].append('refs/heads/%s' % branch)
								else:
									result['trigger']['cron'] = params['cron']

We have starlark code that allows pipelines to trigger on a specific "cron" value. At the moment the relevant repos just have a "nightly" cron job. And the starlark correctly generates pipelines that run only nightly - they do not run with every PR.

So that stuff does work on the drone server, and we could potentially have some special tests that run only for cron "weekly" etc.

That parses OK with local drone starlark and includes pipelines that have a section like:

trigger:
  cron:
  - nightly

So the local drone-cli know enough to allow that (or doesn't try hard enough to parse it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

setup nightly runs of tests
4 participants