21 Commits

Author SHA1 Message Date
cefb8eba4d Added missing dgoss installation
All checks were successful
ci/woodpecker/push/build Pipeline was successful
2025-05-25 20:09:14 +00:00
1e54ba614a Corrected output path for dgoss command
Some checks failed
ci/woodpecker/push/build Pipeline failed
2025-05-25 20:05:49 +00:00
7469609600 Removed redundant quote around dgoss command
Some checks failed
ci/woodpecker/push/build Pipeline failed
2025-05-25 20:01:31 +00:00
b7a1fcfe49 Added double quotes around dgoss run command 2025-05-25 20:00:13 +00:00
a9743ecfbe Restored old procedure for Goss tests 2025-05-25 19:59:21 +00:00
76f33f50f5 Extended time to dockerd start
Some checks failed
ci/woodpecker/push/build Pipeline failed
2025-05-25 19:54:30 +00:00
203a81573d Added dockerd start in the background
Some checks failed
ci/woodpecker/push/build Pipeline failed
2025-05-25 19:43:19 +00:00
383e906102 Corrected image name
Some checks failed
ci/woodpecker/push/build Pipeline failed
2025-05-25 19:36:16 +00:00
e7330f07ee Returned to privileged mode
Some checks failed
ci/woodpecker/push/build Pipeline failed
2025-05-25 19:34:22 +00:00
c996be5953 Modified building step 2025-05-25 17:44:17 +00:00
bf60011948 Added double quotes around command to run Dgoss 2025-05-25 17:17:11 +00:00
82d5962020 Added steps to build, test and push docker image 2025-05-25 17:14:18 +00:00
1254b036f5 Added cd to api directory
All checks were successful
ci/woodpecker/push/build Pipeline was successful
2025-05-25 16:54:15 +00:00
6d84bf694e Added python tests to Woodpecker Workflow
Some checks failed
ci/woodpecker/push/build Pipeline failed
2025-05-25 16:43:44 +00:00
c2df9d136e Test first Woodpecker workflow
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
2025-05-25 16:19:25 +00:00
76a351710f Added variable APP_PORT to customize application port 2025-05-04 16:42:43 +00:00
c1f0da4a9c Extended Goss sleep 2025-05-04 15:37:47 +00:00
eefc952ff0 Updated app port in Goss YAML config 2025-05-04 15:26:21 +00:00
8c35b3bd8c Changed development server to production 2025-05-04 15:23:05 +00:00
60011b1c72 Added GOSS_SLEEP flag to wait for container full start before tests 2025-05-04 11:03:12 +00:00
859a962c12 Corrected python command name in Goss config YAML 2025-05-04 11:02:09 +00:00
5 changed files with 56 additions and 4 deletions

49
.woodpecker/build.yaml Normal file
View File

@ -0,0 +1,49 @@
when:
- event: push
branch: woodpecker
steps:
- name: code-tests
image: python:3.11.7-alpine
commands:
- cd api
- python3 -m venv env
- source env/bin/activate
- pip install -r requirements.txt pytest
- python3 -m pytest --junit-xml=pytest_junit.xml
- name: build
image: docker:dind
privileged: true
environment:
ACR_USERNAME: marcin00
ACR_PASSWORD:
from_secret: acr_password
commands:
- dockerd-entrypoint.sh &
- sleep 10 # czas na uruchomienie usługi Docker
- DOCKER_IMAGE=marcin00.azurecr.io/user-microservice:$CI_COMMIT_SHA
- echo "===> Building Docker image"
- docker build -t $DOCKER_IMAGE .
- echo "===> Installing bash"
- apk add --no-cache bash
- echo "===> Installing goss"
- wget https://github.com/aelsabbahy/goss/releases/latest/download/goss-linux-amd64 -O goss
- wget https://github.com/aelsabbahy/goss/releases/latest/download/dgoss -O dgoss
- chmod +x *goss
- echo "===> Starting container for test"
- export GOSS_OPTS="-f junit"
- export GOSS_PATH=./goss
- export GOSS_SLEEP=3
- "./dgoss run -e SQLALCHEMY_DATABASE_URI=sqlite:///:memory: $DOCKER_IMAGE > goss_junit.xml"
- echo "===> Logging in to ACR"
- echo "$ACR_PASSWORD" | docker login marcin00.azurecr.io -u $ACR_USERNAME --password-stdin
- echo "===> Pushing image to ACR"
- docker push $DOCKER_IMAGE

2
Jenkinsfile vendored
View File

@ -41,7 +41,7 @@ pipeline {
chmod +rx *goss
'''
withEnv(["GOSS_OPTS=-f junit", 'GOSS_PATH=./goss', "SQLALCHEMY_DATABASE_URI=sqlite:///:memory:"]) {
withEnv(['GOSS_OPTS=-f junit', 'GOSS_PATH=./goss', 'GOSS_SLEEP=3', 'SQLALCHEMY_DATABASE_URI=sqlite:///:memory:']) {
sh label: 'run image tests', script: './dgoss run -e SQLALCHEMY_DATABASE_URI=sqlite:///:memory: ${DOCKER_IMAGE} > goss_junit.xml'
}
}

View File

@ -61,5 +61,7 @@ def create_app(config_name="default"):
# Server start only if we run app directly
if __name__ == "__main__":
from waitress import serve
app = create_app()
app.run(host="0.0.0.0")
port = os.getenv("APP_PORT", "80")
serve(app, host="0.0.0.0", port=port)

View File

@ -11,4 +11,5 @@ mysql-connector-python==9.2.0
python-dotenv==1.0.0
SQLAlchemy==2.0.23
typing_extensions==4.8.0
waitress==3.0.2
Werkzeug==3.0.1

View File

@ -1,8 +1,8 @@
port:
tcp:5000:
tcp:80:
listening: true
ip:
- 0.0.0.0
process:
python:
python3:
running: true