Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 7 additions & 11 deletions .craft.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
minVersion: '0.21.0'
github:
owner: getsentry
repo: craft
minVersion: '0.22.2'
Comment thread
chadwhitacre marked this conversation as resolved.
changelogPolicy: auto
requireNames:
- /^sentry-craft.*\.tgz$/
Expand All @@ -19,13 +16,12 @@ targets:
metadata:
cacheControl: 'public, max-age=300'
- name: registry
type: app
urlTemplate: 'https://downloads.sentry-cdn.com/craft/{{version}}/{{file}}'
checksums:
- algorithm: sha256
format: hex
config:
canonical: 'app:craft'
apps:
'app:craft':
urlTemplate: 'https://downloads.sentry-cdn.com/craft/{{version}}/{{file}}'
checksums:
- algorithm: sha256
format: hex
- name: docker
source: us.gcr.io/sentryio/craft
target: getsentry/craft
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- feat(publish): Ability to merge to non-default (#245)
- fix(logging): Proper scoping and log levels (#247)
- feat(registry-target): Allow batched updates w/ new config (#249)

## 0.22.2

Expand Down
39 changes: 19 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -794,38 +794,37 @@ the corresponding package directory can be found inside "packages" directory of
release regsitry. Type "app" indicates that the package's version files are located
in "apps" directory of the registry.

It is strongly discouraged to have multiple `registry` targets in a config as it
supports grouping/batching multiple apps and SDKs in a single target.

**Environment**

_none_

**Configuration**

| Option | Description |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type` | Type of the package: can be "sdk" or "app". |
| `config.canonical` | Canonical name of the package that includes package registry name (e.g. NPM, PyPI) and the full package name. |
| `urlTemplate` | **optional** URL template that will be used to generate download links for "app" package type. |
| `linkPrereleases` | **optional** Update package versions even if the release is a preview release, "false" by default. |
| `checksums` | **optional** A list of checksums that will be computed for matched files (see `includeNames`). Every checksum entry is an object with two attributes: algorithm (one of "sha256", "sha384", and "sha512) and format ("base64" and "hex"). |
| `onlyIfPresent` | **optional** A file pattern. The target will be executed _only_ when the matched file is found. |
| Option | Description |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `apps` | List of `app` configs as a dict, keyed by their canonical names (example: `app:craft`) |
| `sdks` | List of `sdk` configs as a dict, keyed by their canonical names (example: `maven:io.sentry:sentry`) |
| `(sdks\|apps).urlTemplate` | **optional** URL template that will be used to generate download links for "app" package type. |
| `(sdks\|apps).linkPrereleases` | **optional** Update package versions even if the release is a preview release, "false" by default. |
| `(sdks\|apps).checksums` | **optional** A list of checksums that will be computed for matched files (see `includeNames`). Every checksum entry is an object with two attributes: algorithm (one of `sha256`, `sha384`, and `sha512`) and format (`base64` and `hex`). |
| `(sdks\|apps).onlyIfPresent` | **optional** A file pattern. The target will be executed _only_ when the matched file is found. |

**Example**

```yaml
targets:
- name: registry
type: sdk
config:
canonical: 'npm:@sentry/browser'

- name: registry
type: app
urlTemplate: 'https://example.com/{{version}}/{{file}}'
config:
canonical: 'npm:@sentry/browser'
checksums:
- algorithm: sha256
format: hex
sdks:
'npm:@sentry/browser':
apps:
'npm:@sentry/browser':
urlTemplate: 'https://example.com/{{version}}/{{file}}'
checksums:
- algorithm: sha256
format: hex
```

### Cocoapods (`cocoapods`)
Expand Down
18 changes: 9 additions & 9 deletions src/artifact_providers/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ export abstract class BaseArtifactProvider {
protected readonly logger: typeof loggerRaw;
/** Cache for local paths to downloaded files */
protected readonly downloadCache: {
[key: string]: Promise<string> | undefined;
[key: string]: Promise<string>;
} = {};

/** Cache for storing mapping between revisions and a list of their artifacts */
protected readonly fileListCache: {
[key: string]: RemoteArtifact[] | undefined;
[key: string]: Promise<RemoteArtifact[]>;
} = {};

/** Cache for checksums computed for the files stored on disk */
Expand Down Expand Up @@ -240,23 +240,23 @@ export abstract class BaseArtifactProvider {
): Promise<RemoteArtifact[]> {
this.logger.debug(`Fetching artifact list for revision \`${revision}\`.`);
// check the cache first
const cached = this.fileListCache[revision];
if (cached) {
if (this.fileListCache[revision]) {
this.logger.debug(`Found list in cache.`);
return cached;
} else {
// Cache the promise immediately to cause any subsequent calls during the
// fetch to use the pending promise instead of fetching again in parallel
Comment thread
BYK marked this conversation as resolved.
this.fileListCache[revision] = this.doListArtifactsForRevision(revision);
}

// the data wasn't in the cache, so now we have to go get it
let artifacts;
let artifacts: RemoteArtifact[];
try {
artifacts = await this.doListArtifactsForRevision(revision);
artifacts = await this.fileListCache[revision];
} catch (err) {
this.logger.error(
`Unable to retrieve artifact list for revision ${revision}!`
);
throw err;
}
this.fileListCache[revision] = artifacts;

if (artifacts.length === 0) {
this.logger.info(`No artifacts found for revision ${revision}`);
Expand Down
1 change: 1 addition & 0 deletions src/commands/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ async function getTargetList(
continue;
}
try {
logger.debug(`Creating target ${targetConfig.name}:`, targetConfig);
const target = new targetClass(
targetConfig,
artifactProvider,
Expand Down
4 changes: 1 addition & 3 deletions src/targets/awsLambdaLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ import { createSymlinks } from '../utils/symlink';
import { withTempDir } from '../utils/files';
import { isDryRun } from '../utils/helpers';
import { isPreviewRelease } from '../utils/version';
import { getRegistryGithubRemote } from '../utils/registry';

const DEFAULT_REGISTRY_REMOTE: GithubRemote = getRegistryGithubRemote();
import { DEFAULT_REGISTRY_REMOTE } from '../utils/registry';

/** Config options for the "aws-lambda-layer" target. */
interface AwsLambdaTargetConfig {
Expand Down
Loading