小编All*_*her的帖子

AWS MFA 问题 请验证您的 MFA 序列号是否有效并与该用户关联

一直在使用https://github.com/broamski/aws-mfa处理 AWS 的 MFA,并取得了巨大成功。我有三个用户在尝试使用它时遇到以下错误:

An error occurred (AccessDenied) when calling the GetSessionToken operation: MultiFactorAuthentication failed, unable to validate MFA code. Please verify your MFA serial number is valid and associated with this user.

关于如何排除故障有什么想法吗?我有 20 多个用户,都很好;我对这三个用户的不同做法感到束手无策。我已经验证他们没有在他们的凭证文件中进行错误的复制粘贴。

amazon-web-services multi-factor-authentication

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

在Jenkinsfile中创建时间戳

我正在努力创建一个格式的时间戳,我希望在Jenkins中使用脚本管道.这是管道中的代码:

def cal = Calendar.instance
def dateFormat = 'YYYYMMDD-hhmmss'
def timeZone = TimeZone.getTimeZone('CST')
def timeStamp = cal.time?.format(dateFormat,timeZone)?
println "Timestamp is: ${timeStamp}"
env.BUILD_TIMESTAMP = timeStamp
Run Code Online (Sandbox Code Playgroud)

当我通过Jenkins运行时,我得到以下内容:

org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified field java.util.GregorianCalendar time?
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(SandboxInterceptor.java:387)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:371)
Run Code Online (Sandbox Code Playgroud)

我已经看到在线提到不同领域的类似问题,但是将其添加到scriptapproval.xml(并重新启动Jenkins)的解决方法似乎并不起作用.

任何人都有一种生成时间戳的方法,其格式与我正在尝试的格式类似?

jenkins jenkins-pipeline

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

Go 包不在 $GOROOT 中

我使用以下 Go 模块来构建应用程序:

github.com/martinlindhe/unit

现在,Go 代码非常简单;我只是想为实际工作设置环境:

import(
    "fmt"
    "unit"
    
)

foo := unit.FromFahrenheit(100)
fmt.Println("100 fahrenheit in celsius = ", foo.Celsius())
Run Code Online (Sandbox Code Playgroud)

在 go.mod 中:


go 1.17

require github.com/martinlindhe/unit v0.0.0-20210313160520-19b60e03648d
Run Code Online (Sandbox Code Playgroud)

执行go buildorgo get会导致:

package unit is not in GOROOT (/usr/local/Cellar/go/1.17/libexec/src/unit)

运行go mod download执行没有错误。go.sum 文件似乎是正确的,所有必要的依赖项都存在。

环境是最新版本的VS Code,在MacOS Big Sur 11.5.2上通过homebrew安装Go

我一定缺少一些明显的东西。我编写的其他应用程序没有遇到此问题。

go

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