如何解决继承Gitlab预定义变量
我有一个如下的Gitlab CI。我的目的:当构建阶段失败时,将触发通知阶段并将电子邮件发送给收件人
build website:
stage: build
script: ...
send email:
stage: notify
when: on_failure
script: #send email to recipients
但是在我的内容电子邮件中,我想使用一些预定义的变量来引用失败作业。示例:“阶段$ CI_JOB_STAGE管道中的作业$ CI_JOB_NAME失败”。如何从阶段通知将变量引用到阶段构建。兄弟,请帮助我。谢谢。
解决方法
在GitLab中,工作是独立的。如果要在作业之间共享某些上下文,可以使用工件
from itertools import islice
with open('model000.msh') as lines:
nodes = np.genfromtxt(islice(lines,1000))
with open('model000.msh',"r") as f:
saved_lines = np.array([line.split() for line in f if len(line.split()) == 9])
saved_lines[saved_lines == ''] = 0.0
elem = saved_lines.astype(np.int)
# following lines extract some data from my file
extracted=np.c_[elem[:,:-4],nodes[elem[:,-4]-1,1:],-3]-1,-2]-1,-1]-1,1:]]
…
extracted =np.concatenate((extracted,avs),axis =1) # each input file ('model000.msh') will make this numpy array
# another data set,stored as a numpy array is compared to the data extracted from the file
ID= np.array [[… ...,…,…]] # now,it is has one column,but it should have several columns and each iteration,one column will make a my_data array
my_data=np.concatenate((ID,gr),axis =1) # I think it should be something like my_data=np.concatenate((ID[:,iterator],axis =1)
from scipy.spatial import distance
distances=distance.cdist(extracted [:,17:20],my_data[:,1:4])
ind_min_dis=np.argmin(distances,axis=1).reshape(-1,1)
z=np.array([])
for i in ind_min_dis:
u=my_data[i,0]
z=np.array([np.append(z,u)]).reshape(-1,1)
final_merged=np.concatenate((extracted,z),axis =1)
new_vol=final_merged[:,-1].reshape(-1,1)
new_elements=np.concatenate((elements,new_vol),axis =1)
new_elements[:,[4,-1]] = new_elements[:,[-1,4]]
# The next block is output block
chunk_size = 3
buffer = ""
i = 0
relavent_line = 0
with open('changed_00','a') as fout:
with open('model000.msh','r') as fin:
for line in fin:
if len(line.split()) == 9:
aux_string = ' '.join([str(num) for num in new_elements[relavent_line]])
buffer += '%s\n' % aux_string
relavent_line += 1
else:
buffer += line
i+=1
if i == chunk_size:
fout.write(buffer)
i=0
buffer = ""
if buffer:
fout.write(buffer)
i=0
buffer = ""
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。