semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

Feature: allow to use the username from UI as value of environment variables

Open jguay opened this issue 1 year ago • 2 comments

Related to

Web-Frontend (what users interact with), Ansible (task execution), Configuration

Impact

nice to have

Missing Feature

User john runs a terraform task that creates a VM and VM name should include name john-, we can use :

  • Environment with variable called TF_VAR_semaphoreuser - var.semaphoreuser is accessible in terraform automatically - but environment does not belong to John it belongs to the project so this is not usable at scale
  • Survey variable - every task need to have survey variable semaphoreuser asking user to fill its own username - there is nothing preventing to give any other value. Also it is tedious to ask semaphore user name at every task execution

Implementation

  • ability for environment and have value set by UI
  • example environment I need the value is username from GET /api/user

If the value of the variable is not resolved when running a task then - the variable should not exist at all (default empty value is not wanted - task failure is expected if variable does not resolve to username)

Design

No response

jguay avatar Nov 06 '24 12:11 jguay

I have a use case for this too. I'm setting up a multi-user Ansible controller with both Semaphore and ARA

ARA has an env variable, ARA_RECORD_USER_NAME, to set the username it records.

I'd like a way to set this to the currently logged in user.

Could some amount of templating be added to Variable Groups to accomplish this? Something like this

Image

winbornejw avatar Apr 29 '25 17:04 winbornejw

Hi @winbornejw it is interesting idea. I like it but with different implementation.

fiftin avatar Apr 29 '25 18:04 fiftin