-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
281 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
#!/bin/bash | ||
git clone https://opendev.org/jjb/jenkins-job-builder.git | ||
cd jenkins-job-builder | ||
cd jenkins-job-builder || exit 1 | ||
virtualenv .venv | ||
# shellcheck disable=SC1091 | ||
source .venv/bin/activate | ||
pip install -r test-requirements.txt -e . | ||
python jenkins_jobs/__main__.py --user tvm-bot --password $1 --conf "/home/ubuntu/jenkins-jobs/$2/jenkins_jobs.ini" update "/home/ubuntu/jenkins-jobs/$2" | ||
python jenkins_jobs/__main__.py --user tvm-bot --password "$1" --conf "/home/ubuntu/jenkins-jobs/$2/jenkins_jobs.ini" update "/home/ubuntu/jenkins-jobs/$2" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
#!/bin/bash | ||
# shellcheck disable=SC2129 | ||
|
||
echo "ENVIRONMENT=prod" >> $GITHUB_ENV | ||
echo "STATE_PATH=tvm-ci-prod" >> $GITHUB_ENV | ||
echo "OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID_PROD}" >> $GITHUB_ENV | ||
echo "OAUTH_CLIENT_SECRET=${OAUTH_CLIENT_SECRET_PROD}" >> $GITHUB_ENV | ||
echo "ENVIRONMENT=prod" >> "$GITHUB_ENV" | ||
echo "STATE_PATH=tvm-ci-prod" >> "$GITHUB_ENV" | ||
echo "OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID_PROD}" >> "$GITHUB_ENV" | ||
echo "OAUTH_CLIENT_SECRET=${OAUTH_CLIENT_SECRET_PROD}" >> "$GITHUB_ENV" | ||
|
||
echo 'JENKINS_PRIV_KEY<<EOF' >> $GITHUB_ENV | ||
echo "$JENKINS_PRIV_KEY_PROD" >> $GITHUB_ENV | ||
echo 'EOF' >> $GITHUB_ENV | ||
export JENKINS_PRIV_KEY=$JENKINS_PRIV_KEY_PROD | ||
echo 'JENKINS_PRIV_KEY<<EOF' >> "$GITHUB_ENV" | ||
echo "$JENKINS_PRIV_KEY_PROD" >> "$GITHUB_ENV" | ||
echo 'EOF' >> "$GITHUB_ENV" | ||
export JENKINS_PRIV_KEY="$JENKINS_PRIV_KEY_PROD" | ||
|
||
echo "JENKINS_PUB_KEY=$(ssh-keygen -yf /dev/stdin <<<$JENKINS_PRIV_KEY)" >> $GITHUB_ENV | ||
# shellcheck disable=SC2086 | ||
echo "JENKINS_PUB_KEY=$(ssh-keygen -yf /dev/stdin <<<$JENKINS_PRIV_KEY)" >> "$GITHUB_ENV" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import argparse | ||
import os | ||
|
||
import jenkins | ||
import argparse | ||
|
||
USER = os.environ["JENKINS_USER"] | ||
PW = os.environ["JENKINS_PW"] | ||
|
||
|
||
def add_fork_trust_plugin(xml: str) -> str: | ||
nobody = '<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustNobody"/>' | ||
some_people = '<trust class="org.jenkinsci.plugins.githubScmTraitNotificationContext.ForkPullRequestDiscoveryTrait$TrustSomePeople" plugin="[email protected]"/>' | ||
some_people = ( | ||
'<trust class="org.jenkinsci.plugins.githubScmTraitNotificationContext.' | ||
'ForkPullRequestDiscoveryTrait$TrustSomePeople" plugin="[email protected]"/>' | ||
) | ||
return xml.replace(nobody, some_people) | ||
|
||
|
||
|
@@ -28,7 +32,7 @@ def test(): | |
) | ||
parser.parse_args() | ||
|
||
server = jenkins.Jenkins("https://ci.tlcpack.ai", username=USER, password=PW) | ||
server = jenkins.Jenkins("https://ci.tlcpack.ai", username=USER, password=PW) # type: ignore[attr-defined] | ||
jobs = server.get_jobs() | ||
|
||
to_update = [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
import subprocess | ||
import argparse | ||
from pathlib import Path | ||
|
||
env = { | ||
"SUPPRESS_POSSUM": "true", | ||
"RUN_LOCAL": "true", | ||
"USE_FIND_ALGORITHM": "true", | ||
"LOG_LEVEL": "VERBOSE", | ||
} | ||
|
||
validators = { | ||
"VALIDATE_ANSIBLE", | ||
"VALIDATE_ARM", | ||
"VALIDATE_BASH", | ||
"VALIDATE_BASH_EXEC", | ||
"VALIDATE_CPP", | ||
"VALIDATE_CLANG_FORMAT", | ||
"VALIDATE_CLOJURE", | ||
"VALIDATE_CLOUDFORMATION", | ||
"VALIDATE_COFFEESCRIPT", | ||
"VALIDATE_CSHARP", | ||
"VALIDATE_CSS", | ||
"VALIDATE_DART", | ||
"VALIDATE_DOCKERFILE_HADOLINT", | ||
"VALIDATE_EDITORCONFIG", | ||
"VALIDATE_ENV", | ||
"VALIDATE_GHERKIN", | ||
"VALIDATE_GITHUB_ACTIONS", | ||
"VALIDATE_GITLEAKS", | ||
"VALIDATE_GO", | ||
"VALIDATE_GOOGLE_JAVA_FORMAT", | ||
"VALIDATE_GROOVY", | ||
"VALIDATE_HTML", | ||
"VALIDATE_JAVA", | ||
"VALIDATE_JAVASCRIPT_ES", | ||
"VALIDATE_JAVASCRIPT_STANDARD", | ||
"VALIDATE_JSCPD", | ||
"VALIDATE_JSON", | ||
"VALIDATE_JSX", | ||
"VALIDATE_KOTLIN", | ||
"VALIDATE_KOTLIN_ANDROID", | ||
"VALIDATE_KUBERNETES_KUBECONFORM", | ||
"VALIDATE_LATEX", | ||
"VALIDATE_LUA", | ||
"VALIDATE_MARKDOWN", | ||
"VALIDATE_NATURAL_LANGUAGE", | ||
"VALIDATE_OPENAPI", | ||
"VALIDATE_PERL", | ||
"VALIDATE_PHP", | ||
"VALIDATE_PHP_BUILTIN", | ||
"VALIDATE_PHP_PHPCS", | ||
"VALIDATE_PHP_PHPSTAN", | ||
"VALIDATE_PHP_PSALM", | ||
"VALIDATE_POWERSHELL", | ||
"VALIDATE_PROTOBUF", | ||
"VALIDATE_PYTHON", | ||
"VALIDATE_PYTHON_BLACK", | ||
"VALIDATE_PYTHON_FLAKE8", | ||
"VALIDATE_PYTHON_ISORT", | ||
"VALIDATE_PYTHON_MYPY", | ||
"VALIDATE_PYTHON_PYLINT", | ||
"VALIDATE_R", | ||
"VALIDATE_RAKU", | ||
"VALIDATE_RUBY", | ||
"VALIDATE_RUST_2015", | ||
"VALIDATE_RUST_2018", | ||
"VALIDATE_RUST_2021", | ||
"VALIDATE_RUST_CLIPPY", | ||
"VALIDATE_SCALAFMT", | ||
"VALIDATE_SHELL_SHFMT", | ||
"VALIDATE_SNAKEMAKE_LINT", | ||
"VALIDATE_SNAKEMAKE_SNAKEFMT", | ||
"VALIDATE_STATES", | ||
"VALIDATE_SQL", | ||
"VALIDATE_SQLFLUFF", | ||
"VALIDATE_TEKTON", | ||
"VALIDATE_TERRAFORM_FMT", | ||
"VALIDATE_TERRAFORM_TERRASCAN", | ||
"VALIDATE_TERRAFORM_TFLINT", | ||
"VALIDATE_TERRAGRUNT", | ||
"VALIDATE_TSX", | ||
"VALIDATE_TYPESCRIPT_ES", | ||
"VALIDATE_TYPESCRIPT_STANDARD", | ||
"VALIDATE_XML", | ||
"VALIDATE_YAML", | ||
} | ||
|
||
# To fix | ||
# BASH:[14] | ||
# DOCKERFILE_HADOLINT:[2] | ||
# PYTHON_PYLINT:[4] | ||
# PYTHON_FLAKE8:[17] | ||
# PYTHON_ISORT:[25] | ||
# PYTHON_MYPY:[13] | ||
# TERRAFORM_TFLINT:[8] | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--dir", default=".") | ||
parser.add_argument("--image", default="github/super-linter:latest") | ||
parser.add_argument("-l", "--lint", default="") | ||
args = parser.parse_args() | ||
volume = Path(args.dir).resolve() | ||
cmd = ["docker", "run", "-v", f"{volume}:/tmp/lint"] | ||
|
||
linters = [x.strip() for x in args.lint.split(",") if x.strip() != ""] | ||
|
||
for key, value in env.items(): | ||
cmd.append("-e") | ||
cmd.append(f"{key}={value}") | ||
|
||
for validator in validators: | ||
if not any(linter.lower() in validator.lower() for linter in linters): | ||
cmd.append("-e") | ||
cmd.append(f"{validator}=false") | ||
|
||
cmd.append(args.image) | ||
p = subprocess.run(cmd) | ||
exit(p.returncode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.