我有以下gitlab-ci.yml文件,它读取package.json使用jq处理器动态设置工件文件夹的变量名称,类似于
image: node:latest
stages:
- build
before_script:
## steps ignored for purpose of question
- export NAME_OF_ARTIFACT_FOLDER=$(cat package.json | jq -r .name)"_"$(cat package.json | jq -r .version)".zip"
- echo $NAME_OF_ARTIFACT_FOLDER ##prints the expected name here eg. myApp_1.0.0.zip
prod_build:
stage: build
script:
- echo $NAME_OF_ARTIFACT_FOLDER ##prints the expected name here eg. myApp_1.0.0.zip
- yarn run build
artifacts:
paths:
- dist/$NAME_OF_ARTIFACT_FOLDER ## this does not work
expire_in: 2 hrs
Run Code Online (Sandbox Code Playgroud)
这里的问题是- dist/$NAME_OF_ARTIFACT_FOLDER不起作用,不确定这里是否遗漏了什么。
编辑
在对如下所示的预期路径进行硬编码后,它工作正常,这意味着文件夹名称是有效的,并且工件确实被正确识别,但在来自 $NAME_OF_ARTIFACT_FOLDER …
在部署实际应用程序之前,我们使用ARM模板部署azure资源作为构建过程的一部分.
到目前为止,我们所有的应用程序资源都是自包含的resource group.例如,需要sql server和存储帐户的Web应用程序被分成一个资源组.
但是,我们遇到了需要共享资源的场景/需求,例如.跨资源组的存储帐户.资源组A具有存储帐户,资源组B的Web应用程序需要与其中的存储帐户相关的连接字符串/应用程序密钥appconfig.json/web.config.
题
如何为资源组B中的应用程序构建连接字符串以连接到资源组A中的资源,因为我需要获取B中资源组A的Id
以下是我如何构建连接字符串,如果它们位于同一资源组中
"variables"
{
"storageAccounts_id": "[concat(**resourceGroupA**().id,'/providers/Microsoft.Storage/storageAccounts/', variables('storageAccntName'))]",
},
"resources": [
{
"apiVersion": "2015-08-01",
"type": "config",
"name": "connectionstrings",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('MyWebSiteName'))]"
],
"properties": {
"AzureWebJobsDashboard": {
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccntName'),';AccountKey=',concat(listKeys(variables('storageAccounts_id'),'2015-05-01-preview').key1))]",
"type": "Custom"
},
}
}
]
Run Code Online (Sandbox Code Playgroud)
注意:我确实浏览了这个网站https://azure.microsoft.com/en-us/documentation/articles/resource-group-linked-templates/关于链接模板,但它不适合我们当前使用的构建过程Octo(除非有一些我可能会遗漏的东西)先部署ARM然后再部署应用程序(web).
我的项目解决方案设置方式包含以下项目
MyProjectSolution.sln
MyProject.WebPI(Asp.net 5 WebAPI)
MyProject.Data(Asp.net 5 class libray)
MyProject.Domain(Asp.net 5 class libray)
Run Code Online (Sandbox Code Playgroud)
我按照以下文章中列出的步骤进行了操作 :https://azure.microsoft.com/en-us/documentation/articles/vs-azure-tools-connected-services-storage/和https://azure.microsoft.com/ en-us/documentation/articles/vs-storage-aspnet5-getting-started-blobs / 更改了我的project.json以包含此依赖项 "WindowsAzure.Storage":"4.3.2-preview"
但后来导致错误,说明DNXCoreVersion = 5.0不支持WindowsAzure.Storage
注意:1)我也尝试手动添加上面的依赖项,以检查它是否导致相同或不同的错误 - 没有变化.
2)我尝试浏览到sdks%Program Files%\ Microsoft SDKs\Azure.NET SDK \\ ref \的位置但找不到它.附件是我发现的dll的屏幕截图.
我可以试试特定版本吗?或者我错过了重要的事情吗?
{
"version": "1.0.0-*",
"description": "MyProject.Data Class Library",
"authors": [""],
"tags": [""],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"dnx451": {
/*These were added after I connected to the Azure Storage as seen in the article that did NOT exist before*/
"dependencies": {
"Microsoft.Data.Edm": "5.6.3", …Run Code Online (Sandbox Code Playgroud)目标:要注入IHttpContextAccessor作为依赖,autmapper轮廓的构造
原因:我需要传递当前用户的身份名称,作为构建我的一个域对象的一部分
问题 获取的用户标识始终为空
到目前为止我有什么?
Startup.cs
mc.AddProfile(new DtoToOtherProfile(new HttpContextAccessor()));
//OR
var mapperConfiguration = new MapperConfiguration(mc =>
{
IServiceProvider provider = services.BuildServiceProvider();
mc.AddProfile(new DtoToOtherProfile(provider.GetService<IHttpContextAccessor>()));
});
Run Code Online (Sandbox Code Playgroud)
DtoToOtherProfile.cs
public DtoToOtherProfile(IHttpContextAccessor httpContextAccessor)
{
_httpContextAccessor = httpContextAccessor;
CreateMap<MyDto, MyOther>()
.ConstructUsing(myDto => new myOther(myDto.prop1, myDto .prop2, _httpContextAccessor.HttpContext.User.Identity.Name)); // the name is what i intend to pass
// other mapping
}
Run Code Online (Sandbox Code Playgroud)
Controller.cs
public async Task<IActionResult> Create([FromBody]MyDto model)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
// save campaign
var myOtherModel = _mapper.Map<MyOther>(model);
// myOtherModel.UserName …Run Code Online (Sandbox Code Playgroud) 我有一个函数说myMainFunction是从客户端调用,然后调用mypromisified函数.
场景:
mypromisified函数可以间歇性地失败,我需要延迟调用此函数(以指数增长)直到成功或直到达到最大尝试次数.
到目前为止我有什么
以下代码说明了我的场景,并重复直到成功,但它会无限期地尝试,直到达到某些计数
// called once from the client
myMainFuntion();
function rejectDelay(delay, reason) {
// call main function at a delayed interval until success
// but would want to call this only a limited no of times
setTimeout(() => {
myMainFuntion(); // calling main function again here but with a delay
}, delay);
}
function myMainFuntion() {
var delay = 100;
var tries = 3;
tryAsync().catch(rejectDelay.bind(null, delay));
}
function tryAsync() {
return …Run Code Online (Sandbox Code Playgroud)我试图通过遵循本文来为odata服务实现客户端
我有的挑战:
按照文章中的步骤,我发现
1)(ProductClient).odata.config不是自动生成的-尽管我们可以创建一个
2)需要凭据才能访问端点的客户端(在我的情况下,这是基本身份验证)
3)最重要-找不到有关stackoverflow的相关文章:)
在下面为我这样的新手发布了解决方案!
asp.net-core ×2
azure ×2
asp.net ×1
c# ×1
c#-4.0 ×1
es6-promise ×1
gitlab ×1
gitlab-ci ×1
javascript ×1
json ×1
odata ×1