From e7e46b7767e41438d9ee15c2e2ff68d9ff2039b3 Mon Sep 17 00:00:00 2001 From: Mirko Van Colen Date: Tue, 24 Sep 2024 12:26:42 +0200 Subject: [PATCH 01/13] remove unused requires --- server/src/models/schema.model.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/server/src/models/schema.model.js b/server/src/models/schema.model.js index 4e51f1d3..94d301f1 100644 --- a/server/src/models/schema.model.js +++ b/server/src/models/schema.model.js @@ -1,12 +1,9 @@ 'use strict'; -const bcrypt = require('bcrypt'); const logger=require("../lib/logger"); const mysql = require("./db.model") -const Helpers = require("../lib/common") const appConfig = require('../../config/app.config') const fs = require('fs'); const NodeCache = require("node-cache"); -const { check } = require('./ldap.model'); const cache = new NodeCache({ stdTTL: 14400, From 26acd6f3afe2ff763f277cc14fc7da93cf42c949 Mon Sep 17 00:00:00 2001 From: Mirko Van Colen Date: Tue, 24 Sep 2024 12:27:01 +0200 Subject: [PATCH 02/13] fall back to production --- server/src/configure.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/configure.js b/server/src/configure.js index e68f9eaf..1aecf4a3 100644 --- a/server/src/configure.js +++ b/server/src/configure.js @@ -1,6 +1,6 @@ // load the .env.development file ; it loads a bunch of environment variables // we are not doing this for production, where the variables are coming from the actual environment -if (process.env.NODE_ENV !== 'production' || process.env.FORCE_DOTENV==1 || process.env.FORCE_DOTENV=="1" ){ +if ((process.env.NODE_ENV || "production") !== 'production' || process.env.FORCE_DOTENV==1 || process.env.FORCE_DOTENV=="1" ){ console.log(`Importing .env file : ${__dirname}/../.env.${process.env.NODE_ENV}` ) require('dotenv').config({ path: `${__dirname}/../.env.${process.env.NODE_ENV}` }) } From a654c62c7b70be9e3c3c859b232fa28857a392ca Mon Sep 17 00:00:00 2001 From: Mirko Van Colen Date: Tue, 24 Sep 2024 12:27:16 +0200 Subject: [PATCH 03/13] new debian docker file --- server/Dockerfile-debian | 111 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 server/Dockerfile-debian diff --git a/server/Dockerfile-debian b/server/Dockerfile-debian new file mode 100644 index 00000000..51201680 --- /dev/null +++ b/server/Dockerfile-debian @@ -0,0 +1,111 @@ +# take latest debian image as base +FROM debian as debianbase + +# Use /app as CWD +WORKDIR /app + +# apt update +RUN apt update +RUN apt upgrade + +# install basics +RUN apt install -y wget curl tzdata software-properties-common gnupg gnupg1 gnupg2 + +# add ansible repository +RUN wget -O - "https://keyserver.ubuntu.com/pks/lookup?fingerprint=on&op=get&search=0x6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367" | gpg --dearmour -o /usr/share/keyrings/ansible-archive-keyring.gpg +RUN UBUNTU_CODENAME=jammy && echo "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu jammy main" | tee /etc/apt/sources.list.d/ansible.list +RUN apt update +RUN apt upgrade + +# install ansible +RUN apt install -y ansible + +# install npm # node package manager +RUN apt install -y npm + +# install nvm # node version manager and node 16 +ENV NODE_VERSION=16.20.2 +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash +ENV NVM_DIR=/root/.nvm +RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} +RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION} +RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION} +ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}" +RUN node --version +RUN npm --version + +# install debian python packages +RUN apt install -y pipx python3-pip python3-lxml python3-pyldap python3-pymysql python3-boto3 ansible + +# install netapp python sdk +RUN pipx install netapp_ontap +RUN pipx install solidfire-sdk-python --include-deps +RUN pipx ensurepath + +# install mariadb-client +RUN apt install -y mariadb-client + +# install ytt +RUN wget -O /bin/ytt github.com/vmware-tanzu/carvel-ytt/releases/download/v0.49.0/ytt-linux-amd64 +RUN chmod -R +x /bin/ytt + +# run ansible galaxy modules +RUN ansible-galaxy collection install netapp.ontap -p /usr/share/ansible/collections +RUN ansible-galaxy collection install netapp.elementsw -p /usr/share/ansible/collections +RUN ansible-galaxy collection install netapp.um_info -p /usr/share/ansible/collections +RUN ansible-galaxy collection install amazon.aws -p /usr/share/ansible/collections +RUN ansible-galaxy collection install netapp.storagegrid -p /usr/share/ansible/collections +RUN ansible-galaxy collection install community.general -p /usr/share/ansible/collections +RUN ansible-galaxy collection install community.mysql -p /usr/share/ansible/collections + +################################################## +# builder stage +# intermediate build from node16 image to compile application +# why from diff image? for faster build, this image has node preinstalled and can start building immediately +# if only the node app changes, the intermediate image can be cached and the final image will be faster to build + +FROM node:16-alpine AS tmp_builder + +# Use /app +WORKDIR /app + +# Copy package.json and package-lock.json to /app +COPY package*.json ./ + +# Install all dependencies +RUN npm install -g + +RUN npm install + +# Copy the rest of the code +COPY . . + +# Invoke the build script to transpile code to js +RUN npm run build + +# Remove persistent subfolder +RUN rm -rf ./dist/persistent + +################################################## +# final build +# take base and install production app dependencies +# copy built app from intermediate + +FROM debianbase as final + +# Copy package.json and package-lock.json +COPY package*.json ./ + +# Copy transpiled js from builder stage into the final image +COPY --from=tmp_builder /app/dist ./dist + +# Install only production dependencies +# the build was done in alpine, so we need to remove any previous node_modules +RUN rm -rf ./dist/node_modules +RUN npm install --only=production + +# Copy the ansible.cfg file to /etc/ansible/ directory +COPY ansible.cfg /etc/ansible/ansible.cfg + +# Use js files to run the application +ENTRYPOINT ["node", "./dist/index.js"] From 5e19e8a6dc51df8aa54202467376196b18019b1f Mon Sep 17 00:00:00 2001 From: Mirko Van Colen Date: Tue, 24 Sep 2024 15:10:27 +0200 Subject: [PATCH 04/13] newer ansible in dockerfile - and optional debian docker file --- CHANGELOG.md | 4 +++ server/Dockerfile | 53 ++++++++++++---------------------------- server/Dockerfile-debian | 4 +-- 3 files changed, 22 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3175b953..96dfb368 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed ip lib parts CVE related - Updated to vuelidate 2+ (CVE related) +### Added + +- New dockerfile with debian + ## [5.0.5] - 2024-09-18 ### Fixed diff --git a/server/Dockerfile b/server/Dockerfile index 0e765b15..5b84eb73 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -6,35 +6,22 @@ FROM node:16-alpine AS node FROM node AS nodebase +# Use /app as CWD +WORKDIR /app + +# Install github package RUN wget -O /bin/ytt github.com/vmware-tanzu/carvel-ytt/releases/download/v0.49.0/ytt-linux-amd64 RUN chmod -R +x /bin/ytt -# Use /app as CWD -WORKDIR /app +# isntall apk packages +RUN apk add py3-pip py3-pyldap libxslt mysql-client curl tzdata mariadb-connector-c openssh sshpass git vim -# install ansible -RUN apk add ansible - -# upgrade pip -RUN apk add py3-pip - -# install some python dependencies -RUN pip3 install requests six -RUN apk add --update --no-cache --virtual .build-deps g++ gcc libxml2-dev libxslt-dev unixodbc-dev python3-dev postgresql-dev -RUN apk add --no-cache libxslt -RUN apk add --no-cache mysql-client -RUN apk add --no-cache curl -RUN apk add --no-cache py3-pyldap -RUN apk add --no-cache tzdata -RUN pip3 install --no-cache-dir lxml -RUN apk del .build-deps -RUN pip3 install PyMySQL -RUN pip3 install netapp_lib -RUN pip3 install netapp_ontap -RUN pip3 install solidfire-sdk-python -RUN pip3 install boto3 -RUN pip3 install boto -RUN pip3 install botocore +# install some dev packages +# RUN apk add --update --no-cache --virtual .build-deps g++ gcc libxml2-dev libxslt-dev unixodbc-dev python3-dev postgresql-dev && apk del .build-deps +# looks like this is no longer needed + +# install pip3 packages +RUN pip3 install requests six PyMySQL netapp_lib netapp_ontap solidfire-sdk-python boto3 boto botocore lxml ansible # run ansible galaxy modules RUN ansible-galaxy collection install netapp.ontap -p /usr/share/ansible/collections @@ -45,25 +32,16 @@ RUN ansible-galaxy collection install netapp.storagegrid -p /usr/share/ansible/c RUN ansible-galaxy collection install community.general -p /usr/share/ansible/collections RUN ansible-galaxy collection install community.mysql -p /usr/share/ansible/collections -# add mariadb connector for mysql dump -RUN apk add --no-cache mariadb-connector-c - -# add ssh -RUN apk add --no-cache openssh +# make ssh directory RUN mkdir -p ~/.ssh -# add sshpass -RUN apk add --no-cache sshpass - -# add git -RUN apk add --no-cache git - # update npm RUN npm install -g npm@9.8.1 ################################################## # builder stage # intermediate build to compile application +# can run in parallel with base stage FROM node AS tmp_builder @@ -73,9 +51,10 @@ WORKDIR /app # Copy package.json and package-lock.json to /app COPY package*.json ./ -# Install all dependencies +# Update npm RUN npm install -g npm@9.8.1 +# install node modules RUN npm install # Copy the rest of the code diff --git a/server/Dockerfile-debian b/server/Dockerfile-debian index 51201680..dc85074b 100644 --- a/server/Dockerfile-debian +++ b/server/Dockerfile-debian @@ -13,7 +13,7 @@ RUN apt install -y wget curl tzdata software-properties-common gnupg gnupg1 gnup # add ansible repository RUN wget -O - "https://keyserver.ubuntu.com/pks/lookup?fingerprint=on&op=get&search=0x6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367" | gpg --dearmour -o /usr/share/keyrings/ansible-archive-keyring.gpg -RUN UBUNTU_CODENAME=jammy && echo "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu jammy main" | tee /etc/apt/sources.list.d/ansible.list +RUN UBUNTU_CODENAME=jammy && echo "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu $UBUNTU_CODENAME main" | tee /etc/apt/sources.list.d/ansible.list RUN apt update RUN apt upgrade @@ -35,7 +35,7 @@ RUN node --version RUN npm --version # install debian python packages -RUN apt install -y pipx python3-pip python3-lxml python3-pyldap python3-pymysql python3-boto3 ansible +RUN apt install -y pipx python3-pip python3-lxml python3-pyldap python3-pymysql python3-boto3 # install netapp python sdk RUN pipx install netapp_ontap From 933e015584de94af4018135796effac868a9534a Mon Sep 17 00:00:00 2001 From: Mirko Van Colen Date: Thu, 3 Oct 2024 21:50:40 +0200 Subject: [PATCH 05/13] version bump --- CHANGELOG.md | 12 ++++++++++++ client/package.json | 2 +- server/package.json | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fd63690..4749bc3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Added scm branch option to pass to awx + +### Fixed + +- AzureAD with more than 100 groups was not working anymore since introduction of OIDC +- Mysql check during init failed and skipped part of init +- App now properly waits for mysql to be ready before starting +- Vuelidate 2+ was not working properly for dependent required fields + + ## [5.0.6] - 2024-09-20 ### Fixed diff --git a/client/package.json b/client/package.json index 371a7cc7..b85e4bd4 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "ansible_forms_vue", - "version": "5.0.6", + "version": "5.0.7", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/server/package.json b/server/package.json index 044fbd9f..cfea7b5e 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "ansible_forms", - "version": "5.0.6", + "version": "5.0.7", "repository": { "type": "git", "url": "git://github.com/ansibleguy76/ansibleforms.git" From 0ee862159a73ab35d7ad2cc62cfe1564b603c6d0 Mon Sep 17 00:00:00 2001 From: Mirko Van Colen Date: Thu, 3 Oct 2024 21:51:07 +0200 Subject: [PATCH 06/13] vuelidate bug fix --- client/src/views/Awx.vue | 16 ++++++++-------- client/src/views/AzureAd.vue | 8 ++++---- client/src/views/Ldap.vue | 8 ++++---- client/src/views/OIDC.vue | 12 ++++++------ 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/client/src/views/Awx.vue b/client/src/views/Awx.vue index 4fdcedf1..92aad127 100644 --- a/client/src/views/Awx.vue +++ b/client/src/views/Awx.vue @@ -114,23 +114,23 @@ required }, token:{ - required:requiredIf(function(awx){ - return !awx.use_credentials + required:requiredIf(function(){ + return !this.awx.use_credentials }) }, ca_bundle:{ - required:requiredIf(function(awx){ - return !awx.ignore_certs + required:requiredIf(function(){ + return !this.awx.ignore_certs }) }, username:{ - required:requiredIf(function(awx){ - return awx.use_credentials + required:requiredIf(function(){ + return !!this.awx.use_credentials }) }, password:{ - required:requiredIf(function(awx){ - return awx.use_credentials + required:requiredIf(function(){ + return this.awx.use_credentials }) } } diff --git a/client/src/views/AzureAd.vue b/client/src/views/AzureAd.vue index 6d6089b9..25281555 100644 --- a/client/src/views/AzureAd.vue +++ b/client/src/views/AzureAd.vue @@ -135,13 +135,13 @@ validations: { azuread:{ client_id: { - required:requiredIf(function(azuread){ - return azuread.enable + required:requiredIf(function(){ + return !!this.azuread.enable }) }, secret_id:{ - required:requiredIf(function(azuread){ - return azuread.enable + required:requiredIf(function(){ + return !!this.azuread.enable }) } diff --git a/client/src/views/Ldap.vue b/client/src/views/Ldap.vue index 5f97ac14..eb0b5e4b 100644 --- a/client/src/views/Ldap.vue +++ b/client/src/views/Ldap.vue @@ -156,13 +156,13 @@ required }, cert:{ - requiredIf:requiredIf(function(ldap){ - return ldap.enable_tls && !ldap.ignore_certs + requiredIf:requiredIf(function(){ + return !!this.ldap.enable_tls && !this.ldap.ignore_certs }) }, ca_bundle:{ - requiredIf:requiredIf(function(ldap){ - return ldap.enable_tls && !ldap.ignore_certs + requiredIf:requiredIf(function(){ + return !!this.ldap.enable_tls && !this.ldap.ignore_certs }) } diff --git a/client/src/views/OIDC.vue b/client/src/views/OIDC.vue index 47b76f5c..17d67657 100644 --- a/client/src/views/OIDC.vue +++ b/client/src/views/OIDC.vue @@ -126,18 +126,18 @@ validations: { oidc:{ issuer: { - required:requiredIf(function(oidc){ - return oidc.enabled + required:requiredIf(function(){ + return !!this.oidc.enabled }) }, client_id: { - required:requiredIf(function(oidc){ - return oidc.enabled + required:requiredIf(function(){ + return !!this.oidc.enabled }) }, secret_id:{ - required:requiredIf(function(oidc){ - return oidc.enabled + required:requiredIf(function(){ + return !!this.oidc.enabled }) } From f4073d0c0fab8ecc62474f7606160a833745edbc Mon Sep 17 00:00:00 2001 From: Mirko Van Colen Date: Thu, 3 Oct 2024 21:51:18 +0200 Subject: [PATCH 07/13] azuread bugfix --- client/src/views/Login.vue | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/client/src/views/Login.vue b/client/src/views/Login.vue index 6db9896e..fbc59f0f 100644 --- a/client/src/views/Login.vue +++ b/client/src/views/Login.vue @@ -112,7 +112,7 @@ if (res.data['@odata.nextLink']) { // If there's a nextLink, make a recursive call to get the next page of data - this.getGroupsAndLogin(token, res.data['@odata.nextLink'], allGroups); + this.getGroupsAndLogin(token, res.data['@odata.nextLink'], type, allGroups); } else { // No more nextLink, you have all the groups this.tokenLogin(token, allGroups) @@ -122,15 +122,25 @@ this.$toast.error("Failed to get group membership"); }); } - else { + else if (type === 'oidc') { const payload = jwt.decode(token, {complete: true}).payload this.tokenLogin(token, payload.groups || [], 'oidc') + }else{ + this.$toast.error("Invalid Identity Provider type, contact developer") } }, tokenLogin(token, allGroups, type='azuread') { var validRegex=true var regex - const groupfilter = type === 'azuread' ? this.azureGroupfilter : this.oidcGroupfilter + var groupfilter + if(type === 'azuread'){ + groupfilter = this.azureGroupfilter + }else if(type === 'oidc'){ + groupfilter = this.oidcGroupfilter + }else{ + this.$toast.error("Invalid Identity Provider type, contact developer") + return false + } try{ regex = new RegExp(groupfilter, 'g'); }catch(e){ From a3941b0651ecc2fcfdfd107965b943ce011e23a5 Mon Sep 17 00:00:00 2001 From: Mirko Van Colen Date: Thu, 3 Oct 2024 21:51:52 +0200 Subject: [PATCH 08/13] added scm --- docs/_data/help.yaml | 10 ++++++++++ server/src/models/job.model.js | 9 ++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/_data/help.yaml b/docs/_data/help.yaml index 23b556cf..76f71def 100644 --- a/docs/_data/help.yaml +++ b/docs/_data/help.yaml @@ -1106,6 +1106,16 @@ **Note** : You can also dynamically set the instanceGroups by using a field called `__instanceGroups__`. It must be sent as extravar. If this extravar is found it will overwrite the static instanceGroups. **Note** : If you use multistep and you want to dynamically set every step, use the `key` property and `model` property to create separate extravars per step. + - name: scmBranch + type: string + short: SCM Branch + version: 5.0.0 + group: workflow + description: | + Awx allows to pass the scm branch. Use this property to pass it to your template. + + **Note** : You can also dynamically set the scmBranch by using a field called `__scmBranch__`. It must be sent as extravar. If this extravar is found it will overwrite the static scmBranch. + **Note** : If you use multistep and you want to dynamically set every step, use the `key` property and `model` property to create separate extravars per step. - name: awxCredentials type: array group: workflow diff --git a/server/src/models/job.model.js b/server/src/models/job.model.js index e0f751db..18c3b6b8 100644 --- a/server/src/models/job.model.js +++ b/server/src/models/job.model.js @@ -21,7 +21,7 @@ function pushForminfoToExtravars(formObj,extravars,creds={}){ // push top form fields to extravars // change in 4.0.16 => easier to process & available in playbook, might be handy // no credentials added here, because then can also come from asCredential property and these would get lost. - const topFields=['template','playbook','tags','limit','executionEnvironment','check','diff','verbose','keepExtravars','credentials','inventory','awxCredentials','ansibleCredentials','vaultCredentials','instanceGroups'] + const topFields=['template','playbook','tags','limit','executionEnvironment','check','diff','verbose','keepExtravars','credentials','inventory','awxCredentials','ansibleCredentials','vaultCredentials','instanceGroups','scmBranch'] for (const fieldName of topFields) { // Check if the field exists in formObj and if the property is not present in extravars if (formObj.hasOwnProperty(fieldName) && extravars[`__${fieldName}__`] === undefined) { @@ -1032,6 +1032,7 @@ Awx.launch = async function (ev,credentials,jobid,counter,approval,approved=fals var execenv = extravars?.__executionEnvironment__ var instanceGroups = [].concat(extravars?.__instanceGroups__ || []) // always array ! force to array var tags = extravars?.__tags__ || "" + var scmBranch = extravars?.__scmBranch__ || "" var check = extravars?.__check__ || false var verbose = extravars?.__verbose__ || false var limit = extravars?.__limit__ || "" @@ -1051,7 +1052,7 @@ Awx.launch = async function (ev,credentials,jobid,counter,approval,approved=fals try{ const jobTemplate = await Awx.findJobTemplateByName(template) logger.debug("Found jobtemplate, id = " + jobTemplate.id) - await Awx.launchTemplate(jobTemplate,ev,invent,tags,limit,check,diff,verbose,credentials,awxCredentials,execenv,instanceGroups,jobid,++counter) + await Awx.launchTemplate(jobTemplate,ev,invent,tags,limit,check,diff,verbose,credentials,awxCredentials,execenv,instanceGroups,scmBranch,jobid,++counter) return true }catch(err){ message="failed to launch awx template " + template + "\n" + err.message @@ -1060,7 +1061,7 @@ Awx.launch = async function (ev,credentials,jobid,counter,approval,approved=fals throw new Error(message) } } -Awx.launchTemplate = async function (template,ev,invent,tags,limit,check,diff,verbose,credentials,awxCredentials,execenv,instanceGroups,jobid,counter) { +Awx.launchTemplate = async function (template,ev,invent,tags,limit,check,diff,verbose,credentials,awxCredentials,execenv,instanceGroups,scmBranch,jobid,counter) { var message="" if(!counter){ counter=0 @@ -1113,6 +1114,7 @@ Awx.launchTemplate = async function (template,ev,invent,tags,limit,check,diff,ve if(diff){ postdata.diff_mode=true } else{ postdata.diff_mode=false } if(verbose) { postdata.verbosity=3} if(limit){ postdata.limit=limit} + if(scmBranch){ postdata.scm_branch=scmBranch} if(tags){ postdata.job_tags=tags } logger.notice("Running template : " + template.name) @@ -1126,6 +1128,7 @@ Awx.launchTemplate = async function (template,ev,invent,tags,limit,check,diff,ve logger.info("verbose : " + verbose) logger.info("tags : " + tags) logger.info("limit : " + limit) + logger.info("scm_branch : " + scmBranch) // post if(template.related===undefined){ message=`Failed to launch, no launch attribute found for template ${template.name}` From bbe8a0f137b8af17d18b28996083ccbcbb8cc4f6 Mon Sep 17 00:00:00 2001 From: Mirko Van Colen Date: Thu, 3 Oct 2024 21:52:05 +0200 Subject: [PATCH 09/13] added scm --- server/schema/forms_schema.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/schema/forms_schema.json b/server/schema/forms_schema.json index 0be3545b..b3c48c2d 100644 --- a/server/schema/forms_schema.json +++ b/server/schema/forms_schema.json @@ -112,6 +112,7 @@ "steps": {"not":{}}, "awxCredentials": {"not":{}}, "executionEnvironment": {"not":{}}, + "scm_branch": {"not":{}}, "instanceGroups": {"not":{}} }, "required": ["playbook"] @@ -142,6 +143,7 @@ "tags": {"not":{}}, "check": {"not":{}}, "limit": {"not":{}}, + "scm_branch": {"not":{}}, "diff": {"not":{}}, "key": {"not":{}}, "executionEnvironment": {"not":{}}, @@ -326,7 +328,8 @@ "steps": {"not":{}}, "awxCredentials": {"not":{}}, "executionEnvironment": {"not":{}}, - "instanceGroups": {"not":{}} + "instanceGroups": {"not":{}}, + "scm_branch": {"not":{}} }, "required": ["playbook"] }, @@ -489,6 +492,7 @@ "tags": {"type": "string"}, "check": {"type": "boolean"}, "limit": {"type": "string"}, + "scm_branch": {"type": "string"}, "diff": {"type": "boolean"}, "help": {"type": "string"}, "source": {"type": "string"}, From 342b4617d4e338be836dff5349ff6aeac795196a Mon Sep 17 00:00:00 2001 From: Mirko Van Colen Date: Thu, 3 Oct 2024 21:52:18 +0200 Subject: [PATCH 10/13] version bump --- server/src/swagger.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/swagger.json b/server/src/swagger.json index 07883726..b283f6e3 100644 --- a/server/src/swagger.json +++ b/server/src/swagger.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { "description": "This is the swagger interface for AnsibleForms.\r\nUse the `/auth/login` api with basic authentication to obtain a JWT token.\r\nThen use the access token, prefixed with the word '**Bearer**' to use all other api's.\r\nNote that the access token is limited in time. You can then either login again and get a new set of tokens or use the `/token` api and the refresh token to obtain a new set (preferred).", - "version": "5.0.6", + "version": "5.0.7", "title": "AnsibleForms", "contact": { "email": "info@ansibleforms.com" From 1be31db6bc77e297fea05bc676a86567f7206a0d Mon Sep 17 00:00:00 2001 From: Mirko Van Colen Date: Thu, 3 Oct 2024 21:52:36 +0200 Subject: [PATCH 11/13] fixed mysql wait --- server/src/init/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/init/index.js b/server/src/init/index.js index cf7474ac..d8991f4d 100644 --- a/server/src/init/index.js +++ b/server/src/init/index.js @@ -13,17 +13,18 @@ async function init(){ // this is at startup, don't start the app until mysql is ready // rewrite with await - logger.info("Waiting for mysql to start") + async function sleep(millis) { return new Promise(resolve => setTimeout(resolve, millis)); } var MYSQL_IS_READY = false while(!MYSQL_IS_READY){ try{ + logger.info("Waiting for mysql to start") await mysql.do("SELECT 1") MYSQL_IS_READY = true }catch(e){ - logger.log("Mysql not ready yet") + logger.warning("Mysql not ready yet") await sleep(5000) } } From fd0c13d2b014561d95c5ea31a2c19e33c3d396cd Mon Sep 17 00:00:00 2001 From: Mirko Van Colen Date: Thu, 3 Oct 2024 21:53:36 +0200 Subject: [PATCH 12/13] conn close ; no error --- server/src/models/db.model.js | 1 - 1 file changed, 1 deletion(-) diff --git a/server/src/models/db.model.js b/server/src/models/db.model.js index 7dd1a570..90835f8a 100644 --- a/server/src/models/db.model.js +++ b/server/src/models/db.model.js @@ -35,7 +35,6 @@ MySql.do = async function (query, vars, silent = false) { await conn.end() } catch (e) { logger.error('[ansibleforms] ' + e) - throw e } } } From ef66a15365f08c7b62243761ab5b4c6ccbe067b6 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 3 Oct 2024 19:54:38 +0000 Subject: [PATCH 13/13] Prepare release 5.0.7 --- CHANGELOG.md | 7 +++++-- app_versions.gradle | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4749bc3f..0adcd875 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [5.0.7] - 2024-10-03 + ### Added - Added scm branch option to pass to awx @@ -18,7 +20,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - App now properly waits for mysql to be ready before starting - Vuelidate 2+ was not working properly for dependent required fields - ## [5.0.6] - 2024-09-20 ### Fixed @@ -755,7 +756,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Allow change password for current local user - Start tracking versions -[Unreleased]: https://github.com/ansibleguy76/ansibleforms/compare/5.0.6...HEAD +[Unreleased]: https://github.com/ansibleguy76/ansibleforms/compare/5.0.7...HEAD + +[5.0.7]: https://github.com/ansibleguy76/ansibleforms/compare/5.0.6...5.0.7 [5.0.6]: https://github.com/ansibleguy76/ansibleforms/compare/5.0.5...5.0.6 diff --git a/app_versions.gradle b/app_versions.gradle index 62d73250..9936260c 100644 --- a/app_versions.gradle +++ b/app_versions.gradle @@ -1,2 +1,2 @@ -ext.version_code = 50006 -ext.version_name = "5.0.6" +ext.version_code = 50007 +ext.version_name = "5.0.7"