Parcourir la source

Release/1.5.0 (#488)

Nicolas Meienberger il y a 2 ans
Parent
commit
b972f7b6e8

+ 10 - 5
.github/workflows/e2e.yml

@@ -2,8 +2,7 @@ name: E2E Tests
 
 on:
   workflow_dispatch:
-  pull_request:
-    types: [opened, synchronize, reopened]
+  push:
     branches:
       - release/*
 
@@ -94,16 +93,22 @@ jobs:
       - name: Wait 1 minute for Droplet to be ready
         run: sleep 60
 
+      - name: Extract branch name from ref
+        id: extract-branch-name
+        run: |
+          branch_name=$(echo ${{ github.ref }} | sed 's/refs\/heads\///')
+          echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
+
       - name: Deploy app to Droplet
         uses: fifsky/ssh-action@master
         with:
           command: |
             echo 'Cloning repo on branch ${{ github.head_ref }}'
-            git clone --single-branch --branch ${{ github.head_ref }} https://github.com/${{ github.repository }}
+            git clone --single-branch --branch ${{ steps.extract-branch-name.outputs.branch_name }} https://github.com/${{ github.repository }}
             echo 'Waiting for dpkg lock to be released'
             cd runtipi
-            echo 'Checking out branch ${{ github.head_ref }}'
-            git checkout ${{ github.head_ref }}
+            echo 'Checking out branch ${{ steps.extract-branch-name.outputs.branch_name }}'
+            git checkout ${{ steps.extract-branch-name.outputs.branch_name }}
             sudo ./scripts/start-e2e.sh e2e
             echo 'App deployed'
           host: ${{ steps.get-droplet-ip.outputs.droplet_ip }}

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "runtipi",
-  "version": "1.4.2",
+  "version": "1.5.0",
   "description": "A homeserver for everyone",
   "scripts": {
     "copy:migrations": "mkdir -p dist/migrations && cp -r ./src/server/migrations dist",

+ 5 - 0
src/server/services/apps/apps.helpers.ts

@@ -255,6 +255,11 @@ const renderTemplate = (template: string, envMap: Map<string, string>) => {
 export const copyDataDir = async (id: string) => {
   const envMap = getEnvMap(id);
 
+  const appDataDirExists = (await fs.promises.lstat(`/runtipi/apps/${id}/data`).catch(() => false)) as fs.Stats;
+  if (!appDataDirExists || !appDataDirExists.isDirectory()) {
+    return;
+  }
+
   const dataDir = await fs.promises.readdir(`/runtipi/apps/${id}/data`);
 
   const processFile = async (file: string) => {

+ 1 - 0
src/server/services/apps/apps.service.test.ts

@@ -259,6 +259,7 @@ describe('Install app', () => {
   it('should copy and replace env variables in deeply nested .templates files in data folder', async () => {
     // arrange
     const appConfig = createAppConfig({ form_fields: [{ env_variable: 'TEST', type: 'text', label: 'test', required: true }] });
+    await fs.promises.writeFile(`/runtipi/apps/${appConfig.id}/data/test.txt.template`, 'test {{TEST}}');
     await fs.promises.mkdir(`/runtipi/apps/${appConfig.id}/data/test`);
     await fs.promises.mkdir(`/runtipi/apps/${appConfig.id}/data/test/test`);
     await fs.promises.writeFile(`/runtipi/apps/${appConfig.id}/data/test/test/test.txt.template`, 'test {{TEST}}');