]> piware.de Git - bin.git/blob - setup-tasks-dev
vm: Use SDL display by default
[bin.git] / setup-tasks-dev
1 #!/bin/bash
2 # Set up interactive development environment in a https://quay.io/repository/cockpit/tasks container
3 # Start the container on e2e with:
4 #   docker network create --driver bridge pitti
5 #   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
6 #   docker exec -it pitti byobu
7
8 set -eux
9
10 chmod 700 ~/.ssh
11 rm ~/.ssh/config
12 cat <<EOF > ~/.ssh/config
13 # Cockpit test VMs
14 Host c
15     Hostname 127.0.0.2
16     User root
17     Port 2201
18     StrictHostKeyChecking no
19     UserKnownHostsFile /dev/null
20     IdentityFile ~/upstream/bots/machine/identity
21 EOF
22
23 github_token=
24 read -p "Enter github.com user name (empty to skip authenticated github setup): " github_user
25 if [ -n "$github_user" ]; then
26     read -p "Enter github.com token (empty to skip authenticated github setup): " github_token
27     if [ -n "$github_token" ]; then
28         printf '[credential]\n\thelper = store\n' >> ~/.gitconfig
29         printf "https://${github_user}:${github_token}@github.com" > ~/.git-credentials
30         chmod 600 ~/.git-credentials
31     fi
32 fi
33
34 # cockpit development git repos
35 mkdir -p ~/.cache ~/upstream
36 ln -sfn /cache/images ~/.cache/cockpit
37 cd upstream
38 git clone https://github.com/cockpit-project/bots
39 cd bots
40 [ -z "$github_user" ] || git remote add my https://github.com/$github_user/bots
41 cd ..
42 git clone https://github.com/cockpit-project/cockpit
43 cd cockpit
44 [ -z "$github_user" ] || git remote add my https://github.com/$github_user/cockpit
45 ln -s ../bots
46
47 # github CLI template
48 if [ -n "$github_token" ]; then
49     mkdir -p ~/.config/gh
50     printf "hosts:\n  github.com:\n    oauth_token: ${github_token}\n    user: ${github_user}\n" > ~/.config/gh/config.yml
51 fi