Compare commits
5 Commits
6a90b91f3a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5124b13e59 | |||
| 9d3b41f338 | |||
| 5e4a63af9c | |||
| cbc3cc26ed | |||
| a066142307 |
8
.groovylintrc.json
Normal file
8
.groovylintrc.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extends": "recommended",
|
||||||
|
"rules": {
|
||||||
|
"NestedBlockDepth": {
|
||||||
|
"enabled": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
FROM python:3.10-alpine
|
FROM python:3.10-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app/
|
||||||
ENV PYTHONIOENCODING=utf-8
|
ENV PYTHONIOENCODING=utf-8
|
||||||
|
|
||||||
COPY Pipfile Pipfile.lock everybody.txt tweetbot.py /app
|
COPY Pipfile Pipfile.lock everybody.txt tweetbot.py /app/
|
||||||
|
|
||||||
# Install pipenv and compilation dependencies
|
# Install pipenv and compilation dependencies
|
||||||
RUN pip install pipenv && pipenv install --deploy --ignore-pipfile
|
RUN pip install pipenv && pipenv install --deploy --ignore-pipfile
|
||||||
|
|||||||
95
Jenkinsfile
vendored
Normal file
95
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
pipeline {
|
||||||
|
agent none
|
||||||
|
|
||||||
|
environment {
|
||||||
|
HOME = "${env.WORKSPACE}"
|
||||||
|
PYTHON_IMAGE = 'python:3.10-slim-bullseye'
|
||||||
|
CREDENTIALS_ID = 'digital-ocean-ailuridae-registry'
|
||||||
|
REGISTRY = 'https://registry.digitalocean.com'
|
||||||
|
IMAGE_NAME = 'registry.digitalocean.com/ailuridae-registry/ailuridae.io/everybodymov'
|
||||||
|
IMAGE_BUILD = ''
|
||||||
|
APP_ID = credentials('digital-ocean-app-id')
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Check') {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image env.PYTHON_IMAGE
|
||||||
|
args '--rm'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
sh 'python -m pip install --no-cache-dir --upgrade --user pip'
|
||||||
|
sh 'python -m pip install --no-cache-dir --user pipenv'
|
||||||
|
sh 'python -m pipenv install --dev --deploy'
|
||||||
|
sh 'python -m pipenv check --clear'
|
||||||
|
sh 'python -m pipenv run bandit *.py'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Build') {
|
||||||
|
agent {
|
||||||
|
label 'main'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
IMAGE_BUILD = docker.build("${IMAGE_NAME}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Publish') {
|
||||||
|
agent {
|
||||||
|
label 'main'
|
||||||
|
}
|
||||||
|
when {
|
||||||
|
branch 'main'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
// withCredentials is annoyingly required to mask token occurrences.
|
||||||
|
withCredentials([usernamePassword(
|
||||||
|
credentialsId: env.CREDENTIALS_ID,
|
||||||
|
usernameVariable: 'API_TOKEN_USER',
|
||||||
|
passwordVariable: 'API_TOKEN_PASS'
|
||||||
|
)]) {
|
||||||
|
docker.withRegistry(env.REGISTRY, env.CREDENTIALS_ID) {
|
||||||
|
IMAGE_BUILD.push("${BUILD_NUMBER}")
|
||||||
|
IMAGE_BUILD.push('latest')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Deploy') {
|
||||||
|
agent {
|
||||||
|
label 'main'
|
||||||
|
}
|
||||||
|
when {
|
||||||
|
branch 'main'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
withCredentials([usernamePassword(
|
||||||
|
credentialsId: env.CREDENTIALS_ID,
|
||||||
|
usernameVariable: 'API_TOKEN_USER',
|
||||||
|
passwordVariable: 'API_TOKEN_PASS'
|
||||||
|
)]) {
|
||||||
|
sh '''
|
||||||
|
curl -H "Authorization: Bearer $API_TOKEN_PASS" -H "Content-Type: application/json" \
|
||||||
|
-X POST "https://api.digitalocean.com/v2/apps/$APP_ID/deployments" \
|
||||||
|
-d "{ \\"force_build\\" : true }"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
node('main') {
|
||||||
|
cleanWs()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Pipfile.lock
generated
2
Pipfile.lock
generated
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "3dc4c0a387fc9c5280d0dbfadae8f3d7cac3ddf589af5ec78dfe7090ff2684f2"
|
"sha256": "e7a1785570cb6182573b0e15cae2ad2c86adb2c280e88ceaa9126c232b720c9c"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
|||||||
Reference in New Issue
Block a user