Skip to content

Correcciones: Permisos de ejecución a boxfuse #70

Correcciones: Permisos de ejecución a boxfuse

Correcciones: Permisos de ejecución a boxfuse #70

Workflow file for this run

name: Build Push/PR - Master
on:
push:
branches: [ "master" ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Compile with Maven
run: mvn -B compile --file pom.xml
- name: Test
run: mvn -B test --file pom.xml
- name: Report results to DeepSource
if: ${{ github.event_name != 'pull_request' }}
run: |
# Install deepsource CLI
curl https://deepsource.io/cli | sh
# From the root directory, run the report coverage command
./bin/deepsource report --analyzer test-coverage --key java --value-file ./target/site/jacoco/jacoco.xml
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Compile with Maven
run: mvn -B package --file pom.xml -DskipTests
- name: Install CloudCaptain CLI
run: |
curl https://files.cloudcaptain.sh/com/boxfuse/client/boxfuse-commandline/1.33.0.1460/boxfuse-commandline-1.33.0.1460-linux-x64.tar.gz -o boxfuse-commandline-1.33.0.1460-linux-x64.tar.gz
tar -xzf boxfuse-commandline-1.33.0.1460-linux-x64.tar.gz
echo "${PWD}/boxfuse" >> $GITHUB_PATH
chmod +x ${PWD}/boxfuse/boxfuse
boxfuse -v
- name: Write to config file
run: |
FILE_NAME="${PWD}/boxfuse/conf/boxfuse.conf"
echo "healthcheck=false" > $FILE_NAME
echo "ports.http=80" >> $FILE_NAME
echo "env=prod" >> $FILE_NAME
echo "logs.auto=false" >> $FILE_NAME
echo "logs.boot=false" >> $FILE_NAME
echo "components.openjdk=21.0.3" >> $FILE_NAME
echo "user=${{ secrets.BOXFUSE_USER }}" >> $FILE_NAME
echo "secret=${{ secrets.BOXFUSE_SECRET }}" >> $FILE_NAME
echo "envvars.MYSQL_PASSWORD=${{ secrets.MYSQL_PASSWORD }}" >> $FILE_NAME
echo "envvars.DATASOURCE_MYSQL_URL=${{ secrets.DATASOURCE_MYSQL_URL }}" >> $FILE_NAME
echo "envvars.MYSQL_USER=${{ secrets.MYSQL_USER }}" >> $FILE_NAME
echo "envvars.APP_SECURITY_JWT_SECRET=${{ secrets.APP_SECURITY_JWT_SECRET }}" >> $FILE_NAME
echo "envvars.FLYWAY_DEFAULT_SCHEMA=${{ secrets.FLYWAY_DEFAULT_SCHEMA }}" >> $FILE_NAME
echo "Secrets stored safely."
- name: Fuses a Payload together with the Components it requires into an Image
run: |
DATE=$(date +'%d%m%Y')
RESULT=$(boxfuse fuse ${PWD}/target/despensa-rest-api.war -image=despensa-rest-api:0.0.1.$DATE | awk '/ERROR/{print $1}' | sed 's/://')
if [ "$RESULT" == "ERROR" ]; then
echo "Error fusing Image."
exit 1
fi
- name: Removes the last Image from the CloudCaptain Vault
run: |
TOTAL=$(boxfuse ls -vault=true | awk '/Total:/ {print $2}')
echo "Total: $TOTAL"
if [ "$TOTAL" -eq 3 ]; then
IMAGE=$(boxfuse ls -vault=true | grep -o '| [^/]*/despensa-rest-api:0.0.1.[^|]*' | sed 's/^| //' | head -n 1)
RESULT=$(boxfuse rm $IMAGE -vault=true | awk '/ERROR/{print $1}' | sed 's/://')
if [ "$RESULT" == "ERROR" ]; then
echo "Error removing Image."
exit 1
fi
echo "Removed Image."
else
echo "No need to remove an Image."
fi
- name: Pushes this Image to the CloudCaptain Vault
run: |
DATE=$(date +'%d%m%Y')
RESULT=$(boxfuse push despensa-rest-api:0.0.1.$DATE | awk '/ERROR/{print $1}' | sed 's/://')
if [ "$RESULT" == "ERROR" ]; then
echo "Error pushing Image."
exit 1
fi
- name: Run the Image Instance in the AWS environment
run: |
DATE=$(date +'%d%m%Y')
RESULT=$(boxfuse run despensa-rest-api:0.0.1.$DATE | awk '/ERROR/{print $1}' | sed 's/://')
if [ "$RESULT" == "ERROR" ]; then
echo "Error running Image."
exit 1
fi
- name: Clean up secrets file
run: rm -f ${PWD}/boxfuse/conf/boxfuse.conf