-
Notifications
You must be signed in to change notification settings - Fork 0
Configure Harbor registry for Docker builds #7
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
8 commits
Select commit
Hold shift + click to select a range
9727974
Configure Harbor registry for Docker builds and self-hosted runners
surrealwolf 73a0e2a
feat: add GitLab push job as separate stage
surrealwolf cb7f02b
fix: update workflow syntax and add security job to push dependencies
surrealwolf 624cf3e
ci: add GitLab CI for Docker builds only (tests run on GitHub)
surrealwolf 52aa6cd
chore: remove Docker workflow files (moved to GitLab CI)
surrealwolf a1c8f94
refactor: rename ci.yml to tests.yml
surrealwolf d1c5e5b
docs: remove Harbor setup documentation (moved to GitLab CI)
surrealwolf 8f664e3
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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| name: Tests | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
| - develop | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - develop | ||
| jobs: | ||
| test-and-build: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| node-version: | ||
| - 18.x | ||
| - 20.x | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| cache: 'npm' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Run ESLint | ||
| run: npm run lint | ||
| continue-on-error: true | ||
| - name: Run type checking | ||
| run: npm run build -- --mode lib | ||
| continue-on-error: true | ||
| - name: Check TypeScript compilation | ||
| run: tsc --noEmit | ||
| - name: Run tests | ||
| run: npm test -- --run | ||
| continue-on-error: true | ||
| - name: Build production bundle | ||
| run: npm run build | ||
| - name: Upload build artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: dist-node-${{ matrix.node-version }} | ||
| path: dist/ | ||
| retention-days: 5 | ||
| - name: Report build summary | ||
| run: | | ||
| echo "## Build Summary" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "✓ TypeScript type checking passed" >> $GITHUB_STEP_SUMMARY | ||
| echo "✓ Production build successful" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "**Artifacts:**" >> $GITHUB_STEP_SUMMARY | ||
| echo "- dist/ directory built with Node ${{ matrix.node-version }}" >> $GITHUB_STEP_SUMMARY | ||
| push-to-gitlab: | ||
| name: Push to GitLab | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - test-and-build | ||
| if: always() && needs.test-and-build.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-ui.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-ui | ||
|
|
||
| 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
Oops, something went wrong.
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.