diff --git a/Makefile b/Makefile index b088c7e..183c911 100644 --- a/Makefile +++ b/Makefile @@ -221,3 +221,12 @@ run-on-kind: $(CMD_PREFIX) kubectl create namespace instructlab-bot $(CMD_PREFIX) kubectl create -n instructlab-bot secret generic instructlab-bot --from-env-file=.env $(CMD_PREFIX) kubectl apply -k deploy/instructlab-bot/overlays/dev + +.PHONY: docker-clean +docker-clean: + @container_ids=$$(podman ps -a --format "{{.ID}}" | awk '{print $$1}'); \ + echo "removing all stopped containers (non-force)"; \ + for id in $$container_ids; do \ + echo "Removing container: $$id,"; \ + podman rm $$id; \ + done \ No newline at end of file diff --git a/gobot/cmd/root.go b/gobot/cmd/root.go index 3d4ceab..91fc6f0 100644 --- a/gobot/cmd/root.go +++ b/gobot/cmd/root.go @@ -67,6 +67,12 @@ func init() { rootCmd.PersistentFlags().StringSliceVarP(&Maintainers, "maintainers", "", []string{}, "GitHub users or groups that are considered maintainers") rootCmd.PersistentFlags().BoolVarP(&Debug, "debug", "d", false, "Enable debug logging") rootCmd.PersistentFlags().StringVarP(&BotUsername, "bot-username", "", "@instructlab-bot", "The username of the bot") + if GithubToken == "" { + GithubToken = os.Getenv("ILWORKER_GITHUB_TOKEN") + } + if GithubUsername == "" { + GithubUsername = os.Getenv("ILWORKER_GITHUB_USERNAME") + } } var rootCmd = &cobra.Command{ diff --git a/worker/Containerfile b/worker/Containerfile index 60cfc10..d5a19b6 100644 --- a/worker/Containerfile +++ b/worker/Containerfile @@ -5,7 +5,7 @@ ENV WORK_DIR /app WORKDIR ${WORK_DIR} -COPY . ${WORK_DIR}/instructlab-bot +COPY worker ${WORK_DIR}/instructlab-bot/worker # Build the worker binary WORKDIR ${WORK_DIR}/instructlab-bot/worker diff --git a/worker/cmd/generate.go b/worker/cmd/generate.go index 7e4647b..4df7d64 100644 --- a/worker/cmd/generate.go +++ b/worker/cmd/generate.go @@ -117,7 +117,7 @@ type IlabConfig struct { func init() { generateCmd.Flags().StringVarP(&WorkDir, "work-dir", "w", "", "Directory to work in") generateCmd.Flags().StringVarP(&VenvDir, "venv-dir", "v", "", "The virtual environment directory") - generateCmd.Flags().StringVarP(&PreCheckEndpointURL, "precheck-endpoint-url", "e", "http://localhost:8000/v1", "Endpoint hosting the model API. Default, it assumes the model is served locally.") + generateCmd.Flags().StringVarP(&PreCheckEndpointURL, "precheck-endpoint-url", "e", "", "Endpoint hosting the model API. Default, it assumes the model is served locally.") generateCmd.Flags().StringVarP(&SdgEndpointURL, "sdg-endpoint-url", "", "http://localhost:8000/v1", "Endpoint hosting the model API. Default, it assumes the model is served locally.") generateCmd.Flags().IntVarP(&NumInstructions, "num-instructions", "n", 10, "The number of instructions to generate") generateCmd.Flags().StringVarP(&GitRemote, "git-remote", "", "https://github.com/instructlab/taxonomy", "The git remote for the taxonomy repo") @@ -131,6 +131,20 @@ func init() { generateCmd.Flags().StringVarP(&TlsServerCaCertPath, "tls-server-ca-cert", "", "server-ca-crt.pem2", "Path to the TLS server CA certificate. Defaults to 'server-ca-crt.pem2'") generateCmd.Flags().BoolVarP(&TlsInsecure, "tls-insecure", "", false, "Whether to skip TLS verification") generateCmd.Flags().IntVarP(&MaxSeed, "max-seed", "m", 40, "Maximum number of seed Q&A pairs to process to SDG.") + if GithubToken == "" { + GithubToken = os.Getenv("ILWORKER_GITHUB_TOKEN") + } + if GithubUsername == "" { + GithubUsername = os.Getenv("ILWORKER_GITHUB_USERNAME") + } + if PreCheckEndpointURL == "" { + preCheckEndpointURLEnvValue := os.Getenv("PECHECK_ENDPOINT") + if preCheckEndpointURLEnvValue != "" { + PreCheckEndpointURL = preCheckEndpointURLEnvValue + } else { + PreCheckEndpointURL = localEndpoint + } + } _ = generateCmd.MarkFlagRequired("github-token") rootCmd.AddCommand(generateCmd) }