Skip to content

Commit

Permalink
Jenkins
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmod committed Dec 16, 2024
1 parent e2b7c19 commit 03ce9cc
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 2 deletions.
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
deno 2.1.4
awscli 2.10.0
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM debian:latest

COPY --from=denoland/deno:bin-2.1.4 /deno /usr/local/bin/deno
RUN mkdir -p /.cache/deno && chmod a+rw -R /.cache/deno

COPY --from=amazon/aws-cli:2.10.0 /usr/local/aws-cli/ /usr/local/aws-cli/
ENV PATH="/usr/local/aws-cli/v2/current/bin:${PATH}"

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \
curl \
&& \
rm -rf /var/lib/apt/lists/* && \
rm -f /var/cache/apt/*.bin
41 changes: 41 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
pipeline {
agent none

options {
disableConcurrentBuilds()
timeout(unit: 'MINUTES', time: 10)
}

triggers {
cron('0,30 * * * *')
}

stages {
stage('deploy') {
agent {
dockerfile {
label 'docker'
filename 'Dockerfile'
}
}
environment {
// AWS = credentials('adblocker-filters-updater')
// SLACK_API_KEY = credentials('c2bd0cc1-529c-4c00-8aa3-c42327175376')
// BUNNY_API_KEY = credentials('b3af5886-714c-4ccf-8a5c-db120d60cf18')
AWS_REGION = 'us-east-1'
}
steps {
sh 'deno run config:generate'
sh 'cat config/v1.json'
sh '''deno run --allow-net --allow-write ./src/config/generate.ts'''
// sh 'curl -X POST -H "AccessKey: $BUNNY_API_KEY" "https://api.bunny.net/purge?async=false&url=https%3A%2F%2Fcdn.ghostery.com%2Fadblocker%2Fconfigs%2F%2A"'
// sh 'curl -X POST -H "AccessKey: $BUNNY_API_KEY" "https://api.bunny.net/purge?async=false&url=https%3A%2F%2Fcdn.ghostery.com%2Fadblocker%2F%2A%2Fmetadata.json"'
}
post{
failure{
sh 'curl -H "Authorization: Bearer $SLACK_API_KEY" https://slack.com/api/chat.postMessage -d "channel=C03M3895D71" -d "text=JOB FAILED: $JOB_NAME $BUILD_URL"'
}
}
}
}
}
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"tasks": {
"config:generate": "deno run --allow-net ./src/config/generate.ts",
"config:generate": "deno run --allow-net --allow-write ./src/config/generate.ts",
"build": "deno run -R -W ./src/build.js",
"lint": "deno fmt --check ./src ./test",
"tests": "deno test --allow-read"
},
"imports": {
"@std/path": "jsr:@std/path@^1.0.8",
"octokit": "npm:octokit@^4.0.2",
"tldts": "npm:tldts@^6.1.68"
}
Expand Down
2 changes: 2 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/config/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ for await (const { data: issues } of iterator) {
}
}

const configPath = path.join(import.meta.dirname!, "..", "..", "config");
await Deno.mkdir(configPath, { recursive: true });
await Deno.writeTextFile(
path.join(import.meta.dirname!, "..", "..", "config", "v1.json"),
path.join(configPath, "v1.json"),
JSON.stringify(config, null, 2)
);

Expand Down

0 comments on commit 03ce9cc

Please sign in to comment.