Skip to content

Bump node from 22.6.0-alpine to 23.5.0-alpine in /backend #4864

Bump node from 22.6.0-alpine to 23.5.0-alpine in /backend

Bump node from 22.6.0-alpine to 23.5.0-alpine in /backend #4864

Workflow file for this run

name: Build Bailo Image
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build_backend:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
# Clone repository
- uses: actions/checkout@v3
# Setup BuildX
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build backend image
uses: docker/build-push-action@v3
with:
context: backend
file: backend/Dockerfile
tags: bailo_backend:latest
cache-from: type=gha,scope=backend
cache-to: type=gha,mode=max,scope=backend
outputs: type=docker,dest=/tmp/bailo_backend.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bailo_backend
path: /tmp/bailo_backend.tar
build_frontend:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
# Clone repository
- uses: actions/checkout@v3
# Setup BuildX
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build frontend image
uses: docker/build-push-action@v3
with:
context: frontend
file: frontend/Dockerfile
tags: bailo_frontend:latest
cache-from: type=gha,scope=frontend
cache-to: type=gha,mode=max,scope=frontend
outputs: type=docker,dest=/tmp/bailo_frontend.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bailo_frontend
path: /tmp/bailo_frontend.tar
build_modelscan:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
# Clone repository
- uses: actions/checkout@v3
# Setup BuildX
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build modelscan image
uses: docker/build-push-action@v3
with:
context: lib/modelscan_api
file: lib/modelscan_api/Dockerfile
tags: bailo_modelscan:latest
cache-from: type=gha,scope=modelscan
cache-to: type=gha,mode=max,scope=modelscan
outputs: type=docker,dest=/tmp/bailo_modelscan.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bailo_modelscan
path: /tmp/bailo_modelscan.tar
unit_testing:
runs-on: ubuntu-latest
steps:
# Clone repository
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18.17.1
cache: "npm"
# Install dependencies
- run: npm ci
# Create certs
- run: sudo chown -R runner:docker backend/certs
- run: npm run certs
# Run unit tests
- run: npm run test
style:
runs-on: ubuntu-latest
steps:
# Clone repository
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18.17.1
cache: "npm"
# Install dependencies
- run: npm ci
# Run style checks
- run: npm run check-style
- run: npm run lint
kubernetes:
needs: [build_backend, build_frontend, build_modelscan]
runs-on: ubuntu-latest
steps:
# Clone repository
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18.17.1
cache: "npm"
# Setup BuildX
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Get Bailo Docker image
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: bailo_backend
path: /tmp
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: bailo_frontend
path: /tmp
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: bailo_modelscan
path: /tmp
- name: Start minikube
uses: medyagh/setup-minikube@master
- name: List Cluster
run: kubectl get pods -A
- name: Load docker image to minikube
run: |
eval $(minikube -p minikube docker-env)
docker load -i /tmp/bailo_backend.tar
docker load -i /tmp/bailo_frontend.tar
docker load -i /tmp/bailo_modelscan.tar
# Install dependencies
- run: npm ci
# Create certs
- run: sudo chown -R runner:docker backend/certs
- run: npm run certs
# Add bailo NodePort
- name: Create NodePort Config
run: |
cat << EOT >> infrastructure/helm/bailo/templates/nodePort.yaml
---
apiVersion: v1
kind: Service
metadata:
name: node-port
spec:
type: NodePort
ports:
- port: {{ .Values.nginxAuth.port }}
targetPort: {{ .Values.nginxAuth.port }}
selector:
name: nginx
EOT
# Create local.yaml
- name: Create local.yaml
run: |
cat << EOT >> infrastructure/helm/bailo/local.yaml
---
# Instance Settings
securityContext:
runAsUser: 1002
config:
ui:
banner:
enabled: "true"
text: "BAILO TEST"
build:
environment: img
# Bailo
image:
frontendRepository: "bailo_frontend"
frontendTag: latest
backendRepository: "bailo_backend"
backendTag: latest
modelscanRepository: "bailo_modelscan"
modelscanTag: latest
# Used for k8s not openshift
ingress:
enabled: false
route:
enabled: false
appPublicRoute: localhost
mongodb:
architecture: standalone
auth:
passwords:
- MongoDBPassword
usernames:
- bailo_user
EOT
- name: Set Bailo image pull policy to Never
run: sed -i 's/{{ .Values.image.pullPolicy }}/Never/g' infrastructure/helm/bailo/templates/bailo/bailo.deployment.yaml
- name: HELM update dependency update
working-directory: ./infrastructure/helm/bailo
run: helm dependency update
- name: HELM deploy to minikube
working-directory: ./infrastructure/helm/bailo
run: helm install --values ./local.yaml bailo .
- name: Sleep for 90 seconds
run: sleep 90s
shell: bash
- name: List Pods
run: kubectl get pods
- name: List Services
run: kubectl get services
- name: HELM test Bailo
working-directory: ./infrastructure/helm/bailo
run: helm test bailo
- name: Test Bailo URL
run: |
minikube service list
echo "---------------curl connect to bailo---------------"
curl $(minikube service node-port --url)
# Run Cypress integration tests
#- run: CYPRESS_BASE_URL=$(minikube service node-port --url) npm run cy:run
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots-k8s
path: cypress/screenshots
# - uses: actions/upload-artifact@v4
# if: always()
# with:
# name: cypress-videos
# path: cypress/videos
- name: Print application logs
if: always()
run: kubectl logs -l app.kubernetes.io/instance=bailo --tail=-1
end_to_end:
needs: [build_backend, build_frontend, build_modelscan]
runs-on: ubuntu-latest
steps:
# Clone repository
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18.17.1
cache: "npm"
# Setup BuildX
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Get Bailo Docker images
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: bailo_backend
path: /tmp
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: bailo_frontend
path: /tmp
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: bailo_modelscan
path: /tmp
- name: Load image
run: |
docker load --input /tmp/bailo_frontend.tar
docker load --input /tmp/bailo_backend.tar
docker load --input /tmp/bailo_modelscan.tar
docker image ls -a
rm -rf /tmp/bailo_frontend.tar /tmp/bailo_backend.tar /tmp/bailo_modelscan.tar
# Create logs directory
- run: mkdir logs
# Install dependencies
- run: npm ci
# Create certs
- run: sudo chown -R runner:docker backend/certs
- run: npm run certs
# Configure application
- name: Configure Bailo
run: |
cat <<EOT >> backend/config/local.cjs
module.exports = {
minio: {
accessKey: 'minioadmin',
secretKey: 'minioadmin',
},
smtp: {
auth: {
user: 'mailuser',
pass: 'mailpass',
},
tls: {
rejectUnauthorized: false,
},
},
logging: {
file: {
path: '/home/runner/work/Bailo/Bailo/logs/out.log',
},
},
}
EOT
- run: docker compose -f docker-compose-prod.yml up -d
# wait for app to start
- run: |
chmod +x ./backend/src/scripts/waitForIt.sh
./backend/src/scripts/waitForIt.sh localhost:8080 -t 10
# wait for mongo to start
- run: |
chmod +x ./backend/src/scripts/waitForIt.sh
./backend/src/scripts/waitForIt.sh localhost:27017 -t 10
- uses: cypress-io/github-action@v5
with:
wait-on: 'http://localhost:8080/api/v2/config/ui'
working-directory: ./frontend
install: false
spec: cypress/e2e/bailo/**/*
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots-e2e
path: frontend/cypress/screenshots
# - uses: actions/upload-artifact@v4
# if: always()
# with:
# name: cypress-videos
# path: cypress/videos
- name: Dump docker compose logs
if: always()
run: docker compose logs > logs/stack.log
- name: Docker Compose Logs
if: always()
run: cat logs/stack.log
- uses: actions/upload-artifact@v4
if: always()
with:
name: logs
path: logs
integration_python:
needs: [build_backend, build_frontend]
runs-on: ubuntu-latest
steps:
# Clone repository
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18.17.1
cache: "npm"
# Setup BuildX
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Get Bailo Docker images
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: bailo_backend
path: /tmp
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: bailo_frontend
path: /tmp
- name: Load image
run: |
docker load --input /tmp/bailo_frontend.tar
docker load --input /tmp/bailo_backend.tar
docker image ls -a
# Create logs directory
- run: mkdir logs
# Install dependencies
- run: npm ci
# Create certs
- run: sudo chown -R runner:docker backend/certs
- run: npm run certs
# Configure application
- name: Configure Bailo
run: |
cat <<EOT >> backend/config/local.cjs
module.exports = {
minio: {
accessKey: 'minioadmin',
secretKey: 'minioadmin',
},
smtp: {
auth: {
user: 'mailuser',
pass: 'mailpass',
},
tls: {
rejectUnauthorized: false,
},
},
logging: {
file: {
path: '/home/runner/work/Bailo/Bailo/logs/out.log',
},
},
}
EOT
- run: docker compose -f docker-compose-prod.yml up -d
# wait for app to start
- run: |
chmod +x ./backend/src/scripts/waitForIt.sh
./backend/src/scripts/waitForIt.sh localhost:8080 -t 10
# wait for mongo to start
- run: |
chmod +x ./backend/src/scripts/waitForIt.sh
./backend/src/scripts/waitForIt.sh localhost:27017 -t 10
# Setup python
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
cd lib/python
python -m pip install -e .[test]
# Run tests
- name: Test with pytest
run: |
cd lib/python
python -m pytest -m integration
- name: Dump docker compose logs
if: always()
run: docker compose logs > logs/stack.log
- name: Docker Compose Logs
if: always()
run: cat logs/stack.log
- uses: actions/upload-artifact@v4
if: always()
with:
name: python-logs
path: logs