From 07c55acc41cf4e234f5dde86b08329155e91ff1f Mon Sep 17 00:00:00 2001 From: Emmanuel Bruno <emmanuel.bruno@univ-tln.fr> Date: Mon, 12 Dec 2022 20:51:28 +0100 Subject: [PATCH] adds a README and generify get. --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ get-ci-wrapper.sh | 9 +++++---- 2 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..50e604f --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# C.I. Wrappers + +A sets a utility bash functions for Continuous Integration C.I. + +## Installation + +Install with : + +```bash +curl -s https://bruno.univ-tln.fr/get-ci-wrapper.sh | bash +``` + +To use it in the current shell : + +```bash +source ~/.ci-wrappers/ci-wrappers.sh +``` + +You can add it to .bashrc or .zshrc : + +```bash +export CI_WRAPPER_HOME=${HOME}/.ci-wrappers +[[ -f "${CI_WRAPPER_HOME}/ci-wrappers.sh" ]] && \ + source "${CI_WRAPPER_HOME}/ci-wrappers.sh" +``` + +## Usage + +- `install-ci-software` <br/> + Installs GitHub CLI, Docker client, docker compose plugin, vagrant and terraform in $CI_WRAPPERS_HOME +- `new-java-project testci fr.univtln.bruno.tests` <br/> + Creates a new maven projects ready for C.I. +- `docker-mvn` <br/> + Wraps maven in a container (docker needed see beelow).<br/> + For example to build a C.I. project: `docker-mvn clean verify` +- `github-runner-repo` or `github-runner-org` <br/> + Creates and register a new GitHub runner in a docker container for the current repository + or the organisation (account). +- A docker engine with http proxy support in VM : + - `docker-vagrant` is a wrapper for a specific Docker vagrant Box (Docker in a VBox VM). + - `docker-vagrant up` and `docker-vagrant halt` to create/start and stop the vm. + - `docker-vagrant ssh` to log in the VM. + - `docker-vagrant suspend`, `docker-vagrant resume` and `docker-vagrant status` to suspend, resume and get VM + status. + - `docker-vagrant destroy` to destroy it (**docker named volumes will be lost**). + - `use-vagrant-docker` to sets docker client to used in the current shell (sets $DOCKER_HOST). + - `vagrant destroy` to destroy it. diff --git a/get-ci-wrapper.sh b/get-ci-wrapper.sh index a91e705..79585e9 100755 --- a/get-ci-wrapper.sh +++ b/get-ci-wrapper.sh @@ -1,10 +1,11 @@ #!/usr/bin/env bash +CI_WRAPPERS_HOME="\${CI_WRAPPERS_HOME:-\${HOME}/.ci-wrappers}" + _create_config() ( - echo HOME: "${HOME}" # Create or update default config file - mkdir -p "${HOME}/.ci-wrappers/" - cat >"${HOME}/.ci-wrappers/config" <<END + mkdir -p "${CI_WRAPPERS_HOME}" + cat >"${CI_WRAPPERS_HOME}/config" <<END CI_VAGRANT_VERSION=2.3.4 CI_TERRAFORM_VERSION=1.3.6 CI_DOCKER_CLIENT_VERSION=20.10.19 @@ -25,7 +26,7 @@ END _create_config # Load the config -source "${HOME}/.ci-wrappers/config" +source "${CI_WRAPPERS_HOME}/config" # Installs the script locally curl -s https://raw.githubusercontent.com/ebpro/ciwrappers/develop/ci-wrappers.sh > "$CI_WRAPPERS_HOME"/ci-wrappers.sh -- GitLab