小编L. *_*per的帖子

使用 Jib 和 Gitlab-CI 构建 docker 镜像

我正在尝试创建一个管道,其中使用 JIB(通过 Maven 插件)创建 docker 映像并将其推送到我的 Gitlab 注册表。

当我登录到我的 docker 注册表时,这在本地工作得很好。

<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>1.0.0</version>
    <configuration>
        <allowInsecureRegistries>true</allowInsecureRegistries>
        <from>
            <image>dockerhost/projectgroup/alpine</image>
        </from>
        <to>
            <image>dockerhost/project/imagename:${project.version}</image>
        </to>
        <container>
            <useCurrentTimestamp>true</useCurrentTimestamp>
        </container>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

假设我有一个 .gitlab-ci.yml ,如下所示:

stages:
  - build_image

build_image:
  stage: build_image
tags:
  - dev
script: |
  mvn compile jib:build
Run Code Online (Sandbox Code Playgroud)

现在,当管道被触发时,我遇到了异常

Build image failed: Failed to authenticate with registry dockerhost/projectgroup/alpine because: peer not authenticated
Run Code Online (Sandbox Code Playgroud)

我假设我收到此错误是因为我尚未运行 docker login -u [用户名] -p [密码/令牌]

我如何需要一个使用 docker-in-docker 映像的 .gitlab-ci.yml 才能在我的脚本中运行 docker 登录?

除了使用 docker-in-docker 映像在我的 Gitlab CI 上构建此映像之外,还有其他选择吗?

gitlab docker gitlab-ci jib

3
推荐指数
1
解决办法
9236
查看次数

Helm 阻止在 helm init 上添加默认图表存储库

我想使用 Helm 和 Gitlab 将我的服务部署到 OpenShift。

我在 OpenShift 中部署了一个 Gitlab Runner。

我已经在 Openshift 的tiller命名空间下安装了 Tiller并且正在使用docker镜像docker.greater.com.au/platform/images/dtzar/helm-kubectl:latest

我的系统也位于我无法通过的代理后面。

作为我的 Gitlab CI 构建步骤之一的一部分,我有以下内容:

$ helm init --client-only
Creating /root/.helm 
Creating /root/.helm/repository 
Creating /root/.helm/repository/cache 
Creating /root/.helm/repository/local 
Creating /root/.helm/plugins 
Creating /root/.helm/starters 
Creating /root/.helm/cache/archive 
Creating /root/.helm/repository/repositories.yaml 
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com 
Error: Looks like "https://kubernetes-charts.storage.googleapis.com" is not a valid chart repository or cannot be reached: Get https://kubernetes-charts.storage.googleapis.com/index.yaml: Proxy Authorization Required
Run Code Online (Sandbox Code Playgroud)

我的主要问题是我想知道是否可以禁用 Helm 尝试将其添加https://kubernetes-charts.storage.googleapis.com为存储库作为helm init?

可能值得注意的是,我不知道 helm init --client-only …

openshift gitlab kubernetes kubernetes-helm

2
推荐指数
1
解决办法
3979
查看次数