### glab skills install examples Source: https://docs.gitlab.com/19.3/cli/skills/install/ Examples of installing the core skill, a specific skill, global scope, custom path, and force overwrite. ```console # Install the core glab skill in the current project (default) glab skills install # Install a specific bundled skill by name glab skills install glab-stack # Install the core skill globally (user scope) glab skills install --global # Install a skill to a custom directory glab skills install glab-stack --path /path/to/skills # Overwrite an existing skill file glab skills install --force ``` -------------------------------- ### Install plugin examples with duo Source: https://docs.gitlab.com/19.3/user/gitlab_duo_cli/customize/ Example installations using duo: one without scope (defaults to user) and one with --scope project. ```shell duo plugin install my-plugin@my-marketplace ``` ```shell duo plugin install my-plugin@my-marketplace --scope project ``` -------------------------------- ### Chocolatey install examples Source: https://docs.gitlab.com/19.3/user/packages/nuget_repository/ Example commands for installing a package with Chocolatey, using either a source name or a full URL with credentials. ```shell choco install MyPackage -Source gitlab -Version 1.0.2 # or choco install MyPackage -Source "https://gitlab.example.com/api/v4/projects//packages/nuget/v2" -u -p -Version 1.0.2 ``` -------------------------------- ### Install plugin examples with glab Source: https://docs.gitlab.com/19.3/user/gitlab_duo_cli/customize/ Example installations using glab: one without scope (defaults to user) and one with --scope project. ```shell glab duo plugin install my-plugin@my-marketplace ``` ```shell glab duo plugin install my-plugin@my-marketplace --scope project ``` -------------------------------- ### minikube start output and stop commands Source: https://docs.gitlab.com/19.3/charts/development/minikube/ Example output from starting minikube, followed by commands to get the cluster IP and stop the cluster. The IP from 'minikube ip' may be needed later. ```plaintext Starting local Kubernetes v1.7.0 cluster... Starting VM... Downloading Minikube ISO 97.80 MB / 97.80 MB [==============================================] 100.00% 0s Getting VM IP address... Moving files into cluster... Setting up certs... Starting cluster components... Connecting to cluster... Setting up kubeconfig... Kubectl is now configured to use the cluster. [helm.gitlab.io]$ minikube ip 192.168.99.100 [helm.gitlab.io]$ minikube stop Stopping local Kubernetes cluster... Machine stopped. ``` -------------------------------- ### Examples for configuring Docker, Maven, Gradle, npm, and sbt Source: https://docs.gitlab.com/19.3/cli/artifact-registry/login/ Five example commands showing how to configure each supported package manager to authenticate against a registry. Each command uses the corresponding flag and a registry URL or hostname. ```console # Configure Docker to authenticate against a registry glab artifact-registry login --docker --registry registry.example.com ``` ```console # Configure Maven to authenticate against a registry for two hours glab artifact-registry login --maven --registry https://ar.example.com --duration 2h ``` ```console # Configure Gradle to authenticate against a registry for two hours glab artifact-registry login --gradle --registry https://ar.example.com --duration 2h ``` ```console # Configure npm to authenticate against a registry for two hours glab artifact-registry login --npm --registry https://ar.example.com --duration 2h ``` ```console # Configure sbt to authenticate against a registry for two hours glab artifact-registry login --sbt --registry https://ar.example.com --duration 2h ``` -------------------------------- ### Description style examples: language and punctuation Source: https://docs.gitlab.com/19.3/development/api_graphql_styleguide/ Examples of description phrasing following the style guide: use '{x} of the {y}' where possible, start sort/search arguments with a verb, and avoid starting with 'The' or 'A'. ```plaintext ID of the issue. ``` ```plaintext Author of the epics. ``` ```plaintext Sort issues by this criteria. ``` -------------------------------- ### GDK Setup: Start database services, install bundle, and migrate Source: https://docs.gitlab.com/19.3/development/data_seeder/ Commands to start PostgreSQL and Redis services, install the bundle, and run database migrations for the GDK environment. Output shows successful service start and migration completion. ```shell $ gdk start db ok: run: services/postgresql: (pid n) 0s, normally down ok: run: services/redis: (pid n) 74s, normally down $ bundle install Bundle complete! $ bundle exec rake db:migrate main: migrated ci: migrated ``` -------------------------------- ### Usage examples Source: https://docs.gitlab.com/19.3/cli/deploy-key/add/ Three examples showing how to add a deploy key: reading from stdin, reading from a key file via pipe, and reading from a key file with the can-push option. ```console # Read deploy key from stdin and upload. glab deploy-key add -t "my title" ``` ```console # Read deploy key from specified key file and upload cat ~/.ssh/id_ed25519.pub | glab deploy-key add --title='test' - ``` ```console # Read deploy key from specified key file, upload and set "can push" attribute. glab deploy-key add ~/.ssh/id_ed25519.pub -t "my title" --can-push true ``` -------------------------------- ### Set up Go project Source: https://docs.gitlab.com/19.3/tutorials/build_runner_admission_controller/ Create a new Go project directory and initialize the module. This is the starting point for the runner admission controller. ```shell mkdir runner-admission-controller cd runner-admission-controller go mod init example.com/runner-admission-controller ``` -------------------------------- ### Install and run gitlab_internal_events_cli Source: https://docs.gitlab.com/19.3/development/internal_analytics/internal_event_instrumentation/quick_start/ Install the CLI gem and run it to create event and metric definition files, then get code examples for instrumentation and testing. ```shell gem install gitlab_internal_events_cli gem exec gitlab_internal_events_cli ``` -------------------------------- ### glab orbit setup Source: https://docs.gitlab.com/19.3/orbit/local/access/glab/ Guided onboarding that verifies access, installs the GitLab Orbit skill, and installs the local binary. Configures AI coding agents to consult the graph. ```APIDOC ## glab orbit setup ### Description Guided onboarding that verifies access, installs the GitLab Orbit skill, and installs the local binary. Configures AI coding agents to consult the graph. ### Method CLI ### Command `glab orbit setup` ### Parameters None (use `--help` for full option list) ### Request Example ```shell glab orbit setup ``` ### Response Success: Configures AI agents and installs the skill and binary. ``` -------------------------------- ### Example devfile configuration with postStart events Source: https://docs.gitlab.com/19.3/user/workspace/ Complete example devfile configuration defining two containers (tooling-container and database-container) and four postStart commands. The image is for demonstration purposes only. Commands run in different working directories depending on the component and whether workingDir is specified. ```yaml schemaVersion: 2.2.0 variables: registry-root: registry.gitlab.com components: - name: tooling-container attributes: gl/inject-editor: true container: image: "{{registry-root}}/gitlab-org/remote-development/gitlab-remote-development-docs/ubuntu:22.04" env: - name: KEY value: VALUE endpoints: - name: http-3000 targetPort: 3000 - name: database-container attributes: overrideCommand: false container: image: mysql command: ["echo"] args: ["-n", "user-defined entrypoint command"] env: - name: MYSQL_ROOT_PASSWORD value: "my-secret-pw" commands: # Command 1: Container 1, no working directory (uses project directory) - id: install-dependencies exec: component: tooling-container commandLine: "npm install" # Command 2: Container 1, with working directory - id: setup-environment exec: component: tooling-container commandLine: "echo 'Setting up development environment'" workingDir: "/home/gitlab-workspaces" # Command 3: Container 2, no working directory (uses container default) - id: init-database exec: component: database-container commandLine: "echo 'Database initialized' > db-init.log" # Command 4: Container 2, with working directory - id: setup-database exec: component: database-container commandLine: "mkdir -p /var/lib/mysql/logs && echo 'DB setup complete' > setup.log" workingDir: "/var/lib/mysql" events: postStart: - install-dependencies - setup-environment - init-database - setup-database ``` -------------------------------- ### Example .gitlab-ci.yml for hosted Windows runners Source: https://docs.gitlab.com/19.3/ci/runners/hosted_runners/windows/ Use this example to get started with hosted runners on Windows. It defines a .windows_job template with the saas-windows-medium-amd64 tag and a before_script that prints the time and user info, then extends it in build and test jobs. ```yaml .windows_job: tags: - saas-windows-medium-amd64 before_script: - Set-Variable -Name "time" -Value (date -Format "%H:%m") - echo ${time} - echo "started by ${GITLAB_USER_NAME} / @${GITLAB_USER_LOGIN}" build: extends: - .windows_job stage: build script: - echo "running scripts in the build job" test: extends: - .windows_job stage: test script: - echo "running scripts in the test job" ``` -------------------------------- ### List Kubernetes namespaces with kubectl get ns Source: https://docs.gitlab.com/19.3/topics/autodevops/upgrading_postgresql/ Shows the command to list all namespaces in the cluster. The output example displays the namespace `minimal-ruby-app-4349298-production` which is used as the environment namespace in the guide. ```shell $ kubectl get ns NAME STATUS AGE minimal-ruby-app-4349298-production Active 7d14h ``` -------------------------------- ### GET /user/preferences - Example response Source: https://docs.gitlab.com/19.3/api/users/ Example JSON response for the GET /user/preferences endpoint. ```json { "id": 1, "user_id": 1, "view_diffs_file_by_file": true, "show_whitespace_in_diffs": false, "pass_user_identities_to_ci_jwt": false } ``` -------------------------------- ### Usage examples Source: https://docs.gitlab.com/19.3/cli/deploy-key/list/ Examples of listing deploy keys for the current project, with and without showing IDs. ```console # List the current project's deploy keys glab deploy-key list # Include the key ID in the output glab deploy-key list --show-id ``` -------------------------------- ### Install and start GitLab Runner service Source: https://docs.gitlab.com/19.3/runner/install/osx/ Installs and starts the GitLab Runner service as a LaunchAgent. The install command creates a plist at ~/Library/LaunchAgents/gitlab-runner.plist and registers it with launchctl. ```shell cd ~ gitlab-runner install gitlab-runner start ``` -------------------------------- ### setup.py - Project packaging configuration Source: https://docs.gitlab.com/19.3/user/gitlab_duo/tutorials/fix_code_python_shop/ Project configuration for packaging the bookstore inventory application using setuptools, including dependencies, metadata, and classifiers. ```python from setuptools import setup, find_packages setup( name="bookstore-inventory", version="0.1.0", packages=find_packages(), include_package_data=True, install_requires=[ "Flask>=2.2.0", "Flask-SQLAlchemy>=3.0.0", "SQLAlchemy>=2.0.0", "pytest>=7.0.0", "pytest-flask>=1.2.0", "python-dotenv>=1.0.0", ], python_requires=">=3.8", author="Your Name", author_email="[email protected]", description="A Flask web application for managing bookstore inventory", keywords="flask, inventory, bookstore", url="https://gitlab.com/your-username/python-shop-app", classifiers=[ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: Flask", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", ], ) ``` -------------------------------- ### Install build library and build package Source: https://docs.gitlab.com/19.3/user/packages/workflows/build_packages/ Install the build library and then build the package. The output appears in the dist folder. ```shell pip install build ``` ```shell python -m build ``` -------------------------------- ### Ruby: Configure KAS environment variable in gitlab.rb Source: https://docs.gitlab.com/19.3/update/versions/gitlab_17_changes/ Add this line to /etc/gitlab/gitlab.rb to fix KAS not starting with default settings on Omnibus and Docker installations. For multi-node setups, use the settings described in the documentation. ```ruby gitlab_kas['env'] = { 'OWN_PRIVATE_API_URL' => 'grpc://127.0.0.1:8155' } ``` -------------------------------- ### Alpine-based custom image with setup script Source: https://docs.gitlab.com/19.3/user/duo_agent_platform/flows/execution/images/ Example YAML configuration for an Alpine-based custom image that installs git, nodejs, and npm via the setup_script. Use this when your custom image lacks these required commands. ```yaml image: python:3.11-alpine setup_script: - apk add --update git nodejs npm ``` -------------------------------- ### Usage examples Source: https://docs.gitlab.com/19.3/cli/container-registry/repository/list/ Examples showing how to list repositories for the current project, another project using -R, and a group using --group. ```console # List container registry repositories for the current project glab container-registry repository list # List container registry repositories for another project glab container-registry repository list -R gitlab-org/cli # List container registry repositories for a group glab container-registry repository list --group gitlab-org ``` -------------------------------- ### Guide shortcode example Source: https://docs.gitlab.com/19.3/development/documentation/styleguide/ Markdown example showing how to create a guide with the {{< guide >}} shortcode. Nested shortcodes like alerts are allowed but should be used sparingly. Do not nest guides within guides. The guide styling only renders on docs.gitlab.com; in the product help it appears as a regular ordered list. ```markdown {{< guide >}} 1. Guide item with text. An item with text only. 1. Guide item with alert. This is an item with an alert. > [!note] > This is a note. {{< /guide >}} ``` -------------------------------- ### Usage examples Source: https://docs.gitlab.com/19.3/cli/runner-controller/create/ Examples of creating a runner controller with default settings, a description, and an enabled state. ```console # Create a runner controller with default settings glab runner-controller create # Create a runner controller with a description glab runner-controller create --description "My controller" # Create an enabled runner controller glab runner-controller create --description "Production" --state enabled ``` -------------------------------- ### glab runner-controller get examples Source: https://docs.gitlab.com/19.3/cli/runner-controller/get/ Two examples: one to get a runner controller with ID 42, and another to get the same controller as JSON using the --output flag. ```console # Get runner controller with ID 42 glab runner-controller get 42 # Get runner controller as JSON glab runner-controller get 42 --output json ``` -------------------------------- ### Enable Deploy Key - Example Response Source: https://docs.gitlab.com/19.3/api/deploy_keys/ Example JSON response returned when a deploy key is successfully enabled. Includes the key, id, title, created_at, and expires_at fields. ```json { "key": "ssh-rsa AAAA...", "id": 12, "title": "My deploy key", "created_at": "2015-08-29T12:44:31.550Z", "expires_at": null } ``` -------------------------------- ### glab ssh-key get examples Source: https://docs.gitlab.com/19.3/cli/ssh-key/get/ Examples of using glab ssh-key get: with a key ID, interactively, and with pagination options. ```console # Get ssh key with ID as argument glab ssh-key get 7750633 # Interactive glab ssh-key get # Interactive, with pagination glab ssh-key get -P 50 -p 2 ``` -------------------------------- ### Install libraries and run migrations Source: https://docs.gitlab.com/19.3/update/convert_to_ee/self_compiled/ Configures bundler, installs gems, runs database migrations, compiles assets, and clears cache. Includes optional bundle clean and comments for deployment settings. ```shell cd /home/git/gitlab # If you haven't done so during installation or a previous upgrade already sudo -u git -H bundle config set --local deployment 'true' sudo -u git -H bundle config set --local without 'development test kerberos' # Update gems sudo -u git -H bundle install # Optional: clean up old gems sudo -u git -H bundle clean # Run database migrations sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production # Update node dependencies and recompile assets sudo -u git -H bundle exec rake yarn:install gitlab:assets:clean gitlab:assets:compile RAILS_ENV=production NODE_ENV=production NODE_OPTIONS="--max_old_space_size=4096" # Clean up cache sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production ``` -------------------------------- ### glab label get examples Source: https://docs.gitlab.com/19.3/cli/label/get/ Two examples: getting label info by ID and targeting another repository with `-R`. ```console # Get label info using label 1234 as argument glab label get 1234 # Get info about a label in another project glab label get 1234 -R owner/repo ``` -------------------------------- ### Example response for get release Source: https://docs.gitlab.com/19.3/api/releases/ Example JSON response for the get release endpoint, showing release details, evidences, and links. ```json [ { "name": "New release", "tag_name": "v0.1", "description": "Super nice release", "created_at": "2019-01-03T01:55:18.203Z", "released_at": "2019-01-03T01:55:18.203Z", "upcoming_release": false, "author": { "id": 1, "name": "Administrator", "username": "root", "state": "active", "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://gitlab.example.com/root" }, "commit": { "id": "588440f66559714280628a4f9799f0c4eb880a4a", "short_id": "588440f6", "created_at": "2019-01-03T01:55:18.203Z", "parent_ids": [ "6a394edc9e0f4361c9d4e0b5c5b1b1b1b1b1b1b1" ], "title": "Initial commit", "message": "Initial commit", "author_name": "Administrator", "author_email": "admin@example.com", "authored_date": "2019-01-03T01:55:18.203Z", "committer_name": "Administrator", "committer_email": "admin@example.com", "committed_date": "2019-01-03T01:55:18.203Z" }, "milestones": [ { "id": 1, "title": "v1.0", "description": "", "state": "closed", "due_date": "2019-01-03", "start_date": "2019-01-03", "web_url": "http://gitlab.example.com/root/awesome-app/-/milestones/1" } ], "commit_path": "/root/awesome-app/commit/588440f66559714280628a4f9799f0c4eb880a4a", "tag_path": "/root/awesome-app/tags/v0.1", "assets": { "count": 4, "sources": [ { "format": "zip", "url": "http://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.zip" }, { "format": "tar.gz", "url": "http://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.gz" }, { "format": "tar.bz2", "url": "http://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.bz2" }, { "format": "tar", "url": "http://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar" } ], "links": [ { "id": 1, "name": "awesome-v0.1.dmg", "url": "http://gitlab.example.com/root/awesome-app/-/jobs/688/artifacts/file/build/awesome-v0.1.dmg", "direct_asset_url": "http://gitlab.example.com/root/awesome-app/-/releases/v0.1/downloads/awesome-v0.1.dmg" }, { "id": 2, "name": "awesome-v0.1.msi", "url": "http://gitlab.example.com/root/awesome-app/-/jobs/689/artifacts/file/build/awesome-v0.1.msi", "direct_asset_url": "http://gitlab.example.com/root/awesome-app/-/releases/v0.1/downloads/awesome-v0.1.msi" } ] }, "evidences": [ { "sha": "c3ffedec13af470e760d6cdfb08790f71cf52c6cde4d", "filepath": "https://gitlab.example.com/root/awesome-app/-/releases/v0.1/evidence.json", "collected_at": "2019-01-03T01:55:18.203Z" } ], "_links": { "closed_issues_url": "https://gitlab.example.com/root/awesome-app/-/issues?release_tag=v0.1&scope=all&state=closed", "closed_merge_requests_url": "https://gitlab.example.com/root/awesome-app/-/merge_requests?release_tag=v0.1&scope=all&state=closed", "edit_url": "https://gitlab.example.com/root/awesome-app/-/releases/v0.1/edit", "merged_merge_requests_url": "https://gitlab.example.com/root/awesome-app/-/merge_requests?release_tag=v0.1&scope=all&state=merged", "opened_issues_url": "https://gitlab.example.com/root/awesome-app/-/issues?release_tag=v0.1&scope=all&state=opened", "opened_merge_requests_url": "https://gitlab.example.com/root/awesome-app/-/merge_requests?release_tag=v0.1&scope=all&state=opened", "self": "https://gitlab.example.com/root/awesome-app/-/releases/v0.1" } } ] ```