]> piware.de Git - bin.git/commitdiff
Add setup-tasks-dev
authorMartin Pitt <martin@piware.de>
Tue, 5 Jan 2021 07:26:21 +0000 (08:26 +0100)
committerMartin Pitt <martin@piware.de>
Tue, 5 Jan 2021 07:28:30 +0000 (08:28 +0100)
setup-tasks-dev [new file with mode: 0755]

diff --git a/setup-tasks-dev b/setup-tasks-dev
new file mode 100755 (executable)
index 0000000..efcca94
--- /dev/null
@@ -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 <<EOF > ~/.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