我有一个 CI,它在创建的每个拉取请求和每次推送新提交时运行。此 CI 安装 Python 依赖项,然后运行一些测试。我使用两个单独的requirements.txt 文件,因为其中一个包含较重的包,并且它们在 Docker 中的处理方式不同。我正在尝试使用actions/cache@v2操作来缓存依赖项,但据我所知,它仅在同一分支中的运行之间进行缓存。因此,例如,当我创建新的 PR 时,不会从另一个分支检测到缓存,并且所有内容都会从头开始安装。有没有办法缓存工作流运行之间的依赖关系?那么,如果需求没有发生任何变化,CI 在一个分支中创建的缓存可以被另一个分支使用吗?
查看在两个不同分支中运行的工作流的日志,缓存键是相同的:
branchACache not found for input keys: /opt/hostedtoolcache/Python/3.8.12/x64-03a86b868f006751e123da18168c989ab4c3c2713de4f5c87cf732ffbb6fb4ae-cd1b416332d9d5b55f413e2bd74c2efce6107aef1ce3f497fa5a81b9abc83deb
Run Code Online (Sandbox Code Playgroud)
branchBCache not found for input keys: /opt/hostedtoolcache/Python/3.8.12/x64-03a86b868f006751e123da18168c989ab4c3c2713de4f5c87cf732ffbb6fb4ae-cd1b416332d9d5b55f413e2bd74c2efce6107aef1ce3f497fa5a81b9abc83deb
Run Code Online (Sandbox Code Playgroud)
Cache not found for input keys: /opt/hostedtoolcache/Python/3.8.12/x64-03a86b868f006751e123da18168c989ab4c3c2713de4f5c87cf732ffbb6fb4ae-cd1b416332d9d5b55f413e2bd74c2efce6107aef1ce3f497fa5a81b9abc83deb
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Terraform 中创建一个模块,以在 Kubernetes 集群中创建基本资源,这意味着一个cert-manager, ingress-nginx(作为入口控制器)和一个ClusterIssuer用于证书。按照这个确切的顺序。
前两个我使用helm_release资源和cluster_issuervia进行安装kubernetes_manifest。
我收到以下错误,经过一些 Google 搜索后,我发现这是因为cert-manager安装了所需的 CRD ,ClusterIssuer但在这个terraform plan阶段,由于它们尚未安装,清单无法检测到ClusterIssuer.
然后,我想知道是否有一种方法可以绕过这个问题,但仍然可以在相同的配置中仅使用一个来创建所有内容terraform apply?
注意:我尝试使用 dependent_on 参数并包含一个time_sleep块,但它没有用,因为计划中没有安装任何内容,这就是它失败的地方
| Error: Failed to determine GroupVersionResource for manifest\n\xe2\x94\x82 \n\xe2\x94\x82 with module.k8s_base.kubernetes_manifest.cluster_issuer,\n\xe2\x94\x82 on ../../modules/k8s_base/main.tf line 37, in resource "kubernetes_manifest" "cluster_issuer":\n\xe2\x94\x82 37: resource "kubernetes_manifest" "cluster_issuer" {\n\xe2\x94\x82 \n\xe2\x94\x82 no matches for kind "ClusterIssuer" in group "cert-manager.io"\nRun Code Online (Sandbox Code Playgroud)\n … 我正在从 Helm Chart 部署一个监控堆栈kube-prometheus-stack,并尝试配置 Alertmanager,以便它具有我的自定义配置,用于在 Slack 通道中发出警报。
Pod 中的配置是从 加载的/etc/alertmanager/config/alertmanager.yaml。从 Pod 描述来看,该文件是从自动生成的 Secret 中加载的:
...
volumeMounts:
- mountPath: /etc/alertmanager/config
name: config-volume
...
volumes:
- name: config-volume
secret:
defaultMode: 420
secretName: alertmanager-prometheus-community-kube-alertmanager-generated
Run Code Online (Sandbox Code Playgroud)
如果我检查秘密,它包含在默认值中找到的默认配置alertmanager.config,我打算覆盖它。
如果我将以下配置传递给alertmanager以全新安装图表,它不会创建alertmanager pod:
alertmanager:
config:
global:
resolve_timeout: 5m
route:
group_by: ['job', 'alertname', 'priority']
group_wait: 10s
group_interval: 1m
routes:
- match:
alertname: Watchdog
receiver: 'null'
- receiver: 'slack-notifications'
continue: true
receivers:
- name: 'slack-notifications'
slack-configs:
- slack_api_url: <url here>
title: '{{ .Status }} ({{ …Run Code Online (Sandbox Code Playgroud) kubernetes kubernetes-helm prometheus-alertmanager kube-prometheus-stack
Inline当关系与其自身存在时,如何才能在多对多关系中使模型的字段可编辑?
class MyModel(models.Model):
children = models.ManyToManyField(
'self',
related_name='parents',
symmetrical=False
)
Run Code Online (Sandbox Code Playgroud)
class MyModelChildAdminInline(admin.TabularInline):
"""Inline for the intermediate table"""
model = MyModel.children.through
# Number of child-forms shown at the bottom of the Profile detail view
extra = 0
fk_name = 'from_mymodel'
raw_id_fields = ("to_mymodel",)
fields = ('to_mymodel', 'field1', 'field2', 'field3', )
readonly_fields = ('field1', 'field2', 'field3',)
def field1(self, obj):
return obj.to_mymodel.field1
def field2(self, obj):
return obj.to_mymodel.field3
def field3(self, obj):
return obj.to_mymodel.field2
Run Code Online (Sandbox Code Playgroud)
@admin.register(MyModel)
class MyModelAdmin(VersionAdmin):
inlines = (MyModelChildAdminInline, )
exclude = ('children', …Run Code Online (Sandbox Code Playgroud) 在我的 Django 项目中,我有一个用于运行测试的 CI 工作流程,这需要 Postgres 服务。最近,一个新的应用程序引入了更重的软件包,例如 pandas、matplotlib、pytorch 等,这将run-tests工作时间从 2 分钟增加到了 12 分钟,这是荒谬的。另外,在我的项目中,我有一个带有 Python 的基本 Docker 映像,以及这些较重的包,可以加快映像的构建速度。因此,我考虑在运行步骤时在工作流程中使用相同的图像,因为包已经加载。
不幸的是,一切都很顺利,直到到达实际运行测试的步骤,因为 postgres 服务似乎未与容器连接,并且出现以下错误:
psycopg2.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)
这就是我现在的工作流程。关于我做错了什么有什么想法吗?
psycopg2.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的 Python 脚本与 Google App 脚本中的项目连接起来。我已遵循本指南中的所有说明。
当然,我已将其部署为可执行 API,并对其进行了测试,仅允许我自己、我的组织和任何人选项访问。
devMode当我用as传递请求时true,一切正常。据我所知,在这种情况下,它正在运行最新保存的版本。但是,当我将其设置为false然后我收到错误时,"message": "Requested entity was not found."据我了解,该错误正在尝试运行最新部署的版本。
我也尝试过解决这些问题1和2,但显然,他们遇到的问题是相反的,即脚本无法在devMode设置为 的情况下运行true。
其他一切似乎都正确执行,但我找不到它在不打开的情况下无法运行脚本的原因devMode
这是我的脚本:
"""
Shows basic usage of the Apps Script API.
Call the Apps Script API to create a new script project, upload a file to the
project, and log the script's URL to the user.
"""
from __future__ import print_function
import pickle
import os.path
from …Run Code Online (Sandbox Code Playgroud) kubernetes ×2
django ×1
django-admin ×1
django-forms ×1
github ×1
postgresql ×1
python ×1
terraform ×1