Questions tagged [bash]

Most common system shell in Unix/Linux environments. Integrates very well with other softwares having a command line interface. Widely used in CI scripts and buildscripts.

Filter by
Sorted by
Tagged with
0 votes
1 answer
145 views

Can you use the Secure File API if the container doesn't have bash? Like Alpine?

GitLab offers a Project-level Secure Files, the API has you add this to your .gitlab-ci.yml, test: variables: SECURE_FILES_DOWNLOAD_PATH: './where/files/should/go/' script: - curl --silent ...
Evan Carroll's user avatar
  • 1,584
1 vote
2 answers
362 views

Reuse block string without processing it on the fly

I have a block of code that work fine at the moment. But reuse that code is a little ugly. pipeline { agent any stages { stage('Stage 1') { steps { script { ...
navebinario's user avatar
0 votes
0 answers
701 views

how to pass run time environment variables into bash script

I am using GitHub actions to create an virtual machine in Azure where I am getting some variables as build parameters and storing it into the environment variables. now I need to use that environment ...
Vedanth Pulipati's user avatar
0 votes
1 answer
180 views

docker command substitution fails on gitlab

I am trying to run the following command as part of a deployment in Gitlab. TIMESTAMP=$(date +%s) docker stack deploy --with-registry-auth --compose-file $(`printf "docker-compose.%s.unimark.yaml&...
CodeWeed's user avatar
  • 139
2 votes
1 answer
329 views

How to modify/allow firewall rules of a GCP instance directly from the CLI?

Is there anyway to allow the ports from CLI? I have an instance in GCP and I have installed a service which by default runs on Port:8080. I know there is an option to change the firewall rules to ...
AV Reddy's user avatar
2 votes
1 answer
6k views

ansible Unsupported parameters for (command) module:

I'm trying to run a shell command in an ansible task but I keep getting an error. This is the task item and the shell command I want to run: - name: Set File Watch Limit ansible.builtin.shell: ...
John's user avatar
  • 131
1 vote
1 answer
1k views

Using access tokens on Dockerfile to clone repository: RUN command error

In a Dockerfile, I'm trying to clone several Gitlab repositories that are specified in a file, one per line, using an access token passed as an environment variable set in docker-compose.yml: COPY my-...
dvilela's user avatar
  • 121
0 votes
1 answer
407 views

Setting up CircleCI to AWS EC2 for a simple node application deployment

I have a simple node application running on the EC2 instance, everything is working just fine and I want to integrate this application with CircleCI for the continuous deployment. I have been ...
Mukul Kumar Jha's user avatar
2 votes
1 answer
9k views

Why does Jenkins Pipeline script returnStatus value not match status examined in shell?

This is my little newbie Groovy script, trying to cobble together a very beginner understanding of Jenkins Pipelines: node { stage("hello") { def var = "val" echo "${var}&...
StoneThrow's user avatar
2 votes
3 answers
8k views

How can I get the Docker target platform inside the Build Environment / Dockerfile

I'm doing multi-platform builds with buildx and would like to know if there is a way to determine what platform is currently being build so I can avoid certain steps for certain environments. For ...
Tracker1's user avatar
  • 123
1 vote
2 answers
462 views

Command "git [command] --help" opens as HTML in my code editor - no output to terminal. How do I revert to default behavior?

When I type git reset --help I don't get output in the bash terminal, but a new tab opens in my code editor to reveal some dense HTML. How can I change Git's behavior to display the help message in ...
Craig's user avatar
  • 11
1 vote
2 answers
45 views

od output is confusing

This isn't a deploy related question, but I believe it belongs here. I've found out about the od tool yesterday, and began to fiddle with it. The question is about utf-8 encoding. See the examples: ~ $...
Niloct's user avatar
  • 121
0 votes
1 answer
560 views

How to gain root access to an existing docker container?

Able to get a response from the docker hub basex container: nicholas $ nicholas $ lynx http://localhost:8984/ --dump No function found that matches the request. nicholas $ Ran the container as: ...
Nicholas Saunders's user avatar
3 votes
1 answer
7k views

docker: Error response from daemon: Conflict. The container name "/basexhttp" is already in use by container

Am I even correctly following the documentation on creating and running a docker container below? [root@ ~]# [root@ ~]# docker run -d \ > --name basexhttp \ > --publish 1984:1984 \ > ...
Nicholas Saunders's user avatar
1 vote
1 answer
3k views

cannot get bash prompt: Error response from daemon: Container foo is not running

A basic jetty container: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ...
Nicholas Saunders's user avatar
0 votes
1 answer
636 views

How to create a "silent" MySQL docker container?

How can I create a MySQL docker container as below in the background: root:~# root:~# docker run -e MYSQL_ROOT_PASSWORD=pass --name sql-db -p 3306:3306 mysql & [1] 137878 root:~# 2020-09-01 08:25:...
Nicholas Saunders's user avatar
2 votes
1 answer
229 views

How can I use bash functions in makefile?

If I need to use something like NVM in my makefile, I run into a problem, because NVM exports some bash functions that are not available in Make, even if my shell is defined as bash in the makefile. ...
Joseph's user avatar
  • 45
6 votes
1 answer
3k views

Defining and using bash functions in AWS CodeBuild

I thought I could slightly improve readability of repetitive sed calls when inserting secrets into a file with AWS CodeBuild. I defined a bash function: replaceConfig() { sed -i 's|{'$1'}|'${!1}'|' ...
Kyle's user avatar
  • 161
1 vote
1 answer
880 views

SSH connection to jenkins server

I have a absh script which connects and exexutes programs from my local to remote server and now this should be executed from jenkins build so for this jenkins is taking continous changes from git for ...
Sakshi Rathore's user avatar
0 votes
1 answer
529 views

How do I add my IP address to the start of my terminal using the bashrc file?

I want to customise my terminal on an Amazon linux device. I have colours using $(tput setaf 33);, user name with /u but the IP address not there. #blue=$(tput setaf 33); PS1="\[${blue}]\u$(tput ...
doug's user avatar
  • 503
1 vote
1 answer
54 views

Is \u the only way to output the user from .bashrc?

I can't get it to work on my Mac (catalina version 10.15.2). \u works on ubuntu when I test it but not on my Mac. I want to customize my mac terminal. Colors work fine on my Mac and it's reading the ....
doug's user avatar
  • 503
1 vote
1 answer
1k views

create entry-point script to get all env variables starting with VUE_APP_ and take it's value

I would like to Dockerize my existing vuejs app for staging , production and I used multi staged approach to create my app container and I'm using Ubuntu 18.04 and this is my, Dockerfile # build stage ...
soldier's user avatar
  • 115
4 votes
1 answer
4k views

Exit a Makefile target called by parent without throwing an error

Let's say that I have 2 targets: test: # ... @$(MAKE) dosomething @echo test # ... dosomething: # ... @if [ -z "$(SOMETHING)" ]; then exit 0; fi @echo dosomething # .....
Destroy666's user avatar
5 votes
3 answers
11k views

How to pass Gitlab env var with sensitive characters to bash script?

I have the following situation: I'm storing sensitive data in Gitlab's environment and then passing these variables to a deployment script in bash. Gitlab's env var: Key: sensitive_var Value: aaa$...
JJ Yong's user avatar
  • 53
3 votes
1 answer
15k views

npm not found but installed from the shell script file in Dockerfile

I have a following Dockerfile: FROM ubuntu:18.04 RUN mkdir app && cd app WORKDIR app/ RUN apt-get update && apt-get install -y \ software-properties-common \ curl \ sudo ...
Leon Ma's user avatar
  • 33
1 vote
1 answer
3k views

Add mapping ip and host into /etc/hosts with docker

I am using docker to scale my service. I know there's a command called --add--host for adding host into /etc/host However, I have a bunch of hosts need to be added. It's just too long to launch a ...
rj487's user avatar
  • 143
1 vote
0 answers
183 views

How to launch a docker container from within a GitLab Shell runner? [closed]

Situation My CI pipeline needs to do the following: log into a VM and have access to a bash terminal run a bash script that launches a Docker container with parameters (e.g. -it mode or providing the ...
avazula's user avatar
  • 879
1 vote
2 answers
50 views

Automatically write new bash history to change-log file

Every time I ssh into a server I might issue some bash commands and then sign off (hup signal?). Is there a way to write the shell commands that I issued on the server to some changelog file? I want ...
Alexander Mills's user avatar
0 votes
2 answers
90 views

replacing values in shell script using sed [closed]

My shell script looks like this: FAILED_REQUEST_DIRECTORY=/bla/bla2 \ java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1234 \ -jar /xyz/abc-service-1.0-SNAPSHOT.jar \ --...
systemdebt's user avatar
1 vote
4 answers
2k views

shell script to pass values properties file in java

I have a properties file that looks like this: mysql.username=USERNAME mysql.pass=PASS I need to change USERNAME and PASS with variable values passed to shell script. I cannot use sed since that ...
systemdebt's user avatar
2 votes
1 answer
179 views

Bash Tokenization Errors on Jenkins JNLP Slave

Why might the below bash commands give me an error on a Jenkins JNLP slave in Kubernetes cluster? Each work on a local machine. Error: Syntax error: redirection unexpected IFS='/' read -r -a branch ...
Brandon Clark's user avatar
1 vote
0 answers
346 views

echo colon to file in cloud-init [closed]

So, I have this part in my cloud-init: runcmd: - echo : RSA 'node.crt' >> /etc/ipsec.secrets I literally can't make it to work. I tried these variations: runcmd: - echo : RSA 'node.crt' ...
Crowor's user avatar
  • 11
2 votes
1 answer
650 views

Automating the creation of an Apache virtual-host file specifically

When I create new web applications on my up-2-date Ubuntu-LAMP with Apache 2.4.x environment, I create their virtual-host files this way: s_a="/etc/apache2/sites-available/" s_e="/etc/apache2/sites-...
user avatar
1 vote
1 answer
374 views

Running consul in the background using Chef

I am trying to create a Chef cookbook that will run Hashicorp Consul in the background and will continue with the rest of the recipe and not get hung on starting Consul. I have tried the & method ...
Josh Kirby's user avatar
1 vote
1 answer
175 views

How can I diagnose php cli command execution time inside a docker container

I've recently migrated an event subscription service called by a bash script from Ubuntu, into a Dockerised container. The Docker image I am using is: FROM php:7.1-apache The script itself is pretty ...
pcgben's user avatar
  • 111
2 votes
1 answer
1k views

How to make the Jenkins agent build then start the server?

I want the Jenkins agent to build and start the server. I do this by specifying how to build and start the server in the Build step of the project configuration in Bash echo "Installing dependencies"...
Tran Triet's user avatar
16 votes
1 answer
6k views

How to keep configuration files automatically during apt-get upgrade or install?

When performing and apt-get update; apt-get upgrade -y on a server I encountered the message: Setting up sudo (1.8.16-0ubuntu1.5) ... Configuration file '/etc/sudoers' ==> Modified (by you or by ...
Steven K7FAQ's user avatar
1 vote
2 answers
4k views

Docker exec environment different to container shell

I have a docker image that looks something like this: FROM ubuntu:16.04 # Install packages for building ruby RUN apt-get update && \ apt-get -y install build-essential git curl wget net-...
ConorSheehan1's user avatar
4 votes
5 answers
25k views

Access vault secret from bash script

I am looking for help on a direction on where to go from here. I have a Hasicorp Vault server running and accessible over DNS (local). I need to have a script get a secret from it then use that secret....
user avatar
3 votes
1 answer
758 views

Jenkins hangs on Windows CMD build that has GUI

I am attempting to automate imports and exports of Oracle's PeopleSoft Application Designer. It is a GUI program but it can operate in the windows command line for certain tasks. This project has ...
Stoopkid's user avatar
  • 141
0 votes
1 answer
113 views

The right way to Ansiblically deploy environments directly from Github:

Can one deploy an environment for some Linux OS (say, Ubuntu) from a raw Github playbook in a way similar to this (I wonder if it's the correct syntax)? bash <(curl -s https://raw....
Arcticooling's user avatar
5 votes
2 answers
8k views

Interference of Docker CMD with su: works with su-exec but not with su?

In this bash script under Linux Alpine they have (line 8): exec su-exec "$ZOO_USER" "$0" "$@" As far as I know, su-exec is however an Apache httpd dependecy - can I avoid it installing it under ...
Ta Mu's user avatar
  • 6,792