Skip to content

Instantly share code, notes, and snippets.

@hguemar
Created October 9, 2019 18:16
Show Gist options
  • Save hguemar/0d7e69a4e735a27ffd5a42b4b9e0242e to your computer and use it in GitHub Desktop.
Save hguemar/0d7e69a4e735a27ffd5a42b4b9e0242e to your computer and use it in GitHub Desktop.
#! /bin/bash
## how to use
## ./dci-rhel-agent.sh <command>
function build() {
podman build -f Dockerfile -t dci-rhel-agent --no-cache
}
function run() {
podman pull quay.io/distributedci/dci-rhel-agent:stable && source /etc/dci-rhel-agent/dcirc.sh && podman run --rm -ti --network host \
-e DCI_CLIENT_ID \
-e DCI_API_SECRET \
-e DCI_CS_URL \
-e DCI_LOCAL_REPO \
-e DCI_BEAKER_CONFIG \
-e PS1='\[\e[32m\][container]#\[\e[m\] ' \
-v /etc/dci-rhel-agent/hooks/:/etc/dci-rhel-agent/hooks/ \
-v /etc/dci-rhel-agent/settings.yml:/etc/dci-rhel-agent/settings.yml \
-v /etc/dci-rhel-agent/hosts:/etc/dci-rhel-agent/hosts \
-v $$DCI_LOCAL_REPO:/var/www/html \
quay.io/distributedci/dci-rhel-agent:stable
}
function stop() {
podman stop $(podman ps -a -q --filter ancestor=dci-rhel-agent)
}
function kill() {
podman kill $(podman ps -a -q --filter ancestor=dci-rhel-agent)
}
function clean() {
podman rmi quay.io/distributedci/dci-rhel-agent:stable
}
function shell() {
podman pull quay.io/distributedci/dci-rhel-agent:stable && source /etc/dci-rhel-agent/dcirc.sh && podman run --rm -ti --network host \
-e DCI_CLIENT_ID \
-e DCI_API_SECRET \
-e DCI_CS_URL \
-e DCI_LOCAL_REPO \
-e DCI_BEAKER_CONFIG \
-e PS1='\[\e[32m\][container]#\[\e[m\] ' \
-v /etc/dci-rhel-agent/hooks/:/etc/dci-rhel-agent/hooks/ \
-v /etc/dci-rhel-agent/settings.yml:/etc/dci-rhel-agent/settings.yml \
-v /etc/dci-rhel-agent/hosts:/etc/dci-rhel-agent/hosts \
-v $$DCI_LOCAL_REPO:/var/www/html \
quay.io/distributedci/dci-rhel-agent:stable bash
}
$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment