如何解决在Jenkins docker容器中执行shell脚本时虚拟环境未打开
为了运行我的 python 测试,我在 Jenkins 中创建了一个自由式项目并编写了一个这样的脚本:
. .env/bin/activate
pip install pytest
pytest --alluredir='FINAL/ws/allure-results' ./FINAL/autotests
解决方法
您可以尝试在脚本步骤的第一行添加<html>
<body>
<canvas id="chart" style="width:400%;max-width:400px"></canvas>
<script type="text/javascript"
src="https://cdn.jsdelivr.net/npm/chart.js@3.3.2/dist/chart.min.js">
</script>
<script >
const xlabels= [];
chartit();
async function chartit(){
await getData();
const ctx = document.getElementById('chart').getContext('2d');
const xlabels = [];
const myChart = new Chart(ctx,{
type: 'bar',data: {
labels: xlabels,datasets: [{
label: "Covid-19",fill: true,lineTension: 0.1,backgroundColor: "rgba(204,16,52,0.5)",borderColor: "#CC1034",data: xlabels
}]
},});
};
async function getData(){
const response =await fetch('https://disease.sh/v3/covid-19/historical/Lebanon?
lastdays=30');
const data = await response.json();
const {timeline} = data;
xlabels.push(timeline.cases);
console.log(timeline.cases);
};
</script>
</body>
</html>
,然后尝试执行。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。