diff options
Diffstat (limited to 'doc/user/packages')
-rw-r--r-- | doc/user/packages/conan_repository/index.md | 32 | ||||
-rw-r--r-- | doc/user/packages/container_registry/index.md | 12 | ||||
-rw-r--r-- | doc/user/packages/dependency_proxy/index.md | 6 | ||||
-rw-r--r-- | doc/user/packages/maven_repository/index.md | 2 | ||||
-rw-r--r-- | doc/user/packages/npm_registry/index.md | 28 | ||||
-rw-r--r-- | doc/user/packages/nuget_repository/index.md | 6 | ||||
-rw-r--r-- | doc/user/packages/workflows/monorepo.md | 2 | ||||
-rw-r--r-- | doc/user/packages/workflows/project_registry.md | 2 |
8 files changed, 45 insertions, 45 deletions
diff --git a/doc/user/packages/conan_repository/index.md b/doc/user/packages/conan_repository/index.md index e9f86ebf4b2..2abfd08a5dd 100644 --- a/doc/user/packages/conan_repository/index.md +++ b/doc/user/packages/conan_repository/index.md @@ -33,7 +33,7 @@ Follow the instructions at [conan.io](https://conan.io/downloads.html) to downlo Once installation is complete, verify you can use Conan in your terminal by running -```sh +```shell conan --version ``` @@ -48,7 +48,7 @@ Conan version 1.20.5 When developing with C++ and Conan, you have a wide range of options for compilers. This tutorial walks through using the cmake compiler. In your terminal, run the command -```sh +```shell cmake --version ``` @@ -69,13 +69,13 @@ Clone the repo and it can be used for the rest of the tutorial if you don't have In your terminal, navigate to the root folder of your project. Generate a new recipe by running `conan new` and providing it with a package name and version: -```sh +```shell conan new Hello/0.1 -t ``` Next, you will create a package for that recipe by running `conan create` providing the Conan user and channel: -```sh +```shell conan create . my-org+my-group+my-project/beta ``` @@ -94,7 +94,7 @@ You are now ready to upload your package to the GitLab registry. To get started, Add a new remote to your Conan configuration: -```sh +```shell conan remote add gitlab https://gitlab.example.com/api/v4/packages/conan ``` @@ -102,7 +102,7 @@ Once the remote is set, you can use the remote when running Conan commands by ad For example: -```sh +```shell conan search Hello* --all --remote=gitlab ``` @@ -114,7 +114,7 @@ You will need to generate a [personal access token](../../../user/profile/person Once you have a personal access token and have [set your Conan remote](#adding-the-gitlab-package-registry-as-a-conan-remote), you can associate the token with the remote so you do not have to explicitly add them to each Conan command you run: -```sh +```shell conan user <gitlab-username> -r gitlab -p <personal_access_token> ``` @@ -129,7 +129,7 @@ The personal access token is not stored locally at any moment. Conan uses JWT, s Alternatively, you could explicitly include your credentials in any given command. For example: -```sh +```shell CONAN_LOGIN_USERNAME=<gitlab-username> CONAN_PASSWORD=<personal_access_token> conan upload Hello/0.1@my-group+my-project/beta --all --remote=gitlab ``` @@ -137,7 +137,7 @@ CONAN_LOGIN_USERNAME=<gitlab-username> CONAN_PASSWORD=<personal_access_token> co If you'd like Conan to always use GitLab as the registry for your package, you can tell Conan to always reference the GitLab remote for a given package recipe: -```sh +```shell conan remote add_ref Hello/0.1@my-group+my-project/beta gitlab ``` @@ -147,7 +147,7 @@ This functionality is best suited for when you want to consume or install packag The rest of the example commands in this documentation assume that you have added a Conan user with your credentials to the `gitlab` remote and will not include the explicit credentials or remote option, but be aware that any of the commands could be run without having added a user or default remote: -```sh +```shell `CONAN_LOGIN_USERNAME=<gitlab-username> CONAN_PASSWORD=<personal_access_token> <conan command> --remote=gitlab ``` @@ -159,7 +159,7 @@ Ensure you have a project created on GitLab and that the personal access token y You can upload your package to the GitLab Package Registry using the `conan upload` command: -```sh +```shell conan upload Hello/0.1@my-group+my-project/beta --all ``` @@ -200,13 +200,13 @@ Add the Conan recipe to the `[requires]` section of the file: Next, from the root of your project, create a build directory and navigate to it: -```sh +```shell mkdir build && cd build ``` Now you can install the dependencies listed in `conanfile.txt`: -```sh +```shell conan install .. ``` @@ -220,7 +220,7 @@ There are two ways to remove a Conan package from the GitLab Package Registry. - **Using the Conan client in the command line:** - ```sh + ```shell conan remove Hello/0.2@user/channel --remote=gitlab ``` @@ -238,7 +238,7 @@ The `conan search` command can be run searching by full or partial package name, To search using a partial name, use the wildcard symbol `*`, which should be placed at the end of your search (e.g., `my-packa*`): -```sh +```shell conan search Hello --all --remote=gitlab conan search He* --all --remote=gitlab conan search Hello/0.1@my-group+my-project/beta --all --remote=gitlab @@ -250,7 +250,7 @@ The scope of your search will include all projects you have permission to access The `conan info` command will return info about a given package: -```sh +```shell conan info Hello/0.1@my-group+my-project/beta ``` diff --git a/doc/user/packages/container_registry/index.md b/doc/user/packages/container_registry/index.md index b10430633ff..c9e60d1497f 100644 --- a/doc/user/packages/container_registry/index.md +++ b/doc/user/packages/container_registry/index.md @@ -60,7 +60,7 @@ using your GitLab credentials. For example if the Registry's URL is `registry.example.com`, then you should be able to login with: -```sh +```shell docker login registry.example.com ``` @@ -68,7 +68,7 @@ Building and publishing images should be a straightforward process. Just make sure that you are using the Registry URL with the namespace and project name that is hosted on GitLab: -```sh +```shell docker build -t registry.example.com/group/project/image . docker push registry.example.com/group/project/image ``` @@ -94,7 +94,7 @@ registry.example.com/group/project/my/image:rc1 To download and run a container from images hosted in GitLab Container Registry, use `docker run`: -```sh +```shell docker run [options] registry.example.com/group/project/image [arguments] ``` @@ -134,7 +134,7 @@ The minimal scope needed for both of them is `read_registry`. Example of using a token: -```sh +```shell docker login registry.example.com -u <username> -p <token> ``` @@ -153,13 +153,13 @@ Examples: - Select all tags, keep at least 1 tag per image, expire any tag older than 14 days, run once a month, and the policy is enabled: - ```bash + ```shell curl --request PUT --header 'Content-Type: application/json;charset=UTF-8' --header "PRIVATE-TOKEN: <your_access_token>" --data-binary '{"container_expiration_policy_attributes":{"cadence":"1month","enabled":true,"keep_n":1,"older_than":"14d","name_regex":".*"}' 'https://gitlab.example.com/api/v4/projects/2' ``` - Select only tags with a name that contains `stable`, keep at least 50 tag per image, expire any tag older than 7 days, run every day, and the policy is enabled: - ```bash + ```shell curl --request PUT --header 'Content-Type: application/json;charset=UTF-8' --header "PRIVATE-TOKEN: <your_access_token>" --data-binary '{"container_expiration_policy_attributes":{"cadence":"1day","enabled":true,"keep_n":50"older_than":"7d","name_regex":"*stable"}' 'https://gitlab.example.com/api/v4/projects/2' ``` diff --git a/doc/user/packages/dependency_proxy/index.md b/doc/user/packages/dependency_proxy/index.md index 1cebd734a99..7e15df7b433 100644 --- a/doc/user/packages/dependency_proxy/index.md +++ b/doc/user/packages/dependency_proxy/index.md @@ -41,19 +41,19 @@ To get a Docker image into the dependency proxy: - Manually pulling the Docker image: - ```bash + ```shell docker pull gitlab.com/groupname/dependency_proxy/containers/alpine:latest ``` - From a `Dockerfile`: - ```bash + ```shell FROM gitlab.com/groupname/dependency_proxy/containers/alpine:latest ``` - In [`.gitlab-ci.yml`](../../../ci/yaml/README.md#image): - ```bash + ```shell image: gitlab.com/groupname/dependency_proxy/containers/alpine:latest ``` diff --git a/doc/user/packages/maven_repository/index.md b/doc/user/packages/maven_repository/index.md index ea052703416..f65042d2684 100644 --- a/doc/user/packages/maven_repository/index.md +++ b/doc/user/packages/maven_repository/index.md @@ -261,7 +261,7 @@ Once you have set up the [authentication](#authenticating-to-the-gitlab-maven-re and [configuration](#configuring-your-project-to-use-the-gitlab-maven-repository-url), test to upload a Maven artifact from a project of yours: -```sh +```shell mvn deploy ``` diff --git a/doc/user/packages/npm_registry/index.md b/doc/user/packages/npm_registry/index.md index a0c82fd3e3c..58b4bf6a710 100644 --- a/doc/user/packages/npm_registry/index.md +++ b/doc/user/packages/npm_registry/index.md @@ -43,7 +43,7 @@ NPM to your local development environment. Once installation is complete, verify you can use NPM in your terminal by running: -```sh +```shell npm --version ``` @@ -61,7 +61,7 @@ your development environment. Once installed, you can verify that Yarn is available with the following command: -```sh +```shell yarn --version ``` @@ -77,13 +77,13 @@ Understanding how to create a full JavaScript project is outside the scope of this guide but you can initialize a new empty package by creating and navigating to an empty directory and using the following command: -```sh +```shell npm init ``` Or if you're using Yarn: -```sh +```shell yarn init ``` @@ -110,7 +110,7 @@ If you have 2FA enabled, you need to use a [personal access token](../../profile To authenticate with a [personal access token](../../profile/personal_access_tokens.md), set your NPM configuration: -```bash +```shell # Set URL for your scoped packages. # For example package with name `@foo/bar` will use this URL for download npm config set @foo:registry https://gitlab.com/api/v4/packages/npm/ @@ -140,7 +140,7 @@ If you encounter an error message with [Yarn](https://yarnpkg.com/en/), see the To avoid hard-coding the `authToken` value, you may use a variables in its place: -```bash +```shell npm config set '//gitlab.com/api/v4/projects/<your_project_id>/packages/npm/:_authToken' "${NPM_TOKEN}" npm config set '//gitlab.com/api/v4/packages/npm/:_authToken' "${NPM_TOKEN}" ``` @@ -149,7 +149,7 @@ Then, you could run `npm publish` either locally or via GitLab CI/CD: - **Locally:** Export `NPM_TOKEN` before publishing: - ```sh + ```shell NPM_TOKEN=<your_token> npm publish ``` @@ -191,7 +191,7 @@ domain name. Once you have enabled it and set up [authentication](#authenticating-to-the-gitlab-npm-registry), you can upload an NPM package to your project: -```sh +```shell npm publish ``` @@ -248,7 +248,7 @@ NPM packages are commonly installed using the the `npm` or `yarn` commands inside a JavaScript project. If you haven't already, you will need to set the URL for scoped packages. You can do this with the following command: -```sh +```shell npm config set @foo:registry https://gitlab.com/api/v4/packages/npm/ ``` @@ -259,13 +259,13 @@ is setup so you can successfully install the package. Once this has been completed, you can run the following command inside your project to install a package: -```sh +```shell npm install @my-project-scope/my-package ``` Or if you're using Yarn: -```sh +```shell yarn add @my-project-scope/my-package ``` @@ -302,7 +302,7 @@ deploy: If you are using [yarn](https://yarnpkg.com/en/) with the NPM registry, you may get an error message like: -```sh +```shell yarn install v1.15.2 warning package.json: No license field info No lockfile found. @@ -351,7 +351,7 @@ And the `.npmrc` file should look like: You do not need a token to run `npm install` unless your project is private (the token is only required to publish). If the `.npmrc` file was checked in with a reference to `$NPM_TOKEN`, you can remove it. If you prefer to leave the reference in, you'll need to set a value prior to running `npm install` or set the value using [GitLab environment variables](./../../../ci/variables/README.md): -```bash +```shell NPM_TOKEN=<your_token> npm install ``` @@ -384,7 +384,7 @@ a package without specifying the tag or version. Examples of the supported `dist-tag` commands and using tags in general: -```sh +```shell npm publish @scope/package --tag # Publish new package with new tag npm dist-tag add @scope/package@version my-tag # Add a tag to an existing package npm dist-tag ls @scope/package # List all tags under the package diff --git a/doc/user/packages/nuget_repository/index.md b/doc/user/packages/nuget_repository/index.md index 212641222f8..d32683e1d40 100644 --- a/doc/user/packages/nuget_repository/index.md +++ b/doc/user/packages/nuget_repository/index.md @@ -17,7 +17,7 @@ If you have [Visual Studio](https://visualstudio.microsoft.com/vs/), [nuget CLI] You can confirm that [nuget CLI](https://www.nuget.org/) is properly installed with: -```sh +```shell nuget help ``` @@ -63,7 +63,7 @@ You can now add a new source to nuget either using [nuget CLI](https://www.nuget To add the GitLab NuGet Repository as a source with `nuget`: -```sh +```shell nuget source Add -Name <source_name> -Source "https://example.gitlab.com/api/v4/projects/<your_project_id>/packages/nuget/index.json" -UserName <gitlab_username> -Password <gitlab_token> ``` @@ -77,7 +77,7 @@ Replace: For example: -```sh +```shell nuget source Add -Name "GitLab" -Source "https//gitlab.example/api/v4/projects/10/packages/nuget/index.json" -UserName carol -Password 12345678asdf ``` diff --git a/doc/user/packages/workflows/monorepo.md b/doc/user/packages/workflows/monorepo.md index 9f281d2b31c..0c7fb4a1a20 100644 --- a/doc/user/packages/workflows/monorepo.md +++ b/doc/user/packages/workflows/monorepo.md @@ -76,7 +76,7 @@ Using the example project above, this `gitlab-ci.yml` file will publish and publish `MyPackage` anytime changes are made to anywhere _except_ the `Foo` directory on the `master` branch. -```sh +```shell stages: - build diff --git a/doc/user/packages/workflows/project_registry.md b/doc/user/packages/workflows/project_registry.md index d8c1c7c2861..df330931ac5 100644 --- a/doc/user/packages/workflows/project_registry.md +++ b/doc/user/packages/workflows/project_registry.md @@ -80,6 +80,6 @@ if your project is located at `https://gitlab.com/foo/bar/my-proj`, then you can using `conan create . foo+bar+my-proj/channel`, where `channel` is your package channel (`stable`, `beta`, etc.). Once your package is created, you are ready to [upload your package](../conan_repository/index.md#uploading-a-package) depending on your final package recipe. For example: -```sh +```shell CONAN_LOGIN_USERNAME=<gitlab-username> CONAN_PASSWORD=<personal_access_token> conan upload MyPackage/1.0.0@foo+bar+my-proj/channel --all --remote=gitlab ``` |