fac / fa-harness-tools Goto Github PK
View Code? Open in Web Editor NEWTools and preflight checks for deployments with Harness.io
License: Apache License 2.0
Tools and preflight checks for deployments with Harness.io
License: Apache License 2.0
Specs ought to be running on a CI platform - could use GitHub Actions even, or Circle/TravisCI.
The check-forward-deploy check (and probably check-recent-deploy) is very slow when operating on a repo with over 16,000 tags, taking about 10 minutes.
It tries to determine the last deployment tag for the environment:
fa-harness-tools/lib/fa-harness-tools/check_forward_deploy.rb
Lines 19 to 20 in 2df0cb6
However this relies on loading all tags from the GitHub API with pagination and filtering them by prefix:
fa-harness-tools/lib/fa-harness-tools/github_client.rb
Lines 25 to 28 in 2df0cb6
We need a more optimised way of finding the latest deployment tag. Possibly:
deploy-production
prefixed tags.The output from the commands is particularly unfriendly and should be easier to read in a hurry. I had copied it from our previous pre-flight checks, but I don't think there's any reason to keep it that way.
Example output:
INFO 2019-11-27 09:10:33 scheduled deploy time
INFO 2019-11-27 09:10:33 master contains 6b252b906102b869add9843017892083e9519ef0
ERROR 2019-11-27 09:12:07 6b252b906102b869add9843017892083e9519ef0 is prior to no.3 most recent commit with "harness-deploy" tag
It would be better if each check could output its name and description/purpose, so it's easier to see which check is generating which bit of the output.
The messages should then help explain what it's checking for, which versions/commits it's using for the check (as debug) and a clearer description of what's wrong and what the user might do about it.
The GithubClient#is_ancestor_of?
method is very slow to fail on a repo with a lot of history. This is noticeable when a check-recent-deploy
or check-forward-deploy
check is going to fail - but it's OK and fast in the usual successful case.
Its purpose is to find whether commit X includes commit Y (the ancestor) in its history. It does this by loading commits from X and working backwards, looking for Y. In the normal case it's going to finish quickly as there are unlikely to have been many commits since the last deployment. In the negative case then it has to load every commit from X back to the root of the repo history.
It could be optimised to only look at commits within a certain timeframe, or only a certain number of commits (though it would be a problem after merging many new commits). It might also be possible to get a more direct answer from the GitHub API about whether two commits are related.
The GithubClient class needs some spec coverage. Perhaps via VCR or similar stubbing method for GitHub, or integration tests against a real GitHub repo.
check-schedule
is mostly hardcoded behaviour and should be more configurable:
--schedule "* 9-15 * * mon-thu" --schedule "* 9-11 * * fri"
The OAuth token is optional really, it's only necessary for private repo access. The command line tools shouldn't require it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.