diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml deleted file mode 100644 index ce7c56b06b..0000000000 --- a/.github/workflows/artifacts.yml +++ /dev/null @@ -1,155 +0,0 @@ -name: Artifacts -run-name: ๐Ÿ“ฆ Generate artifacts for ${{ github.event_name == 'issue_comment' && 'PR' || (github.event_name == 'release' && '๐Ÿท' || '๐ŸŒฑ') }} ${{github.event_name == 'issue_comment' && github.event.issue.number || github.ref_name}} - -# This workflow runs whenever the "build affected docker images" checkbox is checked (for PR) -# and also whenever a commit is pushed on main or a tag is pushed -on: - push: - branches: - - main - release: - types: [published] - issue_comment: - types: - - edited - -concurrency: - group: artifacts-${{ github.ref }} - cancel-in-progress: true - -env: - NODE_VERSION: 18.16.1 - # a list of apps to build and publish on releases - APP_NAMES: datafeeder,datahub,metadata-editor - -jobs: - checks: - if: github.event_name != 'issue_comment' || github.event.issue.pull_request - name: Check whether a deploy was requested on a PR - runs-on: ubuntu-latest - outputs: - shouldRun: ${{ github.event_name != 'issue_comment' || (contains(github.event.changes.body.from, '- [ ] ๐Ÿ“ฆ Build and push affected docker images') && contains(github.event.comment.body, '- [x] ๐Ÿ“ฆ Build and push affected docker images')) || '' }} - ref: ${{ github.event_name == 'issue_comment' && steps.comment-branch.outputs.head_ref || '' }} - - steps: - - uses: xt0rted/pull-request-comment-branch@v1 - if: github.event_name == 'issue_comment' - id: comment-branch - - build-archive-docker: - needs: checks - if: github.event_name != 'issue_comment' || needs.checks.outputs.shouldRun - name: Build and upload docker images and archives - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: ${{ needs.checks.outputs.ref }} # use the PR head ref if applicable; otherwise keep default behaviour - persist-credentials: false - fetch-depth: 0 - - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'npm' - - - name: Derive appropriate SHAs for base and head for `nx affected` commands - uses: nrwl/nx-set-shas@v2 - with: - main-branch-name: 'main' - - - name: Install dependencies - run: npm ci - - - name: Build all applications and produce archives - if: github.event_name == 'release' - run: | - npx nx run-many --projects=${{ env.APP_NAMES }} --target=build - tools/make-archive.sh ${{env.APP_NAMES}} - - - name: Upload archives to release - if: github.event_name == 'release' - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: dist/archives/* - file_glob: true - tag: ${{ github.ref }} - overwrite: true - - - name: Build docker images for all apps - if: github.event_name == 'release' - run: npx nx run-many --projects=${{ env.APP_NAMES }} --target=docker-build - - - name: Build docker images for affected apps - if: github.event_name != 'release' - # FIXME: excluding data-platform until it has a remote registry to be pushed - run: npx nx affected --target=docker-build --exclude=data-platform - - - name: Build docker images for tools - working-directory: tools - run: npm run pipelines:docker-build - - - name: Tag all docker images on main also as latest - if: github.event_name == 'push' # only happens when pushing on the main branch - run: docker image ls --format 'docker tag {{.Repository}}:{{.Tag}} {{.Repository}}:latest' --filter=reference='geonetwork/*' | bash - - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - - - name: Push all docker images - # list all docker images, keep only the ones in the geonetwork org, and call docker push for each of them - run: | - docker image ls --format '{{.Repository}}:{{.Tag}}' --filter=reference='geonetwork/*' | \ - xargs -r -L1 docker push $1 - - build-npm-package: - if: github.event_name != 'issue_comment' - name: Build and publish NPM package - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ needs.checks.outputs.ref }} # use the PR head ref if applicable; otherwise keep default behaviour - persist-credentials: false - fetch-depth: 0 - - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'npm' - registry-url: 'https://registry.npmjs.org' - - - name: Install dependencies - run: npm ci - - - name: Adjust package version according to branch & commit - working-directory: package - run: npm version $(../tools/print-dev-version.sh) --no-git-tag-version --allow-same-version - - - name: Build NPM package - working-directory: package - run: node generate-package.js - - - name: Publish NPM package with @dev tag - if: github.event_name != 'release' - working-directory: package/dist - run: npm publish --tag dev - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Publish NPM package - if: github.event_name == 'release' - working-directory: package/dist - run: npm publish --tag latest - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml deleted file mode 100644 index d9b51843a6..0000000000 --- a/.github/workflows/backport.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Backport - -on: - pull_request: - types: - - closed - - labeled - -jobs: - backport: - runs-on: ubuntu-22.04 - name: Backport - timeout-minutes: 5 - - steps: - - uses: camptocamp/backport-action@master - with: - token: ${{ secrets.BACKPORT_BOT_TOKEN }} diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml deleted file mode 100644 index 96aeaa13e3..0000000000 --- a/.github/workflows/checks.yml +++ /dev/null @@ -1,212 +0,0 @@ -name: Checks -run-name: ๐Ÿฉบ Quality assurance checks on ${{ github.event_name == 'pull_request' && 'PR' || '๐ŸŒฑ' }} ${{ github.event_name == 'pull_request' && github.event.number || github.ref_name }} - -env: - NODE_VERSION: 18.16.1 - TEST_HIDE_CONSOLE: true - -# This workflow runs for Pull Requests which are not draft, -# as well as commits going to the default branch -on: - push: - branches: - - main - pull_request: - types: [opened, synchronize, ready_for_review] - -# Only allow concurrent checks on the main branch to keep history -# on QA checks -concurrency: - group: checks-${{ github.ref }} - cancel-in-progress: ${{ github.ref_name != 'main' }} - -jobs: - format-lint-test: - if: github.event.pull_request.draft == false - name: Format check, lint, unit tests - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - persist-credentials: false - fetch-depth: 0 - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'npm' - - name: Derive appropriate SHAs for base and head for `nx affected` commands - uses: nrwl/nx-set-shas@v2 - with: - main-branch-name: 'main' - - run: npm ci - - run: npx nx format:check - - run: npx nx affected -t lint --parallel=3 - - run: npx nx affected -t test --parallel=3 --configuration=ci --ci --codeCoverage --coverageReporters=lcov - - - name: Coveralls - uses: coverallsapp/github-action@v2 - with: - allow-empty: true - - # - name: Archive Code Coverage Results (on main) - # if: github.event_name != 'pull_request' - # uses: actions/upload-artifact@v2 - # with: - # name: code-coverage-report - # path: ./coverage/**/coverage-summary.json - # if-no-files-found: error - # - # - name: Create Code Coverage Badge (on PR) - # if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' - # uses: dkhunt27/nx-code-coverage@v1 - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # coverage-folder: ./coverage - # coverage-base-folder: ./coverage-base - # gist-token: ${{ secrets.COVERAGE_GIST_TOKEN }} - # gist-id: c759fcfd4e71c8853beedbe1785fc081 - # color: green - # named-logo: jest - # no-coverage-ran: false - - build-affected: - if: github.event.pull_request.draft == false - name: Attempt to build affected apps - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - persist-credentials: false - fetch-depth: 0 - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'npm' - - name: Derive appropriate SHAs for base and head for `nx affected` commands - uses: nrwl/nx-set-shas@v2 - with: - main-branch-name: 'main' - - run: npm ci - - run: npx nx affected -t build --parallel=3 - - affected-recap: - if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' - name: Print affected libs and apps - runs-on: ubuntu-latest - - steps: - - name: Checkout branch - uses: actions/checkout@v3 - with: - persist-credentials: false - fetch-depth: 0 - - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'npm' - - - name: Derive appropriate SHAs for base and head for `nx affected` commands - uses: nrwl/nx-set-shas@v3 - - - name: Install dependencies - run: npm ci - - - name: Compute affected projects - run: | - echo "AFFECTED_LIBS=$(npx nx print-affected --type=lib --select=projects | awk 'BEGIN {RS = ", "; ORS = ", "} \ - { print "`"$1"`" }')" >> $GITHUB_ENV - - - name: Compute affected apps - run: | - echo "AFFECTED_APPS=$(npx nx print-affected --type=app --select=projects | awk 'BEGIN {RS = ", "; ORS = ", "} \ - { print "`"$1"`" }')" >> $GITHUB_ENV - - - name: add PR comment - uses: thollander/actions-comment-pull-request@v2 - with: - message: 'Affected libs: ${{ env.AFFECTED_LIBS }} - - Affected apps: ${{ env.AFFECTED_APPS }} - - - [ ] ๐Ÿš€ Build and deploy storybook and demo on GitHub Pages - - - [ ] ๐Ÿ“ฆ Build and push affected docker images' - comment_tag: build-options - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - cypress-run: - name: End-to-end tests - runs-on: ubuntu-latest - outputs: - screenshotsUrl: ${{ steps.upload-screenshots.outputs.artifact-url }} - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'npm' - - - name: Create pipeline docker image - run: cd tools && docker build . -f pipelines/Dockerfile -t geonetwork/geonetwork-ui-tools-pipelines:latest - - - name: Build the backend - run: sudo docker-compose -f support-services/docker-compose.yml up -d init - - - name: Install dependencies - run: | - npm ci - - - name: Run tests - run: npx nx run-many --target=e2e - - - uses: actions/upload-artifact@v4 - if: always() - id: upload-screenshots - with: - name: cypress-screenshots - path: | - apps/datahub-e2e/cypress/screenshots/**/* - apps/metadata-editor-e2e/cypress/screenshots/**/* - - - uses: thollander/actions-comment-pull-request@v2 - if: always() && github.event_name == 'pull_request' && steps.upload-screenshots.outputs.artifact-url - with: - message: '๐Ÿ“ท Screenshots are [here](${{ steps.upload-screenshots.outputs.artifact-url }})!' - comment_tag: screenshots-url - pr_number: ${{ github.event.number }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - build-npm-package: - if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' - name: Attempt to build the NPM package - runs-on: ubuntu-latest - - steps: - - name: Checkout branch - uses: actions/checkout@v3 - with: - persist-credentials: false - fetch-depth: 0 - - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'npm' - - - name: Install dependencies - run: npm ci - - - name: Build NPM package - working-directory: package - run: node generate-package.js diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml deleted file mode 100644 index c11079c823..0000000000 --- a/.github/workflows/cleanup.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Cleanup -run-name: ๐Ÿงน Cleanup operations for ๐ŸŒฑ ${{github.event.ref}} - -env: - # a list of apps to build and publish on releases - APP_NAMES: datafeeder,datahub,metadata-editor - -on: - delete: - branches: - - '*' - -jobs: - docker-cleanup: - name: Delete docker images on Dockerhub - runs-on: ubuntu-latest - - steps: - - name: generate Dockerhub auth - id: docker-auth - run: | - BASE_64_TOKEN=$(echo '{"username":"${{ secrets.DOCKER_HUB_USERNAME }}","password":"${{ secrets.DOCKER_HUB_PASSWORD }}","auth":"","email":"geonetworkbot@geonetwork-opensource.org"}' | base64) - echo ::add-mask::${BASE_64_TOKEN} - echo ::set-output name=DOCKER_AUTH::${BASE_64_TOKEN} - - - name: delete docker images for the given applications and branch - # first list apps separated by line breaks - # then for each do a curl call on Dockerhub API to delete the image - run: | - echo "${{ env.APP_NAMES }}" | awk -vRS=',' '{print $1}' | \ - xargs -I{} curl -X DELETE "https://hub.docker.com/v2/repositories/geonetwork/geonetwork-ui-{}/${{ github.event.ref }}/" -H "X-Registry-Auth: ${{steps.docker-auth.outputs.DOCKER_AUTH}}" - - storybook-cleanup: - name: Delete storybook files on Github Pages - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Remove directory ${{github.event.ref}} - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - touch .empty - npx gh-pages --dist . --src .empty --remove "${{github.event.ref}}" --no-history --repo "https://${GITHUB_ACTOR}:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 7320553d00..0000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: Deploy -run-name: ๐Ÿš€ Deploy to GitHub Pages for ${{ github.event_name == 'issue_comment' && 'PR' || '๐ŸŒฑ' }} ${{github.event_name == 'issue_comment' && github.event.issue.number || github.ref_name}} - -env: - NODE_VERSION: 18.16.1 - -# This workflow runs whenever the "deploy affected apps" checkbox is checked (for PR) -# or on every push to main -on: - push: - branches: - - main - issue_comment: - types: - - edited - -concurrency: - group: deploy-${{ github.ref }} - cancel-in-progress: true - -jobs: - checks: - if: github.event_name != 'issue_comment' || github.event.issue.pull_request - name: Check whether a deploy was requested on a PR - runs-on: ubuntu-latest - outputs: - shouldRun: ${{ github.event_name != 'issue_comment' || (contains(github.event.changes.body.from, '- [ ] ๐Ÿš€ Build and deploy storybook and demo on GitHub Pages') && contains(github.event.comment.body, '- [x] ๐Ÿš€ Build and deploy storybook and demo on GitHub Pages')) || '' }} - ref: ${{ github.event_name == 'issue_comment' && steps.comment-branch.outputs.head_ref || '' }} - - steps: - - uses: xt0rted/pull-request-comment-branch@v1 - if: github.event_name == 'issue_comment' - id: comment-branch - - gh-pages: - needs: checks - if: github.event_name != 'issue_comment' || needs.checks.outputs.shouldRun - name: Deploy Storybook to GitHub Pages - runs-on: ubuntu-latest - env: - BRANCH_NAME: ${{needs.checks.outputs.ref || 'main'}} - - steps: - - name: Dump GitHub event - env: - GITHUB_CONTEXT: ${{ toJson(github.event) }} - run: echo "$GITHUB_CONTEXT" - - - name: Checkout - uses: actions/checkout@v2 - with: - ref: ${{ needs.checks.outputs.ref }} - - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'npm' - - - name: add initial comment - uses: thollander/actions-comment-pull-request@v2 - if: github.event_name == 'issue_comment' - with: - message: 'GitHub Pages links: - - - ๐Ÿšง building in progress... ๐Ÿšง' - comment_tag: github-links - pr_number: ${{ github.event.issue.number }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Install - run: npm ci - - - name: Build storybook - run: npm run build:storybook - - - name: Build demo & web components - run: npm run build:demo - - - name: Build docs - run: npm run docs:build -- --base=/geonetwork-ui/${{env.BRANCH_NAME}}/docs/ && mkdir -p dist/docs && mv docs/.vitepress/dist/* dist/docs - - # FIXME: restore a system for testing web components but faster/lighter than storybook - # - name: Build storybook for web components - # run: npm run build:storybook-wc - - - name: Deploy to directory ${{ env.BRANCH_NAME }} - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - npx gh-pages --dist dist/ --dest ${{env.BRANCH_NAME}} --remove "${{env.BRANCH_NAME}}/**" --no-history --repo "https://${GITHUB_ACTOR}:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git" - - - name: update PR comment - uses: thollander/actions-comment-pull-request@v2 - if: github.event_name == 'issue_comment' - with: - message: 'GitHub Pages links: - - * (Documentation)[https://geonetwork.github.io/geonetwork-ui/${{env.BRANCH_NAME}}/docs/] - - * (Demo & web components)[https://geonetwork.github.io/geonetwork-ui/${{env.BRANCH_NAME}}/demo/] - - * (UI components storybook)[https://geonetwork.github.io/geonetwork-ui/${{env.BRANCH_NAME}}/storybook/demo/]' - comment_tag: github-links - pr_number: ${{ github.event.issue.number }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/snyk-security.yml b/.github/workflows/snyk-security.yml deleted file mode 100644 index e114be3fed..0000000000 --- a/.github/workflows/snyk-security.yml +++ /dev/null @@ -1,51 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# A sample workflow which sets up Snyk to analyze the full Snyk platform (Snyk Open Source, Snyk Code, -# Snyk Container and Snyk Infrastructure as Code) -# The setup installs the Snyk CLI - for more details on the possible commands -# check https://docs.snyk.io/snyk-cli/cli-reference -# The results of Snyk Code are then uploaded to GitHub Security Code Scanning -# -# In order to use the Snyk Action you will need to have a Snyk API token. -# More details in https://github.com/snyk/actions#getting-your-snyk-token -# or you can signup for free at https://snyk.io/login -# -# For more examples, including how to limit scans to only high-severity issues -# and fail PR checks, see https://github.com/snyk/actions/ - -name: Snyk Security -run-name: ๐Ÿบ Run Snyk on ${{ github.event_name == 'pull_request' && 'PR' || '๐ŸŒฑ' }} ${{ github.event_name == 'pull_request' && github.event.number || github.ref_name }} - -on: - push: - branches: ['main'] - pull_request: - types: [opened, synchronize, ready_for_review] - -permissions: - contents: read - -jobs: - security: - permissions: - contents: read # for actions/checkout to fetch code - security-events: write # for github/codeql-action/upload-sarif to upload SARIF results - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Run Snyk to check for vulnerabilities - uses: snyk/actions/node@master - continue-on-error: true # To make sure that SARIF upload gets called - env: - SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} - with: - args: --sarif-file-output=snyk.sarif - - - name: Upload result to GitHub Code Scanning - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: snyk.sarif diff --git a/.github/workflows/webcomponents.yml b/.github/workflows/webcomponents.yml deleted file mode 100644 index e090eb78bb..0000000000 --- a/.github/workflows/webcomponents.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Web Components -run-name: ๐Ÿงฉ Build Web Components for ${{ github.event_name == 'issue_comment' && 'PR' || (github.event_name == 'release' && '๐Ÿท' || '๐ŸŒฑ') }} ${{github.event_name == 'issue_comment' && github.event.issue.number || github.ref_name}} - -# This workflow runs whenever a commit is pushed on main or a release is published -on: - push: - branches: - - main - tags: - - 'v*.*.*' - release: - types: [published] - -concurrency: - group: webcomponents-${{ github.ref }} - cancel-in-progress: true - -env: - NODE_VERSION: 18.16.1 - PUBLISH_BRANCH: wc-dist - -jobs: - build-publish-script: - name: Build and publish the Web Components - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: ${{ needs.checks.outputs.ref }} - persist-credentials: false - fetch-depth: 0 - - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'npm' - - - name: Install dependencies - run: npm ci - - - name: Build webcomponents script - run: | - mkdir wc-dist - npm run build:demo - mv dist/demo/webcomponents/gn-wc.js wc-dist - - - name: Upload archives to release - if: github.event_name == 'release' - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: wc-dist/gn-wc.js - tag: ${{ github.ref }} - overwrite: true - - - name: Publish web component to ${{ env.PUBLISH_BRANCH }}-${{ github.ref_name }} branch - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - force_orphan: true - publish_dir: ./wc-dist - publish_branch: ${{ env.PUBLISH_BRANCH }}-${{ github.ref_name }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..561d04f5e4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM nginx:1.21.4-alpine + +RUN rm -rf /usr/share/nginx/html/* +COPY dist/apps/datafeeder /usr/share/nginx/html +COPY nginx-default.conf /etc/nginx/conf.d/default.conf +COPY docker/copy-custom-scripts.sh /copy-custom-scripts.sh +EXPOSE 80 + +ENTRYPOINT ["/copy-custom-scripts.sh"] +CMD ["nginx", "-g", "daemon off;"] diff --git a/apps/datafeeder/project.json b/apps/datafeeder/project.json index 6c45155084..e29b72373d 100644 --- a/apps/datafeeder/project.json +++ b/apps/datafeeder/project.json @@ -109,8 +109,8 @@ "executor": "nx:run-commands", "options": { "commands": [ - "nx build datafeeder --base-href='/datafeeder/'", - "docker build --build-arg APP_NAME=datafeeder -f ./tools/docker/Dockerfile.apps . -t $(tools/print-docker-tag.sh datafeeder)" + "nx build datafeeder --base-href='/import/'", + "docker build . -t georchestra/datafeeder-frontend:latest" ], "parallel": false } diff --git a/apps/datafeeder/src/app/app.component.spec.ts b/apps/datafeeder/src/app/app.component.spec.ts index 9cb644a6f9..76f8dd64a0 100644 --- a/apps/datafeeder/src/app/app.component.spec.ts +++ b/apps/datafeeder/src/app/app.component.spec.ts @@ -1,24 +1,28 @@ import { TestBed } from '@angular/core/testing' import { RouterTestingModule } from '@angular/router/testing' import { AppComponent } from './app.component' +import { UtilSharedModule } from '@geonetwork-ui/util/shared' describe('AppComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [RouterTestingModule], + imports: [RouterTestingModule, UtilSharedModule], declarations: [AppComponent], }).compileComponents() }) - it('should create the app', () => { - const fixture = TestBed.createComponent(AppComponent) - const app = fixture.componentInstance - expect(app).toBeTruthy() - }) - - it(`should have as title 'datafeeder'`, () => { - const fixture = TestBed.createComponent(AppComponent) - const app = fixture.componentInstance - expect(app.title).toEqual('datafeeder') + describe('', () => { + let fixture + let app + beforeEach(async () => { + fixture = TestBed.createComponent(AppComponent) + app = fixture.componentInstance + }) + it('should create the app', () => { + expect(app).toBeTruthy() + }) + it(`should have as title 'datafeeder'`, () => { + expect(app.title).toEqual('datafeeder') + }) }) }) diff --git a/apps/datafeeder/src/app/app.module.ts b/apps/datafeeder/src/app/app.module.ts index 71dfe67482..96bb8d8ca6 100644 --- a/apps/datafeeder/src/app/app.module.ts +++ b/apps/datafeeder/src/app/app.module.ts @@ -39,6 +39,7 @@ import { FeatureAuthModule } from '@geonetwork-ui/feature/auth' import { MatIconModule } from '@angular/material/icon' import { BrowserAnimationsModule } from '@angular/platform-browser/animations' import { DatasetValidationCsvPageComponent } from './presentation/pages/dataset-validation-csv-page/dataset-validation-csv-page' +import { UtilSharedModule } from '@geonetwork-ui/util/shared' export function apiConfigurationFactory() { return new Configuration({ @@ -78,6 +79,7 @@ export function apiConfigurationFactory() { HttpClientModule, MatIconModule, UtilI18nModule, + UtilSharedModule, FeatureEditorModule, BrowserAnimationsModule, ApiModule.forRoot(apiConfigurationFactory), diff --git a/apps/datafeeder/src/index.html b/apps/datafeeder/src/index.html index b064b2f0e9..c7d6a67b48 100644 --- a/apps/datafeeder/src/index.html +++ b/apps/datafeeder/src/index.html @@ -3,14 +3,13 @@ Datafeeder - + -
HEADER
diff --git a/docker/copy-custom-scripts.sh b/docker/copy-custom-scripts.sh new file mode 100755 index 0000000000..2e75d62554 --- /dev/null +++ b/docker/copy-custom-scripts.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +DIR=/docker-entrypoint.d + +# Executing custom scripts located in CUSTOM_SCRIPTS_DIRECTORY if environment variable is set +if [[ -z "${CUSTOM_SCRIPTS_DIRECTORY}" ]]; then + echo "[INFO] No CUSTOM_SCRIPTS_DIRECTORY env variable set" +else + echo "[INFO] CUSTOM_SCRIPTS_DIRECTORY env variable set to ${CUSTOM_SCRIPTS_DIRECTORY}" + cp -v "${CUSTOM_SCRIPTS_DIRECTORY}"/* "$DIR" + echo "[INFO] End copying custom scripts" +fi + +exec /docker-entrypoint.sh "$@" diff --git a/nginx-default.conf b/nginx-default.conf new file mode 100644 index 0000000000..dc4263bf6e --- /dev/null +++ b/nginx-default.conf @@ -0,0 +1,14 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html index.htm; + location ~ "^/[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}.*$" { + alias /usr/share/nginx/html/index.html; + add_header "content-type" "text/html"; + } + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} diff --git a/nx.json b/nx.json index 561c05319e..75a44ed38c 100644 --- a/nx.json +++ b/nx.json @@ -1,11 +1,11 @@ { "affected": { - "defaultBase": "remotes/origin/main" + "defaultBase": "remotes/origin/georchestra-datafeeder" }, "npmScope": "geonetwork-ui", "tasksRunnerOptions": { "default": { - "runner": "nx-cloud", + "runner": "nx/tasks-runners/default", "options": { "cacheableOperations": [ "build", diff --git a/proxy-config.js b/proxy-config.js index e492ffdbc8..c26fc7eb60 100644 --- a/proxy-config.js +++ b/proxy-config.js @@ -18,7 +18,10 @@ module.exports = { router: (req) => decodeURIComponent(req._parsedUrl.query), }, '/datafeeder': { - target: 'http://localhost:8181', + target: 'http://localhost:8080', + pathRewrite: { + '^/datafeeder/': '/import/', + }, secure: true, logLevel: 'debug', changeOrigin: true,