From: Martin Pitt Date: Tue, 5 Jan 2021 07:26:21 +0000 (+0100) Subject: Add setup-tasks-dev X-Git-Url: https://piware.de/gitweb/?p=bin.git;a=commitdiff_plain;h=621320bac419edf75fce586268fe015f915b1bf1 Add setup-tasks-dev --- diff --git a/setup-tasks-dev b/setup-tasks-dev new file mode 100755 index 0000000..efcca94 --- /dev/null +++ b/setup-tasks-dev @@ -0,0 +1,51 @@ +#!/bin/bash +# Set up interactive development environment in a https://quay.io/repository/cockpit/tasks container +# Start the container on e2e with: +# docker network create --driver bridge pitti +# docker run --name pitti -d --volume=/var/cache/cockpit-tasks/images:/cache/images:rw --shm-size=1024m -e NPM_REGISTRY=https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/ --network=pitti quay.io/cockpit/tasks sleep infinity +# docker exec -it pitti byobu + +set -eux + +chmod 700 ~/.ssh +rm ~/.ssh/config +cat < ~/.ssh/config +# Cockpit test VMs +Host c + Hostname 127.0.0.2 + User root + Port 2201 + StrictHostKeyChecking no + UserKnownHostsFile /dev/null + IdentityFile ~/upstream/bots/machine/identity +EOF + +github_token= +read -p "Enter github.com user name (empty to skip authenticated github setup): " github_user +if [ -n "$github_user" ]; then + read -p "Enter github.com token (empty to skip authenticated github setup): " github_token + if [ -n "$github_token" ]; then + printf '[credential]\n\thelper = store\n' >> ~/.gitconfig + printf "https://${github_user}:${github_token}@github.com" > ~/.git-credentials + chmod 600 ~/.git-credentials + fi +fi + +# cockpit development git repos +mkdir -p ~/.cache ~/upstream +ln -sfn /cache/images ~/.cache/cockpit +cd upstream +git clone https://github.com/cockpit-project/bots +cd bots +[ -z "$github_user" ] || git remote add my https://github.com/$github_user/bots +cd .. +git clone https://github.com/cockpit-project/cockpit +cd cockpit +[ -z "$github_user" ] || git remote add my https://github.com/$github_user/cockpit +ln -s ../bots + +# github CLI template +if [ -n "$github_token" ]; then + mkdir -p ~/.config/gh + printf "hosts:\n github.com:\n oauth_token: ${github_token}\n user: ${github_user}\n" > ~/.config/gh/config.yml +fi