Repository navigation
Configure Harbor registry for Docker builds #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
12e28b1
Configure Harbor registry for Docker builds and self-hosted runners
surrealwolf 8e9e0b4
feat: add GitLab push job as separate stage
surrealwolf 0b9c56f
feat: add GitLab push job as separate stage
surrealwolf f7a8e33
fix: update workflow syntax and add security job to push dependencies
surrealwolf e8f07db
ci: add GitLab CI for Docker builds only (tests run on GitHub)
surrealwolf a95bff9
chore: remove Docker workflow from auto-approve (moved to GitLab)
surrealwolf 58f1ec6
chore: remove Docker workflow files (moved to GitLab CI)
surrealwolf eae285a
docs: remove Harbor setup documentation (moved to GitLab CI)
surrealwolf b5adee3
fix: apply Copilot review suggestions
surrealwolf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,65 +1,83 @@ | ||
| name: Tests | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: [main, develop] | ||
| branches: | ||
| - main | ||
| - develop | ||
| pull_request: | ||
| branches: [main, develop] | ||
|
|
||
| branches: | ||
| - main | ||
| - develop | ||
| jobs: | ||
| test: | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| python-version: ['3.13', '3.14'] | ||
|
|
||
| os: | ||
| - ubuntu-latest | ||
| - macos-latest | ||
| - windows-latest | ||
| python-version: | ||
| - '3.13' | ||
| - '3.14' | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -e ".[dev]" | ||
|
|
||
| - name: Run linters | ||
| run: | | ||
| ruff check src tests | ||
| mypy src --ignore-missing-imports | ||
|
|
||
| - name: Run tests with coverage | ||
| run: | | ||
| pytest --cov=src --cov-report=xml --cov-report=term --cov-fail-under=80 | ||
|
|
||
| - name: Upload coverage reports | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| files: ./coverage.xml | ||
| flags: unittests | ||
| name: codecov-umbrella | ||
| fail_ci_if_error: false | ||
|
|
||
| - uses: actions/checkout@v5 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -e ".[dev]" | ||
| - name: Run linters | ||
| run: | | ||
| ruff check src tests | ||
| mypy src --ignore-missing-imports | ||
| - name: Run tests with coverage | ||
| run: pytest --cov=src --cov-report=xml --cov-report=term --cov-fail-under=80 | ||
| - name: Upload coverage reports | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| files: ./coverage.xml | ||
| flags: unittests | ||
| name: codecov-umbrella | ||
| fail_ci_if_error: false | ||
| security: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.14' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install bandit safety | ||
|
|
||
| - name: Run security checks | ||
| run: | | ||
| bandit -r src -f json -o bandit-report.json || true | ||
| safety check --json || true | ||
| - uses: actions/checkout@v5 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.14' | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install bandit safety | ||
| - name: Run security checks | ||
| run: | | ||
| bandit -r src -f json -o bandit-report.json || true | ||
| safety check --json || true | ||
| push-to-gitlab: | ||
| name: Push to GitLab | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - test | ||
| if: always() && needs.test.result == 'success' | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Push to GitLab | ||
| env: | ||
| GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} | ||
| 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 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" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| stages: | ||
| - build | ||
|
|
||
| variables: | ||
| HARBOR_REGISTRY: harbor.dataknife.net | ||
| HARBOR_PROJECT: library | ||
| IMAGE_NAME: high-command-api | ||
|
|
||
| docker-build: | ||
| stage: build | ||
| image: docker:latest | ||
| services: | ||
| - docker:dind | ||
| before_script: | ||
| - echo "$HARBOR_PASSWORD" | docker login -u "$HARBOR_USERNAME" --password-stdin $HARBOR_REGISTRY | ||
| script: | ||
| - | | ||
| # Build image once | ||
| docker build -t $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:latest . | ||
|
|
||
| # Tag with commit SHA | ||
| docker tag $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:latest \ | ||
| $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA | ||
|
|
||
| # Push images | ||
| docker push $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:latest | ||
| docker push $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA | ||
|
|
||
| # Tag with version if tag exists | ||
| if [ -n "$CI_COMMIT_TAG" ]; then | ||
| docker tag $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:latest \ | ||
| $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:$CI_COMMIT_TAG | ||
| docker push $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:$CI_COMMIT_TAG | ||
| fi | ||
| rules: | ||
| - if: '$CI_COMMIT_BRANCH == "main"' | ||
| - if: '$CI_COMMIT_TAG' | ||
| tags: | ||
| - docker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.