小编Vik*_*ore的帖子

重命名远程分支而不删除它

我需要你的帮助来重命名远程分支。
我创建了一个 PR,但现在我需要重命名远程分支名称。
我不想遵循必须重命名本地分支然后推送并删除旧分支的过程,因为这会清除 PR。
有没有办法只重命名远程分支,而 PR 应该保持原样。谢谢。

git

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

如何在 Github Action 中将有条件的工作放入需要另一项工作的位置

下面是我的 GitHub 工作流程

name: APP Build
on:
  push:
    branches:
      - feature/test

jobs:
  test-1:
    runs-on: ubuntu-latest
    if: ${{ github.event_name == 'push' && contains( github.event.head_commit.message, 'test1') }}
    steps:
      - name: test-fail
        run: echo "test1"
  test-2:
    runs-on: ubuntu-latest
    if: ${{ github.event_name == 'push' && contains( github.event.head_commit.message, 'test2') }}
    steps:
      - name: test-fail
        run: echo "test1"
  notify-slack:
    name: Slack Notification
    runs-on: ubuntu-latest
    needs: [test-1, test-2]
    steps:
      - name: Slack Notification
        uses: rtCamp/action-slack-notify@v2.2.0
        env:
          SLACK_CHANNEL: alert
          SLACK_COLOR: "${{ job.status == 'success' && 'good' || 'danger' …
Run Code Online (Sandbox Code Playgroud)

github-actions

13
推荐指数
1
解决办法
1万
查看次数

如何在gitlabci上使用if-else条件

如何在gitlab-CI内部使用else条件。

我有以下代码:

deploy-dev:
  image: testimage
  environment: dev
  tags:
    - kubectl
  script:
   - kubectl apply -f demo1 --record=true
   - kubectl apply -f demo2 --record=true
Run Code Online (Sandbox Code Playgroud)

现在我想添加一个类似这样的条件

script:
    - (if [ "$flag" == "true" ]; then kubectl apply -f demo1 --record=true; else kubectl apply -f demo2 --record=true);
Run Code Online (Sandbox Code Playgroud)

有人可以提供相同的正确语法吗?gitlabci中是否有关于条件(if-else,for循环)的文档?

if-statement gitlab-ci

12
推荐指数
4
解决办法
1万
查看次数

Jenkins 管道失败:远程调用来自 XXX 的 JNLP4-connect 连接失败

从 svn 检出时,我的 Jenkins 管道失败。下面是错误。

Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from nobuild01.sdi.pvt/152.144.34.14:50396
        at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
        at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
        at hudson.remoting.Channel.call(Channel.java:955)
        at hudson.FilePath.act(FilePath.java:1036)
        at hudson.FilePath.act(FilePath.java:1025)
        at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:928)
        at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:864)
        at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
        at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85)
        at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75)
        at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
        at hudson.security.ACL.impersonate(ACL.java:290)
        at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
java.lang.NoClassDefFoundError: Could not initialize class jenkins.model.Jenkins
    at hudson.scm.SubversionSCM.descriptor(SubversionSCM.java:2584)
    at hudson.scm.SubversionSCM.createDefaultSVNOptions(SubversionSCM.java:1085)
    at hudson.scm.SubversionSCM.createClientManager(SubversionSCM.java:1075)
    at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:1002)
    at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:979)
    at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2918)
    at hudson.remoting.UserRequest.perform(UserRequest.java:212)
    at hudson.remoting.UserRequest.perform(UserRequest.java:54)
    at hudson.remoting.Request$2.run(Request.java:369)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) …
Run Code Online (Sandbox Code Playgroud)

jenkins jenkins-pipeline

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

如何将SSH转换为使用docker-compose创建的服务

这是我的docker撰写文件

version: '2'

# based off compose-sample-2, only we build nginx.conf into image
# uses sample site from https://startbootstrap.com/template-overviews/agency/

services:
  proxy:
    build:
      context: .
      dockerfile: nginx.Dockerfile
    ports:
      - '80:80'
  web:
    image: httpd
    volumes:
      - ./html:/usr/local/apache2/htdocs/
Run Code Online (Sandbox Code Playgroud)

现在我可以在运行docker-compose up时使用SSH生成的任何服务吗

docker docker-compose

8
推荐指数
3
解决办法
9365
查看次数

kubernetes:如何从多个文件创建和使用 configmap

我有关于 configmap 的文档:

https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#define-container-environment-variables-using-configmap-data
Run Code Online (Sandbox Code Playgroud)

据我所知,我可以从两个文件(game.properties 和 ui.properties)创建一个配置映射(game-config-2)使用

kubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/kubectl/game.properties --from-file=configure-pod-container/configmap/kubectl/ui.properties
Run Code Online (Sandbox Code Playgroud)

现在我看到了配置图

kubectl describe configmaps game-config-2
Name:           game-config-2
Namespace:      default
Labels:         <none>
Annotations:    <none>

Data
====
game.properties:        158 bytes
ui.properties:          83 bytes
Run Code Online (Sandbox Code Playgroud)

我如何使用该配置映射?我试过这种方式:

    envFrom:
    - configMapRef:
        name: game-config-2
Run Code Online (Sandbox Code Playgroud)

但这不起作用,env 变量没有从 configmap 中选择。或者我可以在 envFrom 下有两个 configMapRef 吗?

kubernetes configmap

8
推荐指数
2
解决办法
2万
查看次数

如何在 github actions 中的作业之间共享 docker 镜像

我最近转向了 GitHub Action。尝试了几天,但可以找到合适的解决方案。

在此输入图像描述

  • JOB1我正在构建Image A并使用Image A作为基础图像来构建Image B.
  • 现在Image B将充当Image C在 JOB2 和Image DJob3 中构建的基础映像。

我已经尝试过这两种解决方案,但它们不起作用。

  1. https://github.com/docker/build-push-action/issues/225#issuecomment-727639184
  2. https://evilmartians.com/chronicles/build-images-on-github-actions-with-docker-layer-caching

尝试上述解决方案时遇到的一些错误:

Error: buildx failed with: error: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
Run Code Online (Sandbox Code Playgroud)

github-actions

7
推荐指数
0
解决办法
1539
查看次数

使用 CloudFormation 将 Docker 映像推送到 ECR

我是 DevOps 新手。

作为 gitci 的一部分,我在 GitLab 中有一个 Docker 文件。我计划创建一个 Docker 映像并将其推送到 ECR,然后使用该映像进行批处理。

我已经使用 ECR 中的现有图像完成了批处理部分。但无法创建 Docker 映像并使用 CloudFormation 进行推送。

我应该在 init 中使用命令吗?

先谢谢各位高手了

aws-cloudformation gitlab-ci docker-registry

5
推荐指数
1
解决办法
5931
查看次数

如何使用 aws cli 获取 codepipeline 日志?

因此,当我使用以下命令触发代码管道时:

aws codepipeline start-pipeline-execution --name MyFirstPipeline
Run Code Online (Sandbox Code Playgroud)

我只得到异步响应

{
    "pipelineExecutionId": "c53dbd42-This-Is-An-Example"
}
Run Code Online (Sandbox Code Playgroud)

现在如何流式传输构建和部署阶段的日志?

PS 我可以在云监视中看到日志,但是如何使用 AWS cli 获取该日志?

amazon-web-services aws-cli

5
推荐指数
0
解决办法
2010
查看次数

使用 Alpine 基础镜像创建 Splunk 通用转发器

我正在尝试使用alpine:3.8基本映像创建 Splunk 通用转发器映像。

FROM alpine:3.8

ENV SPLUNK_PRODUCT universalforwarder
ENV SPLUNK_VERSION 6.3.1
ENV SPLUNK_BUILD f3e41e4b37b2
ENV SPLUNK_FILENAME splunkforwarder-${SPLUNK_VERSION}-${SPLUNK_BUILD}-Linux-x86_64.tgz
ENV SPLUNK_SERVER_HOST testapp:9997
ENV SPLUNK_HOME /opt/splunk
ENV SPLUNK_GROUP splunk
ENV SPLUNK_USER splunk
ENV SPLUNK_BACKUP_DEFAULT_ETC /var/opt/splunk
ENV SPLUNK_INDEX test
ENV FORWARD_HOSTNAME InstanceId

# Here we install GNU libc (aka glibc) and set C.UTF-8 locale as default.
RUN apk --no-cache add ca-certificates wget \
    && wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
    && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk \
    && apk add glibc-2.28-r0.apk \
    && rm -rf …
Run Code Online (Sandbox Code Playgroud)

splunk

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

如何使用文件升级 Helm Chart 部署

以下是要安装的 Helm 代码

helm install coreos/kube-prometheus --name kube-prometheum --namespace monitoring -f kube-prometheus.yml
Run Code Online (Sandbox Code Playgroud)

通过这种方式,我们可以使用 kube-prometheus.yml 中存在的值覆盖 value.yml 值。

有什么方法可以让我们先安装然后从 kube-prometheus.yml 文件更新 value.yml 吗?

helm upgrade releasename kube-prometheum直接改value.yml文件就可以使用了。我不想要那个

用例:最初,我在 value.yml 中使用了带有标签 1.0 的图像。现在我在 kube-prometheus.yml 中有以下代码只是为了更新图像标签

prometheusconfigReloader:
image:
 tag: 2.0
Run Code Online (Sandbox Code Playgroud)

而不是删除并重新创建。我想升级它。这只是举例,可能有多个值。这就是为什么我不能使用-set。

kubernetes kubernetes-helm

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

如何到达Kubernates容器日志的结尾

通过运行命令 kubectl logs pod -c container

我正在获取连续的自动滚动日志列表。有什么办法可以结束或查看最新日志。我不想浏览所有日志。

我也尝试过使用-f。有什么建议吗?

kubernetes

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