Skip to content
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

feat(cogify): improve cogify #2800

Merged
merged 36 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7dc3c46
feat(cogify): detect if running inside of argo and output parameters …
blacha May 17, 2023
6648666
refactor: remove build for fork
blacha May 17, 2023
1ce2602
refactor: use github.repository for forks
blacha May 17, 2023
86af1a0
refactor: simplify build for just the cli
blacha May 17, 2023
0f1ec99
ci: add docker labels
blacha May 17, 2023
e2f5536
ci: just use repo name
blacha May 17, 2023
30900a0
ci: push container
blacha May 17, 2023
402f9bf
ci: try different login
blacha May 17, 2023
ecceaa8
ci: give package permissions
blacha May 17, 2023
d71d534
feat(cogify): use urls to allow for relative paths
blacha May 18, 2023
03923e9
doc: explain need for url
blacha May 18, 2023
c08a369
fix(cogify): ensure permissions are registered
blacha May 18, 2023
38aff6d
feat(cogify): more debugging logs
blacha May 18, 2023
c015f7d
fixme(cogify): limit to 5 tiffs
blacha May 18, 2023
85ff901
fix(cogify): validate outptu file
blacha May 18, 2023
0c5bd2c
feat(cogify): use a hash transform stream
blacha May 19, 2023
6f471fa
fix(cogify): update stac with hash and checksum
blacha May 19, 2023
755838c
fix: ensure stac actually validates
blacha May 23, 2023
6697841
fix: do not allow digest to be called twice
blacha May 23, 2023
cf80457
refactor: put extra unique id back
blacha May 23, 2023
5409112
feat: add debugging --limit
blacha May 23, 2023
36ec504
feat: give a full json object of configuration output
blacha May 23, 2023
0a7e459
feat: full json object doesnt work in argo
blacha May 23, 2023
5b52247
feat(cogify): create basemaps config from output imageyr
blacha May 23, 2023
4afe8cb
refactor: split parsers into own file
blacha May 23, 2023
c0e60c0
refactor: do not have two log messages for "done"
blacha May 23, 2023
3639636
fix: correct location url
blacha May 23, 2023
fbb2e7f
feat: expose more information in the log for imagery config
blacha May 23, 2023
57fdbc9
feat: include more checksum and file sizes
blacha May 24, 2023
7c9bcc7
refactor: put workflows back
blacha May 24, 2023
fdb7002
refactor: put workflows back
blacha May 24, 2023
cefcf93
refactor: fixup whitespace
blacha May 24, 2023
53bda3d
refactor: add comment for why head is needed
blacha May 24, 2023
2236bd9
refactor: comment more functions
blacha May 24, 2023
2a3a35e
refactor: apply prettier to .github
blacha May 24, 2023
718c661
Merge branch 'master' into feat/basemaps-cogify
blacha Jun 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@ labels: bug
---

### Bug Description

A clear and concise description of what the bug is and what you expected to happen.

#### Steps to Reproduce

Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

#### Desktop
- Environment: [e.g. Windows / DaaS / Ubuntu]
- Relevant Software Versions [e.g. QGIS 2.18.21]

- Environment: [e.g. Windows / DaaS / Ubuntu]
- Relevant Software Versions [e.g. QGIS 2.18.21]

#### Screenshots

If applicable, add screenshots to help explain your problem.

**Add an _Assignee_, _Milestone_, _Release_ and any relevant _Labels_.**
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
name: Feature request
about: Suggest an idea for this project
labels: enhancement

---

### User Story

In order to [accomplish goal] as a [role] I want [capability]
In order to [accomplish goal] as a [role] I want [capability]
(optional: instead of [existing behaviour]).

#### Acceptance Criteria

- [ ] ...
- [ ] ...
- [ ] ...
Expand Down
26 changes: 13 additions & 13 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
ignore:
- dependency-name: '@aws-cdk/*'
- dependency-name: 'aws-cdk'
- dependency-name: 'aws-sdk'
open-pull-requests-limit: 10
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: daily
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
ignore:
- dependency-name: '@aws-cdk/*'
- dependency-name: 'aws-cdk'
- dependency-name: 'aws-sdk'
open-pull-requests-limit: 10
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "Code Scanning - Action"
name: 'Code Scanning - Action'

on:
on:
push:
branches:
- master
- master

jobs:
CodeQL-Build:
Expand All @@ -25,4 +25,4 @@ jobs:
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v2
14 changes: 7 additions & 7 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
npx lerna run bundle --stream
npm pack --workspaces
env:
NODE_ENV: "production"
NODE_ENV: 'production'

- name: Set up Docker Qemu
id: qemu
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: "@basemaps/cli - Build and push"
- name: '@basemaps/cli - Build and push'
uses: docker/build-push-action@v3
with:
context: packages/cli
Expand All @@ -64,7 +64,7 @@ jobs:
ghcr.io/linz/basemaps/cli:${{ steps.version.outputs.version }}
push: ${{github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:') == false}}

- name: "@basemaps/cli - Build and push Major/Minor"
- name: '@basemaps/cli - Build and push Major/Minor'
uses: docker/build-push-action@v3
with:
context: packages/cli
Expand All @@ -78,17 +78,17 @@ jobs:

push: ${{github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:')}}

- name: "@basemaps/server - Build and push"
- name: '@basemaps/server - Build and push'
uses: docker/build-push-action@v3
with:
context: packages/server
platforms: linux/arm64,linux/amd64
tags: |
ghcr.io/linz/basemaps/server:latest
ghcr.io/linz/basemaps/server:${{ steps.version.outputs.version }}
ghcr.io/linz/basemaps/server:latest
ghcr.io/linz/basemaps/server:${{ steps.version.outputs.version }}
push: ${{github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:') == false}}

- name: "@basemaps/server - Build and push Major/Minor"
- name: '@basemaps/server - Build and push Major/Minor'
uses: docker/build-push-action@v3
with:
context: packages/cli
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ jobs:
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

CURRENT_VERSION=$(node -p "require('./lerna.json').version")
git tag v${CURRENT_VERSION} -m v${CURRENT_VERSION}
git push --tags

- name: Deploy - Bundle
if: github.ref != 'refs/heads/master' || github.repository != 'linz/basemaps'
run: npx lerna run bundle --stream
Expand All @@ -58,7 +56,7 @@ jobs:
env:
SPLIT_IO_KEY: ${{secrets.SPLIT_IO_KEY_NON_PROD}}
GOOGLE_ANALYTICS: ${{secrets.GOOGLE_ANALYTICS_NON_PROD}}
NODE_ENV: "dev"
NODE_ENV: 'dev'

- name: (NonProd) After Deploy Smoke Test
if: github.ref == 'refs/heads/master' && github.repository == 'linz/basemaps'
Expand All @@ -82,7 +80,7 @@ jobs:
cp *.tgz packages/cli
npx lerna run deploy:deploy --stream
env:
NODE_ENV: "production"
NODE_ENV: 'production'
GOOGLE_ANALYTICS: ${{secrets.GOOGLE_ANALYTICS_PROD}}
SPLIT_IO_KEY: ${{secrets.SPLIT_IO_KEY_PROD}}

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/screenshot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: screenshot

on:
on:
pull_request:
push:
branches:
Expand All @@ -24,24 +24,24 @@ jobs:
npx lerna run bundle --stream
npm pack --workspaces
env:
NODE_ENV: "production"
NODE_ENV: 'production'

- name: (NonProd) Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-region: ap-southeast-2
mask-aws-account-id: true
role-to-assume: ${{ secrets.AWS_ROLE_SCREENSHOT }}

- name: (Screenshot) Screenshot Pull Request Changes
run: |
./packages/cli/bin/bmc.js serve --config s3://linz-basemaps/config/config-latest.json.gz &

# Wait for the server to start
timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:5000/v1/version)" != "200" ]]; do sleep 0.5; done' || false

docker run --rm --network="host" -v $PWD:$PWD ghcr.io/linz/basemaps-screenshot/cli:v1 --url http://localhost:5000 --output $PWD/.artifacts/visual-snapshots

- name: Save snapshots
uses: getsentry/action-visual-snapshot@v2
with:
Expand Down Expand Up @@ -70,5 +70,5 @@ jobs:
id: visual-snapshots-diff
uses: blacha/action-visual-snapshot@v2
with:
storage-prefix: "s3://linz-basemaps-screenshot"
storage-url: "https://d25mfjh9syaxsr.cloudfront.net"
storage-prefix: 's3://linz-basemaps-screenshot'
storage-url: 'https://d25mfjh9syaxsr.cloudfront.net'
10 changes: 8 additions & 2 deletions packages/cli/src/cli/overview/action.create.overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ export class CommandCreateOverview extends CommandLineAction {
const st = new SimpleTimer();
logger.debug({ source }, 'CreateOverview:ListTiffs');
const tiffList = (await fsa.toArray(fsa.list(source))).filter(filterTiff);
if (tiffList.length === 0) {
logger.warn('CreateOverview:NoTiffs');
return;
}
const tiffSource = tiffList.map((path: string) => fsa.source(path));

logger.info({ source, duration: st.tick() }, 'CreateOverview:ListTiffs:Done');
logger.info({ source, tiffs: tiffList.length, duration: st.tick() }, 'CreateOverview:ListTiffs:Done');
logger.debug({ source, first: tiffSource[0].uri }, 'CreateOverview:PrepareSourceFiles');
// To ensure that permissions are setup correctly attempt to read the first tiff
await fsa.head(tiffSource[0].uri);

logger.debug({ source }, 'CreateOverview:PrepareSourceFiles');
const tiff: CogTiff = new CogTiff(tiffSource[0]);
await tiff.init(true);
const tileMatrix = await this.getTileMatrix(tiff);
Expand Down
4 changes: 4 additions & 0 deletions packages/cogify/src/argo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** Is this script running inside of argo */
export function isArgo(): boolean {
return process.env['ARGO_NODE_ID'] != null;
}
2 changes: 2 additions & 0 deletions packages/cogify/src/cogify/cli.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { subcommands } from 'cmd-ts';
import { BasemapsCogifyCreateCommand } from './cli/cli.cog.js';
import { BasemapsCogifyCoverCommand } from './cli/cli.cover.js';
import { BasemapsCogifyConfigCommand } from './cli/cli.config.js';

export const CogifyCli = subcommands({
name: 'cogify',
cmds: {
cover: BasemapsCogifyCoverCommand,
create: BasemapsCogifyCreateCommand,
config: BasemapsCogifyConfigCommand,
},
});
Loading
Loading