当我测量服务器上的文件夹大小时,我有一个8 GB的SVN存储库.
但是,当我在本地检查它(只是从根,所有分支/标签检查完整的存储库)其50+ GB(仍在计数).
似乎SVN在压缩其内容方面做得很好.为什么尺寸如此不同?
有没有办法计算存储库的实际大小而无需在本地进行完整的结账?
我在 eclipse 中有以下 Spring 项目:
当我去:
http://[my-host]:8082/webapp-module/hello
Run Code Online (Sandbox Code Playgroud)
WEB /INF/jsp/hello.jsp页面加载得很好。但我还想在访问时定义一个默认起始页(WEB/INF/index.jsp):
http://[my-host]:8082/webapp-module
Run Code Online (Sandbox Code Playgroud)
目前这不起作用。我需要为此添加一个单独的控制器吗?
我的web.xml文件:
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Spring MVC Application</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/webapp-module-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>webapp-module</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>webapp-module</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
Run Code Online (Sandbox Code Playgroud)
我的webapp-module-servlet.xml文件:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:annotation-config/>
<context:component-scan base-package="com.samples" />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud) 我正在尝试移植:
https://coderwall.com/p/ewk0mq/stop-remove-all-docker-containers
到python脚本。到目前为止,我有:
def remove_all_containers():
subprocess.call(['docker', 'stop','$(docker ps -a -q)'])
subprocess.call(['docker', 'rm','$(docker ps -a -q)'])
return;
Run Code Online (Sandbox Code Playgroud)
但是得到:
Error response from daemon: No such container: $(docker ps -a -q)
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
def remove_all_containers():
subprocess.call(['docker', 'stop',$(docker ps -a -q)])
subprocess.call(['docker', 'rm',$(docker ps -a -q)])
return;
Run Code Online (Sandbox Code Playgroud)
但这给出了:
subprocess.call(['docker', 'stop',$(docker ps -a -q)])
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
看来我需要将另一个子流程调用嵌套到父子流程调用中。还是有一个更简单的方法来做到这一点?
在 jenkinsfile 中,我使用以下命令调用 curl:
sh "curl -X POST -i -u admin:admin https://[myhost]"
Run Code Online (Sandbox Code Playgroud)
我得到这样的输出:
...
HTTP/1.1 204 No Content
Server: Apache-Coyote/1.1
...
Run Code Online (Sandbox Code Playgroud)
我想根据上述调用的响应代码采取不同的操作,但如何仅将响应代码/回复存储在变量中?
在使用共享库的 jenkinsfile 中(在 jenkins 文件夹/不受信任上配置),我有以下行:
def itemTime = Instant.parse("2018-02-27T13:33:36Z")
Run Code Online (Sandbox Code Playgroud)
当我运行管道时,我得到:
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod java.time.Instant parse java.lang.CharSequence
at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectStaticMethod(StaticWhitelist.java:189)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onStaticCall(SandboxInterceptor.java:150)
at org.kohsuke.groovy.sandbox.impl.Checker$2.call(Checker.java:184)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedStaticCall(Checker.java:188)
Run Code Online (Sandbox Code Playgroud)
当然我可以手动批准脚本方法:
staticMethod java.time.Instant parse java.lang.CharSequence
Run Code Online (Sandbox Code Playgroud)
关于詹金斯大师,我也看了:
Jenkins CI 管道脚本不允许使用方法 groovy.lang.GroovyObject
但:
我在我的 git 存储库中添加了一个 git 子模块,它工作正常。
在我的“父”存储库中,我创建了一个功能分支:myfeature,它需要对子模块进行一些更改。但我不想影响使用相同子模块的其他团队。因此,我在子模块存储库submodule-feature上创建了一个相应的功能分支,并进行了一些更改。然后我在子模块目录中添加/提交更改,然后在父存储库的根目录中添加/提交更改。
但是当我在我的“父”存储库上切换回master时,子模块仍然在submodule-feature功能分支上。这不是我所期望的。因为现在当我在master上运行我的测试时,它们会失败,因为我在submodule-feature分支上的子模块中引入了一些重大更改。
是否无法将子模块的分支锁定到父存储库分支?
编辑:基于: 如何在添加 Git 子模块时指定分支/标签?
看起来我可以在中为子模块存储库指定一个分支 .gitmodules
[submodule "mysubmodule"]
path = mysubmodule
url = https://bla.git
branch = submodule-feature
Run Code Online (Sandbox Code Playgroud)
并在 jenkins 中添加以下额外的 git 行为:
和:
submodule-feature
在父 myfeature分支上运行构建时,它会克隆/检出分支。
但是,在本地工作时,这当然需要一些手动步骤。但是从 CI 方面来说,它很容易实现。
我有这个入口对象,我正在尝试修补secretName
:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: hello-world
...
spec:
rules:
- host: my.host
http:
paths:
- backend:
serviceName: hello-world
servicePort: 8080
tls:
- hosts:
- my.host
secretName: my-secret
Run Code Online (Sandbox Code Playgroud)
我想使用kubectl patch
我尝试过的方法更新秘密名称:
$ kubectl patch ing hello-world -p '{"spec":{"tls":{"secretName":"updated"}}}'
Error from server: cannot restore slice from map
Run Code Online (Sandbox Code Playgroud)
和:
$ kubectl patch ing hello-world -p '[{"op": "replace", "path": "/spec/tls/secretName", "value" : "updated"}]'
Error from server (BadRequest): json: cannot unmarshal array into Go value of type map[string]interface {}
Run Code Online (Sandbox Code Playgroud)
有什么建议么?
我通常通过以下方式重新启动我的应用程序:
kubectl scale deployment my-app --replicas=0
Run Code Online (Sandbox Code Playgroud)
其次是:
kubectl scale deployment my-app --replicas=1
Run Code Online (Sandbox Code Playgroud)
效果很好。我还有另一个正在运行的应用程序,但是当我查看它的副本集时,我看到:
$ kubectl get rs
NAME DESIRED CURRENT READY AGE
another-app 2 2 2 2d
Run Code Online (Sandbox Code Playgroud)
因此,要正确重新启动,我当然需要:
kubectl scale deployment another-app --replicas=0
kubectl scale deployment another-app --replicas=2
Run Code Online (Sandbox Code Playgroud)
但是有没有更好的方法来做到这一点,这样我就不必在扩展/重新启动我的应用程序(可能有replicas > 1
)之前手动查看复制集?
嗨,我正在尝试创建一个Windows bat文件,检查文件夹是否包含指定扩展名的文件,并运行一些基本命令.就像是:
set inputFolder=%1
if [%inputFolder%.containsExtension("class")] goto exists
goto end
:exists
:end
Run Code Online (Sandbox Code Playgroud)
但是如何检查inputFolder中文件的扩展名?
git ×2
jenkins ×2
kubernetes ×2
batch-file ×1
curl ×1
eclipse ×1
git-rebase ×1
groovy ×1
jsp ×1
kubectl ×1
python ×1
spring-mvc ×1
svn ×1