User:TCipriani (WMF)/Gerrit/Tutorial/Materialize
Appearance
π§π½βπ» Gerrit for Product AnalyticsβTutorial
- π Home
- π§ Tutorial
- π Commit messages (Using
Bug:
) - π Uploading changes
- π’ Reviewing and submitting
Materialize Changes
Now you can make changes to your repo. Here we'll follow along with the Creating a new schema tutorial from Wikitech.
# 1οΈβ£ Step 1
Change to your newly cloned schemas/event/secondary
directory and run npm i
to install all the software needed to make a new schema.
βοΈ npm i
$ cd schemas/event/secondary $ npm i > schemas-event-secondary@1.0.0 postinstall > $(npm bin)/jsonschema-tools install-git-hook [2021-10-28 00:52:08.690 +0000]: Saving jsonschema-tools materialize-modified pre-commit hook to /home/user/src/schemas/event/secondary/.git/hooks/pre-commit added 249 packages, and audited 250 packages in 9s
Now you'll have a node_modules
directory inside the schemas/event/secondary
directory.
schemas/event/secondary/node_modules
βββ acorn
βββ acorn-jsx
βββ ajv
βββ ansi-colors
βββ ansi-escapes
βββ ansi-regex
βββ ansi-styles
βββ argparse
βββ args
βββ astral-regex
βββ atomic-sleep
βββ @babel
βββ balanced-match
βββ bluebird
βββ brace-expansion
βββ browser-stdout
βββ call-me-maybe
βββ callsites
βββ camelcase
βββ chalk
βββ chardet
βββ cli-cursor
βββ cliui
βββ cli-width
βββ color-convert
βββ color-name
βββ compute-gcd
βββ compute-lcm
βββ concat-map
βββ cross-spawn
βββ dateformat
βββ debug
βββ decamelize
βββ deep-is
βββ define-properties
βββ diff
βββ doctrine
βββ drange
βββ emoji-regex
βββ end-of-stream
βββ es-abstract
βββ escape-string-regexp
βββ eslint
βββ eslint-scope
βββ eslint-utils
βββ eslint-visitor-keys
βββ espree
βββ esprima
βββ esquery
βββ esrecurse
βββ es-to-primitive
βββ estraverse
βββ esutils
βββ external-editor
βββ fast-deep-equal
βββ fast-json-stable-stringify
βββ fast-levenshtein
βββ fast-redact
βββ fast-safe-stringify
βββ figures
βββ file-entry-cache
βββ find-up
βββ flat
βββ flat-cache
βββ flatstr
βββ flatted
βββ format-util
βββ fs-extra
βββ fs.realpath
βββ functional-red-black-tree
βββ function-bind
βββ get-caller-file
βββ glob
βββ globals
βββ glob-parent
βββ graceful-fs
βββ growl
βββ @hapi
βββ has
βββ has-flag
βββ has-symbols
βββ he
βββ hosted-git-info
βββ iconv-lite
βββ ignore
βββ import-fresh
βββ imurmurhash
βββ inflight
βββ inherits
βββ inquirer
βββ is-buffer
βββ is-callable
βββ is-date-object
βββ isexe
βββ is-extglob
βββ is-fullwidth-code-point
βββ is-glob
βββ is-regex
βββ is-symbol
βββ jmespath
βββ joycon
βββ jsonfile
βββ jsonpath-plus
βββ json-schema-compare
βββ json-schema-faker
βββ json-schema-merge-allof
βββ json-schema-ref-parser
βββ json-schema-traverse
βββ json-stable-stringify-without-jsonify
βββ js-tokens
βββ js-yaml
βββ leven
βββ levn
βββ locate-path
βββ lodash
βββ log-symbols
βββ lru-cache
βββ mimic-fn
βββ minimatch
βββ minimist
βββ mkdirp
βββ mocha
βββ mri
βββ ms
βββ mute-stream
βββ natural-compare
βββ netmask
βββ nice-try
βββ node-environment-flags
βββ node-fetch
βββ object.assign
βββ object.getownpropertydescriptors
βββ object-inspect
βββ object-keys
βββ once
βββ onetime
βββ ono
βββ optionator
βββ os-tmpdir
βββ parent-module
βββ path-exists
βββ path-is-absolute
βββ path-key
βββ pino
βββ pino-pretty
βββ pino-std-serializers
βββ p-limit
βββ p-locate
βββ prelude-ls
βββ progress
βββ p-try
βββ pump
βββ punycode
βββ quick-format-unescaped
βββ randexp
βββ readable-stream
βββ recursive-readdir-sync
βββ regexpp
βββ require-directory
βββ require-main-filename
βββ resolve-from
βββ restore-cursor
βββ ret
βββ rewire
βββ rimraf
βββ run-async
βββ rxjs
βββ safe-buffer
βββ safer-buffer
βββ semver
βββ set-blocking
βββ shebang-command
βββ shebang-regex
βββ signal-exit
βββ slice-ansi
βββ sonic-boom
βββ split2
βββ sprintf-js
βββ string_decoder
βββ string.prototype.trimend
βββ string.prototype.trimleft
βββ string.prototype.trimright
βββ string.prototype.trimstart
βββ string-width
βββ strip-ansi
βββ strip-json-comments
βββ supports-color
βββ table
βββ text-table
βββ through
βββ tmp
βββ tslib
βββ type-check
βββ type-fest
βββ universalify
βββ uri-js
βββ util-deprecate
βββ v8-compile-cache
βββ validate.io-array
βββ validate.io-function
βββ validate.io-integer
βββ validate.io-integer-array
βββ validate.io-number
βββ which
βββ which-module
βββ wide-align
βββ @wikimedia
βββ word-wrap
βββ wrap-ansi
βββ wrappy
βββ write
βββ y18n
βββ yallist
βββ yargs
βββ yargs-parser
βββ yargs-unparser
216 directories, 0 files
# 2οΈβ£ Step 2
Make a new directory for your schema lineage:
Create a new schema
$ mkdir -p jsonschema/mediawiki/desktop/button/click
And then add a current.yaml
file in the directory jsonschema/mediawiki/desktop/button/click
with your schema.
# 3οΈβ£ Step 3
Commit your change using git commit.
Below I run three commands:
git status
β shows what files git knows about and whether those files have changed since git last saw themgit add
β tells git that you'd like to include these files in your next commitgit commit
β tells git that you're done working on the file. Adding-m "some message"
will add a commit message to the code. Commit messages should use present tense (e.g., "Add" instead of "Added" or "Adding") and be less than 72 characters by convention.
β
Git commit
$ git status On branch master Your branch is up to date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) jsonschema/mediawiki/ nothing added to commit but untracked files present (use "git add" to track) $ git add jsonschema/mediawiki/ $ git commit -m 'Add mediawiki/desktop/button/click' [2021-10-28 13:17:37.619 +0000]: Looking for modified current.yaml schema files in ./jsonschema/ [2021-10-28 13:17:37.668 +0000]: Materializing /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/current.yaml... [2021-10-28 13:17:37.678 +0000]: Dereferencing schema with $id /mediawiki/desktop/button/click/1.0.0 using schema base URIs ./jsonschema/,https://schema.wikimedia.org/repositories/primary/jsonschema/ [2021-10-28 13:17:37.703 +0000]: Materialized schema at /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/1.0.0.yaml. [2021-10-28 13:17:37.704 +0000]: Materialized schema at /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/1.0.0.json. [2021-10-28 13:17:37.704 +0000]: Created latest symlink /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/latest.yaml -> 1.0.0.yaml. [2021-10-28 13:17:37.705 +0000]: Created latest symlink /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/latest.json -> 1.0.0.json. [2021-10-28 13:17:37.705 +0000]: Created extensionless symlink /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/1.0.0 -> 1.0.0.yaml. [2021-10-28 13:17:37.706 +0000]: Created latest symlink /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/latest -> 1.0.0.yaml. [2021-10-28 13:17:37.706 +0000]: New schema files have been materialized. Adding them to git: /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/1.0.0.yaml,/home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/latest.yaml,/home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/1.0.0,/home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/latest,/home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/1.0.0.json,/home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/latest.json [master 46e19bc] Add mediawiki/desktop/button/click 7 files changed, 132 insertions(+) create mode 120000 jsonschema/mediawiki/desktop/button/click/1.0.0 create mode 100644 jsonschema/mediawiki/desktop/button/click/1.0.0.json create mode 100644 jsonschema/mediawiki/desktop/button/click/1.0.0.yaml create mode 100644 jsonschema/mediawiki/desktop/button/click/current.yaml create mode 120000 jsonschema/mediawiki/desktop/button/click/latest create mode 120000 jsonschema/mediawiki/desktop/button/click/latest.json create mode 120000 jsonschema/mediawiki/desktop/button/click/latest.yaml
You'll notice that a lot of things happened after you typed git commit
. Git used a script to create version files for your new schema lineage. You can see them in your directory tree:
jsonschema/mediawiki/desktop/button/click/
βββ 1.0.0 -> 1.0.0.yaml
βββ 1.0.0.json
βββ 1.0.0.yaml
βββ current.yaml
βββ latest -> 1.0.0.yaml
βββ latest.json -> 1.0.0.json
βββ latest.yaml -> 1.0.0.yaml