<p>I am trying to set Gitlab runner to connect to Artifactory and pull images.My yml file to set RUnner looks like below :</p>
<p>gitlabUrl: <a href="https://gitlab.bayer.com/" rel="nofollow noreferrer">https://gitlab.bayer.com/</a><br />
runnerRegistrationToken: r*******-<br />
rbac:<br />
create: false<br />
serviceAccountName: iz-sai-s<br />
serviceAccount.name: iz-sai-s</p>
<p>runners:<br />
privileged: true</p>
<p>resources:<br />
limits:<br />
memory: 32000Mi<br />
cpu: 4000m<br />
requests:<br />
memory: 32000Mi<br />
cpu: 2000m</p>
<p>What changes are needed to configure my runner properly to connect to Artifactory URL and pull images from there ?</p>

<p>This is an example where my runner runs as docker container with an image having artifactory cli configured in it, so in your case your runner should have jfrog cli configured , next it needs an api key to access artifactory which you ll generate in artifactory and store in gitlab like below picture , exact path would be your repo - settings - CICD - variables</p>
<p>First it authenticates then uploads</p>
<pre><code>publish_job:
  stage: publish_artifact
  image: xxxxxplan/jfrog-cli
  variables:
    ARTIFACTORY_BASE_URL: https://xxxxx.com/artifactory
    REPO_NAME:  my-rep
    ARTIFACT_NAME: my-artifact
  script:
    - jfrog rt c --url=&quot;$ARTIFACTORY_BASE_URL&quot;/ --apikey=&quot;$ARTIFACTORY_KEY&quot;
    - jfrog rt u &quot;target/demo-0.0.1-SNAPSHOT.jar&quot; &quot;$REPO_NAME&quot;/&quot;$ARTIFACT_NAME&quot;_&quot;$CI_PIPELINE_ID.jar&quot; --recursive=false
</code></pre>
<p>Mark the answer as accepted if it fulfils your requirement
Also make sure to use indentation in your question which is not there
<a href="https://i.stack.imgur.com/xukah.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xukah.png" alt="enter image description here" /></a></p>
<p>Edit 1 : Adding the whole gitlab_ci.yml</p>
<pre><code>stages:
  - build_unittest
  - static_code_review
  - publish_artifact
  
  
image: maven:3.6.1-jdk-8-alpine
cache:
  paths:
    - .m2/repository
    - target/
variables:
  MAVEN_OPTS: &quot;-Dmaven.repo.local=.m2/repository&quot;

build_unittest_job:
  stage: build_unittest
  script: 'mvn clean install'
  tags:
    - my-docker 
  artifacts:
    paths:
    - target/*.jar
    expire_in: 20 minutes
  when: manual  
code_review_job:
  stage: static_code_review
  variables:
    SONARQUBE_BASE_URL: https://xxxxxx.com
  script:
    - mvn sonar:sonar -Dsonar.projectKey=xxxxxx -Dsonar.host.url=https://xxxxx -Dsonar.login=xxxxx
  
  tags:
    - my-docker
  cache:
    paths:
      - /root/.sonar/cache
      - target/
      - .m2/repository
  when: manual    
publish_job:
  stage: publish_artifact
  image: plan/jfrog-cli
  variables:
    ARTIFACTORY_BASE_URL: https://xxxx/artifactory
    REPO_NAME:  maven
    ARTIFACT_NAME: myart
  script:
    - jfrog rt c --url=&quot;$ARTIFACTORY_BASE_URL&quot;/ --apikey=&quot;$ARTIFACTORY_KEY&quot;
    - jfrog rt u &quot;target/demo-SNAPSHOT.jar&quot; &quot;$REPO_NAME&quot;/&quot;$ARTIFACT_NAME&quot;_&quot;$CI_PIPELINE_ID.jar&quot; --recursive=false
  tags:
    - my-docker
  when: manual  
</code></pre>
