Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

TODO: See if we can add it to every user's .bashrc (or maybe just call that within the CLI once)

Current:


Sample build workflow using CLI

  1. Add test-ioc repo to db
Code Block
pnispero@PC100942:~/BuildSystem/bs_cli$ ./bs create repo -c test-ioc -u https://github.com/ad-build-test/test-ioc
[?] Specify organization name: ad-build-test
[?] Specify testing criteria: all
[?] Specify approval rule: all
[?] Specify component description: Test IOC used for BuildSystem testing
INFO-root:[create_commands.py:38 - repo() ] | {'linux_username': 'pnispero', 'github_username': 'test'}
INFO-root:[create_commands.py:39 - repo() ] | {'name': 'test-ioc', 'description': 'Test IOC used for BuildSystem testing', 'testingCriteria': 'all', 'approvalRule': 'all', 'organization': 'ad-build-test', 'url': 'https://github.com/ad-build-test/test-ioc'}
INFO-root:[create_commands.py:40 - repo() ] | 201
INFO-root:[create_commands.py:41 - repo() ] | {'errorCode': 0, 'payload': '66720253fd891a5aac14b3cf'}
INFO-root:[create_commands.py:42 - repo() ] | https://accel-webapp-dev.slac.stanford.edu/api/cbs/v1/component
INFO-root:[create_commands.py:43 - repo() ] | b'{"name": "test-ioc", "description": "Test IOC used for BuildSystem testing", "testingCriteria": "all", "approvalRule": "all", "organization": "ad-build-test", "url": "https://github.com/ad-build-test/test-ioc"}'
INFO-root:[create_commands.py:44 - repo() ] | {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'linux_username': 'pnispero', 'github_username': 'test', 'Content-Length': '210', 'Content-Type': 'application/json'}
pnispero@PC100942:~/BuildSystem/bs_cli$

2. Add dev branch to db

Code Block
pnispero@PC100942:~/test-ioc$ bs create branch -a
Checking current directory if a component...
[?] Specify what to branch from:
 > branch
   tag
   commit

Specify name of branch: main
main
Specify name of branch: main
[?] Specify type of branch to create:
   fix
   feat
 > dev

Specify name of issue number (or dev name): patrick
INFO-root:[create_commands.py:128 - branch() ] | 200
INFO-root:[create_commands.py:129 - branch() ] | {'errorCode': 0, 'payload': True}
INFO-root:[create_commands.py:130 - branch() ] | https://accel-webapp-dev.slac.stanford.edu/api/cbs/v1/component/test-ioc/branch
INFO-root:[create_commands.py:131 - branch() ] | b'{"type": "branch", "branchPoint": "main", "branchName": "dev-patrick"}'
INFO-root:[create_commands.py:132 - branch() ] | {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'linux_username': 'pnispero', 'github_username': 'test', 'Content-Length': '70', 'Content-Type': 'application/json'}
pnispero@PC100942:~/test-ioc$


Start a build

Code Block
pnispero@PC100942:~/test-ioc$ bs run build
Checking current directory if a component...
INFO-root:[run_commands.py:27 - build() ] | 201
INFO-root:[run_commands.py:28 - build() ] | {'errorCode': 0, 'payload': ['66721557fd891a5aac14b3d0']}
INFO-root:[run_commands.py:29 - build() ] | https://accel-webapp-dev.slac.stanford.edu/api/cbs/v1/build/component/test-ioc/branch/dev-patrick
INFO-root:[run_commands.py:30 - build() ] | b'{}'
INFO-root:[run_commands.py:31 - build() ] | {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'linux_username': 'pnispero', 'github_username': 'test', 'Content-Length': '2', 'Content-Type': 'application/json'}
pnispero@PC100942:~/test-ioc$

Check build (didn't make cli for this yet)

Code Block
pnispero@PC100942:~/BuildSystem$ curl -X 'GET' \
  'https://accel-webapp-dev.slac.stanford.edu/api/cbs/v1/build/component/test-ioc/branch/dev-patrick' \
  -H 'accept: application/json'
{"errorCode":0,"payload":[{"id":"66721557fd891a5aac14b3d0","buildOs":"ROCKY9","buildStatus":"PENDING"}]}


How I viewed database

  1. log into accel-webapp-dev since core build system is hosted there for now
  2. pnispero@PC100942:~/BuildSystem/other$ kubectl port-forward --namespace=core-build-system cbs-cluster-rs0-0 28015:27017
    Forwarding from 127.0.0.1:28015 -> 27017
    Forwarding from [::1]:28015 -> 27017
  3. Open seperate terminal
  4. mongosh --port 28015
    1. if this doesnt work, then install follow this link Install mongosh - MongoDB Shell
  5. then enter this to see if works: 
    db.runCommand( { ping: 1 } )
    work on cli - plan of making our own, but can use gh cli as one of tools
  6. Make our own cli - can use python (for ease of development, and speed is not important since its ran from a dev's machine as just another process)
  7. Use GNU Coding Standards section 4.8 'standards for command line interfaces'
  8. Currently have a structure laid out, and have some commands available