From d85b9110d966b000cc307680fb2dd769a9f05221 Mon Sep 17 00:00:00 2001 From: Lee Chapman Date: Thu, 8 Jan 2026 23:47:07 -0800 Subject: [PATCH 1/8] Configure Harbor registry for Docker builds and self-hosted runners --- .github/HARBOR_SETUP.md | 72 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/HARBOR_SETUP.md diff --git a/.github/HARBOR_SETUP.md b/.github/HARBOR_SETUP.md new file mode 100644 index 0000000..aa0b64b --- /dev/null +++ b/.github/HARBOR_SETUP.md @@ -0,0 +1,72 @@ +# Harbor Registry Setup + +This project uses Harbor registry at `harbor.dataknife.net` for Docker image storage. + +## GitHub Secrets Configuration + +To enable automated builds and pushes to Harbor, you need to configure the following secrets in your GitHub repository: + +### Required Secrets + +1. **HARBOR_USERNAME**: Harbor robot account username + +2. **HARBOR_PASSWORD**: Harbor robot account password/token + +### Setting up GitHub Secrets + +You can set secrets using the GitHub CLI: + +```bash +gh secret set HARBOR_USERNAME --repo / --body "your-harbor-username" +gh secret set HARBOR_PASSWORD --repo / --body "your-harbor-password" +``` + +Or via the web UI: +1. Go to your GitHub repository +2. Navigate to **Settings** → **Secrets and variables** → **Actions** +3. Click **New repository secret** +4. Add the secrets (values should be obtained from your Harbor administrator) + +## Local Development + +For local development, you can set environment variables: + +```bash +export HARBOR_USERNAME='your-harbor-username' +export HARBOR_PASSWORD='your-harbor-password' +``` + +Then use the Makefile targets: + +```bash +# Login to Harbor +make docker-login + +# Build and push images +make docker-push + +# Pull images +make docker-pull +``` + +## Docker Image Location + +The image is stored in the Harbor registry: +- `harbor.dataknife.net/library/high-command-api:latest` + +## Using Docker Compose + +Docker Compose is configured to pull images from Harbor automatically. Just run: + +```bash +docker-compose pull +docker-compose up -d +``` + +Make sure you're logged into Harbor first: + +```bash +docker login harbor.dataknife.net \ + -u 'your-harbor-username' \ + -p 'your-harbor-password' +``` From d22ca8b976a0df5a8f41c9671ebf623fe15f8390 Mon Sep 17 00:00:00 2001 From: Lee Chapman Date: Sat, 10 Jan 2026 13:20:52 -0800 Subject: [PATCH 2/8] feat: add GitLab push job as separate stage --- .github/workflows/tests.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 36ccbc2..bef0455 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -77,7 +77,8 @@ jobs: run: | git config user.name "GitHub Actions" git config user.email "actions@github.com" - git remote add gitlab https://gitlab.com/dk-raas/dkai/high-command/high-command-api.git || true + git remote remove gitlab 2>/dev/null || true + git remote add gitlab https://gitlab.com/dk-raas/dkai/high-command/high-command-api.git git config credential.helper '!f() { echo "username=oauth2"; echo "password=${GITLAB_TOKEN}"; }; f' - git fetch gitlab main || true - git push gitlab HEAD:main || echo "GitLab push failed" + git fetch gitlab main + git push gitlab HEAD:main From 4a59074ab8617af147ed905cd84ee0f234002d2b Mon Sep 17 00:00:00 2001 From: Lee Chapman Date: Sat, 10 Jan 2026 14:18:20 -0800 Subject: [PATCH 3/8] docs: remove Harbor setup documentation (moved to GitLab CI) --- .github/HARBOR_SETUP.md | 72 ----------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 .github/HARBOR_SETUP.md diff --git a/.github/HARBOR_SETUP.md b/.github/HARBOR_SETUP.md deleted file mode 100644 index aa0b64b..0000000 --- a/.github/HARBOR_SETUP.md +++ /dev/null @@ -1,72 +0,0 @@ -# Harbor Registry Setup - -This project uses Harbor registry at `harbor.dataknife.net` for Docker image storage. - -## GitHub Secrets Configuration - -To enable automated builds and pushes to Harbor, you need to configure the following secrets in your GitHub repository: - -### Required Secrets - -1. **HARBOR_USERNAME**: Harbor robot account username - -2. **HARBOR_PASSWORD**: Harbor robot account password/token - -### Setting up GitHub Secrets - -You can set secrets using the GitHub CLI: - -```bash -gh secret set HARBOR_USERNAME --repo / --body "your-harbor-username" -gh secret set HARBOR_PASSWORD --repo / --body "your-harbor-password" -``` - -Or via the web UI: -1. Go to your GitHub repository -2. Navigate to **Settings** → **Secrets and variables** → **Actions** -3. Click **New repository secret** -4. Add the secrets (values should be obtained from your Harbor administrator) - -## Local Development - -For local development, you can set environment variables: - -```bash -export HARBOR_USERNAME='your-harbor-username' -export HARBOR_PASSWORD='your-harbor-password' -``` - -Then use the Makefile targets: - -```bash -# Login to Harbor -make docker-login - -# Build and push images -make docker-push - -# Pull images -make docker-pull -``` - -## Docker Image Location - -The image is stored in the Harbor registry: -- `harbor.dataknife.net/library/high-command-api:latest` - -## Using Docker Compose - -Docker Compose is configured to pull images from Harbor automatically. Just run: - -```bash -docker-compose pull -docker-compose up -d -``` - -Make sure you're logged into Harbor first: - -```bash -docker login harbor.dataknife.net \ - -u 'your-harbor-username' \ - -p 'your-harbor-password' -``` From afac241113c0517a152e7b458d49e1d6632275b6 Mon Sep 17 00:00:00 2001 From: Lee Chapman Date: Sat, 10 Jan 2026 14:43:38 -0800 Subject: [PATCH 4/8] fix: remove error masking in GitLab push job - Remove '|| echo' that was masking push failures - Remove '|| true' from git fetch to catch fetch errors - Add git remote remove to avoid conflicts - Job will now properly fail when push fails --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bef0455..502b40b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,6 +71,7 @@ jobs: uses: actions/checkout@v5 with: fetch-depth: 0 +<<<<<<< HEAD - name: Push to GitLab env: GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} From f8bcdeb38acecd5151fd3c7f167d1488ce603dd6 Mon Sep 17 00:00:00 2001 From: Lee Chapman Date: Sat, 10 Jan 2026 14:47:27 -0800 Subject: [PATCH 5/8] fix: correct indentation for Push to GitLab step --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 502b40b..a83759f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -72,6 +72,9 @@ jobs: with: fetch-depth: 0 <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 3d8c72d (fix: correct indentation for Push to GitLab step) - name: Push to GitLab env: GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} From 788c37ed90de532e735dbf7c0d8fe6ecedc18383 Mon Sep 17 00:00:00 2001 From: Lee Chapman Date: Sat, 10 Jan 2026 14:49:55 -0800 Subject: [PATCH 6/8] feat: use local build for docker-compose - Change docker-compose to build from local Dockerfile - Use local image names instead of Harbor registry - Add commented Harbor image option for production deployments - Enables local development without Harbor access --- docker-compose.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2bddb0c..113cd8e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,12 @@ version: '3.8' services: api: - image: harbor.dataknife.net/library/high-command-api:latest + build: + context: . + dockerfile: Dockerfile + image: high-command-api:latest + # Alternative: Use Harbor image for production deployments + # image: harbor.dataknife.net/library/high-command-api:latest ports: - "5000:5000" environment: From 41c3e44ceec8f56716ca445fce22babc3073e907 Mon Sep 17 00:00:00 2001 From: Lee Chapman Date: Sat, 10 Jan 2026 14:54:11 -0800 Subject: [PATCH 7/8] fix: correct indentation in auto-approve workflow --- .github/workflows/auto-approve.yml | 2 +- .github/workflows/tests.yml | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index 64d6ffc..a8c3c4a 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -2,7 +2,7 @@ name: Auto Approve on: workflow_run: - workflows: [Tests] + workflows: [Tests] types: [completed] jobs: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a83759f..bef0455 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,10 +71,6 @@ jobs: uses: actions/checkout@v5 with: fetch-depth: 0 -<<<<<<< HEAD -<<<<<<< HEAD -======= ->>>>>>> 3d8c72d (fix: correct indentation for Push to GitLab step) - name: Push to GitLab env: GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} From c42644b954b6e9bbca6dcc55adfbf1cb2855fa95 Mon Sep 17 00:00:00 2001 From: Lee Chapman Date: Sat, 10 Jan 2026 15:37:33 -0800 Subject: [PATCH 8/8] fix: only run push-to-gitlab on main branch pushes, not PRs - Add condition to skip push-to-gitlab job on pull_request events - Only run on push events to main branch: github.event_name == 'push' && github.ref == 'refs/heads/main' - Add git pull before push to handle GitLab being ahead - Fixes non-fast-forward errors when PRs tried to push to GitLab --- .github/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bef0455..690c7a0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,7 +65,7 @@ jobs: runs-on: ubuntu-latest needs: - test - if: always() && needs.test.result == 'success' + if: always() && needs.test.result == 'success' && github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - name: Checkout code uses: actions/checkout@v5 @@ -81,4 +81,5 @@ jobs: git remote add gitlab https://gitlab.com/dk-raas/dkai/high-command/high-command-api.git git config credential.helper '!f() { echo "username=oauth2"; echo "password=${GITLAB_TOKEN}"; }; f' git fetch gitlab main + git pull gitlab main --no-edit git push gitlab HEAD:main