diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..50e604fd818cfe50232f44c2d78c90b3fa50a437 --- /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 a91e705424b7ca4c0b6d9deaf6f83aac4e2457b2..79585e9b04290d2bd22eec87725b3c1f147384bc 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