github.com/argoproj/argo-cd/v3@v3.2.1/Tiltfile (about) 1 load('ext://restart_process', 'docker_build_with_restart') 2 load('ext://uibutton', 'cmd_button', 'location') 3 4 # add ui button in web ui to run make codegen-local (top nav) 5 cmd_button( 6 'make codegen-local', 7 argv=['sh', '-c', 'make codegen-local'], 8 location=location.NAV, 9 icon_name='terminal', 10 text='make codegen-local', 11 ) 12 13 cmd_button( 14 'make test-local', 15 argv=['sh', '-c', 'make test-local'], 16 location=location.NAV, 17 icon_name='science', 18 text='make test-local', 19 ) 20 21 # add ui button in web ui to run make codegen-local (top nav) 22 cmd_button( 23 'make cli-local', 24 argv=['sh', '-c', 'make cli-local'], 25 location=location.NAV, 26 icon_name='terminal', 27 text='make cli-local', 28 ) 29 30 # detect cluster architecture for build 31 cluster_version = decode_yaml(local('kubectl version -o yaml')) 32 platform = cluster_version['serverVersion']['platform'] 33 arch = platform.split('/')[1] 34 35 # build the argocd binary on code changes 36 code_deps = [ 37 'applicationset', 38 'cmd', 39 'cmpserver', 40 'commitserver', 41 'common', 42 'controller', 43 'notification-controller', 44 'pkg', 45 'reposerver', 46 'server', 47 'util', 48 'go.mod', 49 'go.sum', 50 ] 51 local_resource( 52 'build', 53 'CGO_ENABLED=0 GOOS=linux GOARCH=' + arch + ' go build -gcflags="all=-N -l" -mod=readonly -o .tilt-bin/argocd_linux cmd/main.go', 54 deps = code_deps, 55 allow_parallel=True, 56 ) 57 58 # deploy the argocd manifests 59 k8s_yaml(kustomize('manifests/dev-tilt')) 60 61 # build dev image 62 docker_build_with_restart( 63 'argocd', 64 context='.', 65 dockerfile='Dockerfile.tilt', 66 entrypoint=[ 67 "/usr/bin/tini", 68 "-s", 69 "--", 70 "dlv", 71 "exec", 72 "--continue", 73 "--accept-multiclient", 74 "--headless", 75 "--listen=:2345", 76 "--api-version=2" 77 ], 78 platform=platform, 79 live_update=[ 80 sync('.tilt-bin/argocd_linux', '/usr/local/bin/argocd'), 81 ], 82 only=[ 83 '.tilt-bin', 84 'hack', 85 'entrypoint.sh', 86 ], 87 restart_file='/tilt/.restart-proc' 88 ) 89 90 # build image for argocd-cli jobs 91 docker_build( 92 'argocd-job', 93 context='.', 94 dockerfile='Dockerfile.tilt', 95 platform=platform, 96 only=[ 97 '.tilt-bin', 98 'hack', 99 'entrypoint.sh', 100 ] 101 ) 102 103 # track argocd-server resources and port forward 104 k8s_resource( 105 workload='argocd-server', 106 objects=[ 107 'argocd-server:serviceaccount', 108 'argocd-server:role', 109 'argocd-server:rolebinding', 110 'argocd-cm:configmap', 111 'argocd-cmd-params-cm:configmap', 112 'argocd-gpg-keys-cm:configmap', 113 'argocd-rbac-cm:configmap', 114 'argocd-ssh-known-hosts-cm:configmap', 115 'argocd-tls-certs-cm:configmap', 116 'argocd-secret:secret', 117 'argocd-server-network-policy:networkpolicy', 118 'argocd-server:clusterrolebinding', 119 'argocd-server:clusterrole', 120 ], 121 port_forwards=[ 122 '8080:8080', 123 '9345:2345', 124 '8083:8083' 125 ], 126 ) 127 128 # track crds 129 k8s_resource( 130 new_name='cluster-resources', 131 objects=[ 132 'applications.argoproj.io:customresourcedefinition', 133 'applicationsets.argoproj.io:customresourcedefinition', 134 'appprojects.argoproj.io:customresourcedefinition', 135 'argocd:namespace' 136 ] 137 ) 138 139 # track argocd-repo-server resources and port forward 140 k8s_resource( 141 workload='argocd-repo-server', 142 objects=[ 143 'argocd-repo-server:serviceaccount', 144 'argocd-repo-server-network-policy:networkpolicy', 145 ], 146 port_forwards=[ 147 '8081:8081', 148 '9346:2345', 149 '8084:8084' 150 ], 151 ) 152 153 # track argocd-redis resources and port forward 154 k8s_resource( 155 workload='argocd-redis', 156 objects=[ 157 'argocd-redis:serviceaccount', 158 'argocd-redis:role', 159 'argocd-redis:rolebinding', 160 'argocd-redis-network-policy:networkpolicy', 161 ], 162 port_forwards=[ 163 '6379:6379', 164 ], 165 ) 166 167 # track argocd-applicationset-controller resources 168 k8s_resource( 169 workload='argocd-applicationset-controller', 170 objects=[ 171 'argocd-applicationset-controller:serviceaccount', 172 'argocd-applicationset-controller-network-policy:networkpolicy', 173 'argocd-applicationset-controller:role', 174 'argocd-applicationset-controller:rolebinding', 175 'argocd-applicationset-controller:clusterrolebinding', 176 'argocd-applicationset-controller:clusterrole', 177 ], 178 port_forwards=[ 179 '9347:2345', 180 '8085:8080', 181 '7000:7000' 182 ], 183 ) 184 185 # track argocd-application-controller resources 186 k8s_resource( 187 workload='argocd-application-controller', 188 objects=[ 189 'argocd-application-controller:serviceaccount', 190 'argocd-application-controller-network-policy:networkpolicy', 191 'argocd-application-controller:role', 192 'argocd-application-controller:rolebinding', 193 'argocd-application-controller:clusterrolebinding', 194 'argocd-application-controller:clusterrole', 195 ], 196 port_forwards=[ 197 '9348:2345', 198 '8086:8082', 199 ], 200 ) 201 202 # track argocd-notifications-controller resources 203 k8s_resource( 204 workload='argocd-notifications-controller', 205 objects=[ 206 'argocd-notifications-controller:serviceaccount', 207 'argocd-notifications-controller-network-policy:networkpolicy', 208 'argocd-notifications-controller:role', 209 'argocd-notifications-controller:rolebinding', 210 'argocd-notifications-cm:configmap', 211 'argocd-notifications-secret:secret', 212 ], 213 port_forwards=[ 214 '9349:2345', 215 '8087:9001', 216 ], 217 ) 218 219 # track argocd-dex-server resources 220 k8s_resource( 221 workload='argocd-dex-server', 222 objects=[ 223 'argocd-dex-server:serviceaccount', 224 'argocd-dex-server-network-policy:networkpolicy', 225 'argocd-dex-server:role', 226 'argocd-dex-server:rolebinding', 227 ], 228 ) 229 230 # track argocd-commit-server resources 231 k8s_resource( 232 workload='argocd-commit-server', 233 objects=[ 234 'argocd-commit-server:serviceaccount', 235 'argocd-commit-server-network-policy:networkpolicy', 236 ], 237 port_forwards=[ 238 '9350:2345', 239 '8088:8087', 240 '8089:8086', 241 ], 242 ) 243 244 # docker for ui 245 docker_build( 246 'argocd-ui', 247 context='.', 248 dockerfile='Dockerfile.ui.tilt', 249 entrypoint=['sh', '-c', 'cd /app/ui && yarn start'], 250 only=['ui'], 251 live_update=[ 252 sync('ui', '/app/ui'), 253 run('sh -c "cd /app/ui && yarn install"', trigger=['/app/ui/package.json', '/app/ui/yarn.lock']), 254 ], 255 ) 256 257 # track argocd-ui resources and port forward 258 k8s_resource( 259 workload='argocd-ui', 260 port_forwards=[ 261 '4000:4000', 262 ], 263 ) 264 265 # linting 266 local_resource( 267 'lint', 268 'make lint-local', 269 deps = code_deps, 270 allow_parallel=True, 271 resource_deps=['vendor'] 272 ) 273 274 local_resource( 275 'lint-ui', 276 'make lint-ui-local', 277 deps = [ 278 'ui', 279 ], 280 allow_parallel=True, 281 ) 282 283 local_resource( 284 'vendor', 285 'go mod vendor', 286 deps = [ 287 'go.mod', 288 'go.sum', 289 ], 290 ) 291