解锁 Jenkins 并进行初始设置后,我在 Jenkins 中创建了一个管理员帐户。现在我忘记了管理员帐户的密码,并且无法登录Jenkins
我对詹金斯很陌生,所以也许问题很明显。
我在 Windows 机器上有 Jenkins,我需要在远程 nix 机器上运行命令,在那里我有 ssh 访问权限(通过用户名/密码)。我有一个管道并使用 ssh-steps 插件作为管道我可以连接和执行命令,但是我需要获得命令的输出才能继续前进,但我找不到正确的方法来做到这一点。
def remote = [:]
remote.name = 'UAT'
remote.host = 'test.domain'
remote.user = 'username'
remote.password = 'pass'
remote.allowAnyHosts = true
stage('Remote SSH') {
sshCommand remote: remote, command: "ls -ll"
}
Run Code Online (Sandbox Code Playgroud)
是否可以使用此插件来实现,或者我需要使用另一个插件?据我了解,这个插件是专门为在管道脚本中使用 ssh 而创建的。
我的 Springboot 应用程序工作正常,连接到数据源。对于 Junit,我通过排除 DatasourceAutoConfiguration、DataSourceTransactionManagerConfiguration、HibernateJpaAutoConfiguration 类来禁用数据源的自动配置,以避免 SpringBoot 自动配置数据源。
pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.2.5.RELEASE</version>
<dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.2.2.jre8</version>
<dependency>
Run Code Online (Sandbox Code Playgroud)
主班
@SpringBootApplication
@EnableAutoConfiguration
@ComponentScan({"com.basepackage"})
public class SampleClass{
psvm(){
SpringApplication.run(SampleClass.class,args);
}
}
Run Code Online (Sandbox Code Playgroud)
Juni测试班
@RunWith(SpringRunner.class)
@SpringBootTest(classes=SampleClass.class)
@AutoConfigureMockMvc
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class, DataSourceTransactionManagerConfiguration.class, HibernateJpaAutoConfiguration.class})
public class SampleControllerTest {
@MockBean
private SampleService service;
@Test
public void fetchUsers() {
Mockito.when(service.retrieveUsers().thenReturn(new SampleResponse());
}
Run Code Online (Sandbox Code Playgroud)
}
在 mvn 测试中,测试脚本已运行但失败,因为 Springboot 未自动配置 SampleRepository bean(可能是因为排除了 Datasource 和 HibernateJpa 自动配置类)
错误
Caused by UnsatisfiedDependencyException: Error creating bean with name ServiceDAOImpl, …Run Code Online (Sandbox Code Playgroud) [root@###~]# yum install jenkins 加载的插件:fastestmirror、product-id、search-disabled-repos、subscription-manager
该系统未向授权服务器注册。您可以使用订阅管理器进行注册。
从缓存的主机文件加载镜像速度
配置的存储库之一失败(Jenkins-stable),并且 yum 没有足够的缓存数据来继续。此时 yum 能做的唯一安全的事情就是失败。有几种方法可以“修复”这个问题:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and …Run Code Online (Sandbox Code Playgroud)