mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 20:35:24 +01:00
Merge pull request #811 from jdhayes/develop
Added ansible limit to API
This commit is contained in:
commit
261719137a
@ -1441,6 +1441,8 @@ paths:
|
||||
type: string
|
||||
environment:
|
||||
type: string
|
||||
limit:
|
||||
type: string
|
||||
responses:
|
||||
201:
|
||||
description: Task queued
|
||||
|
@ -29,6 +29,7 @@ type Task struct {
|
||||
// override variables
|
||||
Playbook string `db:"playbook" json:"playbook"`
|
||||
Environment string `db:"environment" json:"environment"`
|
||||
Limit string `db:"limit" json:"limit"`
|
||||
|
||||
UserID *int `db:"user_id" json:"user_id"`
|
||||
|
||||
|
54
deployment/docker/ci/Singularity
Normal file
54
deployment/docker/ci/Singularity
Normal file
@ -0,0 +1,54 @@
|
||||
Bootstrap: docker
|
||||
From: golang:1.16.3-alpine3.13
|
||||
Stage: spython-base
|
||||
|
||||
%setup
|
||||
mkdir $SINGULARITY_ROOTFS/bigdata
|
||||
|
||||
%post
|
||||
SEMAPHORE_VERSION="development"
|
||||
SEMAPHORE_ARCH="linux_amd64"
|
||||
SEMAPHORE_CONFIG_PATH="${SEMAPHORE_CONFIG_PATH:-/etc/semaphore}"
|
||||
APP_ROOT="/mnt/"
|
||||
|
||||
# hadolint ignore=DL3013
|
||||
apk add --no-cache sshpass git mysql-client python3 py3-pip py-openssl openssl ca-certificates curl curl-dev openssh-client tini nodejs nodejs-npm bash rsync && \
|
||||
apk --update add --virtual build-dependencies python3-dev libffi-dev openssl-dev build-base &&\
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
pip3 install --upgrade pip cffi && \
|
||||
pip3 install ansible &&\
|
||||
apk del build-dependencies
|
||||
|
||||
adduser -D -u 1002 -g 0 semaphore && \
|
||||
mkdir -p $APP_ROOT && \
|
||||
mkdir -p /tmp/semaphore && \
|
||||
mkdir -p /etc/semaphore && \
|
||||
chown -R semaphore:0 /go && \
|
||||
chown -R semaphore:0 /tmp/semaphore && \
|
||||
chown -R semaphore:0 /etc/semaphore && \
|
||||
ssh-keygen -t rsa -q -f "/root/.ssh/id_rsa" -N "" && \
|
||||
ssh-keyscan -H github.com > /root/.ssh/known_hosts
|
||||
|
||||
cd $(go env GOPATH) && curl -sL https://taskfile.dev/install.sh | sh
|
||||
|
||||
# Copy in app source
|
||||
cd ${APP_ROOT}
|
||||
./deployment/docker/ci/bin/install
|
||||
|
||||
su - semaphore # USER semaphore
|
||||
# EXPOSE 3000
|
||||
|
||||
%environment
|
||||
export SEMAPHORE_VERSION="development"
|
||||
export SEMAPHORE_ARCH="linux_amd64"
|
||||
export SEMAPHORE_CONFIG_PATH="${SEMAPHORE_CONFIG_PATH:-/etc/semaphore}"
|
||||
export APP_ROOT="/mnt/"
|
||||
|
||||
%runscript
|
||||
cd ${APP_ROOT}
|
||||
exec /usr/local/bin/semaphore-wrapper ./bin/semaphore server --config /etc/semaphore/config.json "$@"
|
||||
|
||||
%startscript
|
||||
cd ${APP_ROOT}
|
||||
exec /usr/local/bin/semaphore-wrapper ./bin/semaphore server --config /etc/semaphore/config.json "$@"
|
29
deployment/docker/ci/bin/build.sh
Executable file
29
deployment/docker/ci/bin/build.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash -l
|
||||
|
||||
# Set env
|
||||
SUSER=$USER
|
||||
SCRIPT_HOME=$(realpath $(dirname $0))
|
||||
SEMAPHORE_HOME=$(realpath $SCRIPT_HOME/../../../../)
|
||||
echo "Building in $SEMAPHORE_HOME"
|
||||
|
||||
if [[ ! -f $SCRIPT_HOME/../semaphore.simg ]]; then
|
||||
# Build Image
|
||||
sudo bash -lc "
|
||||
# Set env
|
||||
module purge
|
||||
module load singularity || echo 'Not using modules'
|
||||
export SINGULARITY_BIND=${SEMAPHORE_HOME}:/mnt
|
||||
|
||||
# Build image
|
||||
cd $SCRIPT_HOME/../ && singularity build semaphore.simg Singularity
|
||||
|
||||
# Update perms
|
||||
chmod -R ${SUSER}: $SEMAPHORE_HOME"
|
||||
else
|
||||
# Build RPM
|
||||
module load singularity || echo 'Not using modules'
|
||||
cd ${SEMAPHORE_HOME} && singularity exec $SCRIPT_HOME/../semaphore.simg task release
|
||||
chmod a+rx ${SEMAPHORE_HOME}/bin
|
||||
chmod a+r ${SEMAPHORE_HOME}/bin/*
|
||||
fi
|
||||
|
@ -696,6 +696,7 @@ func (t *TaskRunner) getPlaybookArgs() (args []string, err error) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var taskExtraArgs []string
|
||||
if t.template.AllowOverrideArgsInTask && t.task.Arguments != nil {
|
||||
@ -705,6 +706,11 @@ func (t *TaskRunner) getPlaybookArgs() (args []string, err error) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if t.task.Limit != "" {
|
||||
t.Log("--limit="+t.task.Limit)
|
||||
taskExtraArgs = append(taskExtraArgs, "--limit="+t.task.Limit)
|
||||
}
|
||||
|
||||
args = append(args, templateExtraArgs...)
|
||||
args = append(args, taskExtraArgs...)
|
||||
|
Loading…
Reference in New Issue
Block a user