דלגו לתוכן

15 הדקות הראשונות

פותחים בסדר הזה ולא מדלגים. מחפשים בכל קובץ שלוש מילים: MUST, TODO, exit 1.

#קובץמה שואבים ממנו
1README.md בשורשהחוזה: רשימת ה-MUST, ה-SHOULD וה-STRETCH; חלוקת ה-repos
2CONTRACT.md / reference.mdשמות קבועים, משתנים אוטומטיים, איך נראה credential
3README.md בכל repoמה ה-repo הזה מקבל, מי כותב אליו
4כותרת (10 השורות הראשונות) של כל *.shOutcome שהסקריפט חייב לספק, ומאילו קבצים הוא קורא
5קבצי ה-CI: .gitlab-ci.yml ו-pipelines/*.ymlאילו variables הם מצפים לקבל מ-GitLab

דוגמה: ב-TRIDENT יש 8 קבצי קריאה: README.md ×6 (שורש, ci, gitops, source, source/secrets, templates), reference.md ו-source/CONTRACT.md.

איך מוודאים: אתה יכול לומר במשפט אחד מה הזרימה (מי כותב ל-Git, מי מושך, מי מריץ) ולרשום את ה-MUST על דף.

TODO הוא החלטה שנשארה לך; exit 1 בשורה עם TODO הוא stub שנעצר בכוונה. exit 1 רגיל בסקריפט גמור הוא רק יציאת שגיאה, ולכן הוא רעש.

runs on: VM
cd <DIR> # the checked-out project, all repos side by side
grep -rnE 'TODO|FIXME|exit 1' --include=*.sh --include=*.yaml --include=*.yml .
grep -rlE 'TODO|FIXME' --include=*.sh --include=*.yaml --include=*.yml . | sort
grep -rnE 'TODO.*exit 1' --include=*.sh --include=*.yaml --include=*.yml .
grep -rnE '^\s*(- )?repoURL: ""' --include=*.yaml .
grep -rnoIE '<[A-Z_]+>' .

השורות: הכול, הקבצים שתערוך, ה-stubs, repoURL ריקים, ו-placeholders באותיות גדולות בסוגריים זוויתיים.

איך מוודאים: יש לך רשימה של קבצים לעריכה. ב-TRIDENT:

פקודהמה נספרתוצאה ב-TRIDENT
grep -rnE 'TODO|FIXME|exit 1' …שורות51 (רובן exit 1 רגיל)
grep -rnE 'TODO|FIXME' …שורות31, ב-14 קבצים
grep -rnE 'TODO.*exit 1' …stubs6: prepare-environment.sh, prepare-observability.sh, cleanup.sh, promote.sh, ו-build ו-publish ב-pipelines/source.yml
grep -rnE '^\s*(- )?repoURL: ""' …שורות פעילות17, ב-5 קבצים (root: 1, כל אחד מ-4 ה-Applications: 4)
grep -rn 'repoURL: ""' . (בלי עוגנים)שורות21: כולל 3 שורות בהערה ובדיקת bootstrap.sh
grep -rnoIE '<[A-Z_]+>' .התאמות8, כמעט כולן <YYYYMMDD> בתיעוד: אות חלשה
runs on: VM
find . -maxdepth 3 \( -iname 'README*' -o -iname 'CONTRACT*' -o -iname 'reference*' \) -type f | sort
grep -rnE 'MUST|SHOULD|STRETCH' --include=*.md .
find . -name Chart.yaml
find . -name '*.sh' | sort
find . -name '*.y*ml' -not -path './.git/*' | sort
ls -d */
git branch -a
git tag
git remote -v

שלוש האחרונות רצות בתוך כל repo (git -C <DIR>/<REPO> branch -a). אם ה-tree הוא תיקייה אחת בלי .git משלה, ה-repos הם תיקיות המשנה.

איך מוודאים: ב-TRIDENT: 11 שורות MUST|SHOULD|STRETCH בקבצי .md, 16 קבצי .sh, 35 קבצי YAML, ו-4 תיקיות (ci, gitops, source, templates) שהן 4 ה-repos. find . -name Chart.yaml מחזיר 0: ה-charts לא בתוך ה-tree, templates/import-charts.sh מייבא אותם בהמשך. תוצאה ריקה היא מידע, לא שגיאה.

מיפוי: איפה הערכים שחייבים להתאים

Section titled “מיפוי: איפה הערכים שחייבים להתאים”
runs on: VM
grep -rnE 'ingresses|hostname|hosts:' --include=*.yaml --include=*.md .
grep -rniE 'storageClass|className' --include=*.yaml --include=*.md .
grep -rnE '_HOST|_URL' --include=*.env --include=*.conf .
docker compose -f <FILE> config --services
grep -rnE 'IMAGE_REPO|imageRepository|CI_REGISTRY_IMAGE' --include=*.yaml --include=*.yml --include=*.sh .
grep -rnE 'secretName|ImagePullSecrets|create secret' --include=*.yaml --include=*.sh --include=*.md .
grep -rnE 'versions/|defaultImageTag' --include=*.yaml --include=*.yml --include=*.sh .
grep -rn 'targetRevision' --include=*.yaml .
grep -rnE 'mountPath|/run/secrets' --include=*.yaml --include=*.md .

בסדר: hosts של ה-Ingress, StorageClass, משתני *_HOST/*_URL מול שמות ה-services ב-compose, נתיב ה-image ב-GitLab Container Registry, שמות Secrets, מקור ה-tag, tag או branch ב-Argo, ונתיבי mount של Secrets. (<FILE> כאן: קובץ ה-compose של הפרויקט, ב-TRIDENT source/compose.yaml.)

איך מוודאים: ב-TRIDENT: 8 שורות על hosts, 8 על StorageClass, 3 משתני *_HOST/*_URL ב-source/config/*.env (POSTGRES_HOST=postgres, REDIS_HOST=redis, INGEST_URL=http://ingest-api:8080), 10 services ב-compose (docker compose … config --services), 8 שורות על נתיב ה-image, 6 על Secrets, 14 על ה-tag, 20 על targetRevision.

טבלת "ערכים שחייבים להתאים"

Section titled “טבלת "ערכים שחייבים להתאים"”

ממלאים אותה תוך 15 הדקות. כל שורה היא ערך שמופיע ביותר ממקום אחד, וטעות בו היא כשל שקט. העמודה האחרונה היא הדוגמה מ-TRIDENT; את הטבלה שלך מעתיקים לקובץ NOTES.md מחוץ ל-repo ומשאירים את העמודה האחרונה ריקה.

מהאיפה מוצאיםפקודהערך ב-TRIDENT
group path (לא display name)כתובת ה-group ב-UI, git remote -vgit remote -vtrident-lab00 (שם תצוגה: trident-lab)
שמות ה-reposREADME בשורש, "repo split"ls -d */trident-source, trident-ci, trident-templates, trident-gitops
repoURL בכל Applicationargocd/root.yaml, argocd/apps/*.yamlgrep -rn 'repoURL' --include=*.yaml .https://gitlab.com/<GROUP>/trident-gitops.git (5 קבצים, 17 שורות)
targetRevisionאותם קבציםgrep -rn targetRevision --include=*.yaml .templates: tag v1.0.0; gitops: main
שם ה-repo Secret של Argobootstrap/register-repository.shgrep -n 'SECRET=' <FILE>trident-gitops, trident-templates ב-namespace argocd; ה-url שלהם זהה byte-for-byte ל-repoURL
משתנים שהסקריפטים דורשים ב-shellכותרות הסקריפטים, ${VAR:?}grep -rnE ':\?|URL_VAR|export ' --include=*.sh .TRIDENT_GITOPS_URL, TRIDENT_TEMPLATES_URL (מוגדרים ב-env.sh, לא ב-GitLab)
namespacesREADME של ה-gitops, destinationgrep -rnE 'namespace:|destination' --include=*.yaml .trident-dev, trident-staging, trident-prod, trident-observability
שמות Secrets ומפתחותכותרת prepare-environment.shsed -n 1,15p <FILE>trident-postgres (postgres_password), trident-registry, trident-tls, trident-grafana-admin
service names מול *_HOSTconfig/*.env, composegrep -rnE '_HOST|_URL' --include=*.env .postgres, redis, ingest-api (אחרי fullnameOverride)
נתיב ה-image ב-GitLab Container RegistryIMAGE_REPO ב-CI, imageRepository ב-valuesgrep -rnE 'IMAGE_REPO|imageRepository' …registry.gitlab.com/<GROUP>/trident-source/<SERVICE>
מקור ה-tagversions/<ENV>.yaml, promote.shgrep -rn 'defaultImageTag' …<branch>-<YYYYMMDD>-<sha>, נכתב רק ל-apps/trident/versions/<ENV>.yaml
hosts ו-portsvalues של ה-Ingress; ה-NodePort מגלים בקלאסטרgrep -rn 'hostname' --include=*.yaml .<ENV>.trident.test (פעמיים: hosts[].hostname ו-extraTls[].hosts); ה-README אומר NodePort 31024, ב-VM בזמן הכתיבה 31731: environment-setup
StorageClassREADME, כותרת postgres/base.yamlgrep -rniE 'className' …course-local-path
נתיב mount של SecretCONTRACT.md ו-ה-*_FILE ב-valuesgrep -rn '/run/secrets' …/run/secrets/<APP_DIR>/postgres_password (לא /run/secrets עצמו)
tag של ה-runner.gitlab-ci.ymlgrep -rn 'tags' …trident

שני המקומות שנשברו בתרגול, ולכן שורות מודגשות: ה-group path והנתיב של ה-Secret. ב-TRIDENT הערך שסופק ב-apps/trident/base.yaml הוא /run/secrets/postgres_password: ה-mount והמשתנה *_FILE חייבים לעבור יחד לתת-תיקייה.

איך מוודאים: אין שורה ריקה בעמודה "ערך" שלך, וכל ערך שמופיע בשני קבצים או יותר זהה בשניהם.

delta-on-copy: טבלת החלפה ו-grep

Section titled “delta-on-copy: טבלת החלפה ו-grep”

הדבקה מ-env אחד לאחר (או מפרויקט אחר) מעבירה איתה את השמות הישנים. לפני ההדבקה כותבים טבלה, ואחרי ההדבקה מחפשים כל ערך ישן.

ערך ישןערך חדשקבצים שמושפעים
<ENV> = dev<ENV> = stagingשם ה-Application, destination.namespace, versions/<ENV>.yaml
<NS> = trident-dev<NS> = trident-stagingdestination, ה-Secrets שנוצרים
<HOST> = dev.trident.test<HOST> = staging.trident.testhostname ו-extraTls
<PORT><PORT>נתיבי health, servicePort
runs on: VM
grep -rnE '<old value 1>|<old value 2>|<old value 3>' --include=*.yaml --include=*.yml --include=*.sh --include=*.md .

אחרי העתקת dev.yaml ל-staging.yaml, כל ערך ישן שנשאר בקובץ החדש הוא באג. ב-TRIDENT מחפשים 'trident-dev|dev\.trident\.test' ומקבלים 16 שורות: כולן צריכות להיות בקבצי dev או בתיעוד, ואף אחת בקובץ staging או prod.

איך מוודאים: ה-grep על הערכים הישנים מחזיר שורות רק בקבצים שמיועדים לסביבה הישנה.

תוצראיפה
טבלת הערכים, מלאהNOTES.md מחוץ ל-repo
רשימת קבצים לעריכה (פלט grep -rlE 'TODO|FIXME')אותו קובץ
ציור זרימה של שורה אחת: source → CI → gitops → Argo → clusterדף נייר
טבלת credentials: מי צריך מהarchitecture/credentials
רשימת MUST / SHOULDאותו דף

אחר כך: environment-setup, ובסיום order-of-work. מה שנשאר פתוח מהמיפוי הוא רשימת ה-gates שלך.

איך מוודאים: אם אתה לא יודע מאיפה יבוא ה-tag של ה-image או איזה נתיב ירשם ב-values, חזור לטבלה: השורה הזו עוד ריקה.