-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.sh
75 lines (58 loc) · 2.03 KB
/
scripts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
###############
# DOCKER
###############
alias dprune="docker system prune --volumes"
alias bake="pushd `git root`; docker buildx bake; popd"
alias dev="docker compose -f `git root`/compose.dev.yml"
alias prod="docker compose -f `git root`/compose.prod.yml"
dlist() {
docker images "ghcr.io/cam-dig*/*:${@-latest}"
}
dpush-latest() {
docker images --format "{{.Repository}}:{{.Tag}}" "ghcr.io/cam-dig*/*:latest" | xargs -n1 docker push
}
# Assign tag to all local images tagged "latest"
dassign() {
docker images --format "{{.Repository}}" "ghcr.io/cam-dig*/*:latest" | sed 's/:latest//g' | xargs -I {} docker tag {} {}:$@
}
# Pull images, based on the list of local images with the "latest tag". Supplying an argument
# allows for tags other than "latest" to be pulled.
dpull() {
docker images --format "{{.Repository}}" "ghcr.io/cam-dig*/*:latest" | xargs -I {} docker pull {}:${@:-latest}
}
dpush-tag() {
docker image ls --format "{{.Repository}}:{{.Tag}}" "ghcr.io/cam-dig*/*:$@" | xargs -n1 docker push
}
alias test-gh-latest="dpull && prod down && prod up -d"
###############
# GIT
###############
# git config --global alias.root 'rev-parse --show-toplevel'
alias gitroot="cd `git root`"
# Assumes that origin/`whoami`-dev was deleted after closing a pull request (merged to main)
# Deletes the local `whoami`-dev branch and recreates from "main" (after fetch/pull)
new-dev-branch() {
git checkout main
git fetch
git pull
git branch -D `whoami`-dev
git remote prune origin
git checkout -b `whoami`-dev
}
alias gitll="gh repo list --no-archived"
alias gitls="gh repo list --no-archived --json name --jq \".[].name\""
###############
# POETRY
###############
alias ppy="poetry run python"
alias plint="poetry run pylint --rcfile=`git root`/.pylintrc"
install-all() {
pushd `git root`
ls -d */pyproject.toml | xargs -n1 dirname | xargs -I {} poetry -C {} install
popd
}
version-all() {
pushd `git root`
ls -d */pyproject.toml | xargs -n1 dirname | xargs -I {} poetry -C {} version $@
popd
}