我在 docker 上使用这个:
- name: Build container image
uses: actions/docker/cli@master
with:
///// removed
- name: Docker Login
uses: actions/docker/login@master
env:
///// removed
Run Code Online (Sandbox Code Playgroud)
然而 github.com/actions/docker 似乎不再存在。
我的构建给出了 404:
无法下载操作“ https://api.github.com/repos/actions/docker/tarball/master ”。错误响应状态代码不表示成功:404(未找到)。
有谁知道新地点吗?
这是我的 Dockerfile
FROM node:10
RUN apt-get -qq update && apt-get -qq -y install bzip2
RUN yarn global add @bluebase/cli && bluebase plugins:add @bluebase/cli-expo && bluebase plugins:add @bluebase/cli-web
RUN bluebase plugins
Run Code Online (Sandbox Code Playgroud)
构建 docker 文件后,它会安装所有依赖项,最后一个命令会RUN bluebase plugins输出已安装的插件列表。但是当这个图像被推送并在 github 操作bluebase中使用时,全局可用但没有安装插件。我究竟做错了什么?
Github 工作流程
name: Development CI
on:
push:
# Sequence of patterns matched against refs/heads
branches:
- '*' # Push events on all branchs
- '*/*'
- '!master' # Exclude master
- '!next' # Exclude next
- '!alpha' # Exclude …Run Code Online (Sandbox Code Playgroud) continuous-integration continuous-deployment docker dockerfile github-actions
以下是我的操作文件。
name: ZAP
on: push
jobs:
build:
runs-on: ubuntu-latest
container:
image: owasp/zap2docker-stable
options: --user root
volumes:
- /__w/actions-test-repo/actions-test-repo:/zap/wrk/
steps:
- uses: actions/checkout@v1
- name: view file
run: pwd
- name: run zap
if: always()
run: zap-baseline.py -t https://www.example.com -g gen.conf -r testreport.html
- name: view file
if: always()
run: pwd
Run Code Online (Sandbox Code Playgroud)
我想将目录 /zap/wrk/ 绑定到本地目录。但是当容器启动时,它不会挂载这个卷。我得到了当前的工作目录并将其挂载到 docker 容器。这是正确的方法吗?
结果链接:https : //github.com/sshniro/actions-test-repo/commit/08c0257d92b772a1d33c0b68cb8af99afdef9130/checks?check_suite_id=324032091
嗯,是的,这是一回事。在尝试直接运行 PS 脚本并失败后,让我们尝试从节点脚本运行它的迂回方式,这在 GitHub 操作环境中是合法的。所以经过多次尝试,这是我的最后一个(取自这个答案:
var spawn = require("child_process").spawn,child;
var workspace = process.env.GITHUB_WORKSPACE;
var file = workspace + "\\upgrade.ps1";
console.log( "Workspace ", workspace, " file ", file );
child = spawn("powershell.exe",[ file ]); // more stuff to print output after this
Run Code Online (Sandbox Code Playgroud)
这失败了:
Workspace d:\a\rakudo-star-fix-action\rakudo-star-fix-action file d:\a\rakudo-star-fix-action\rakudo-star-fix-action\upgrade.ps1
Powershell Errors: d:\a\rakudo-star-fix-action\rakudo-star-fix-action\upgrade.ps1 : The term
Powershell Errors: 'd:\a\rakudo-star-fix-action\rakudo-star-fix-action\upgrade.ps1' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of …Run Code Online (Sandbox Code Playgroud) 我有一个带有 EF Core 3.0 的 Asp Net Core 项目的 GitHub 存储库。我添加了以下工作流程以在每次更新develop分支时运行
name: Develop Build
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.102-servicing-014397
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Test with dotnet
run: dotnet test --configuration Release
- name: Update database
run: dotnet ef database update --c DataContext --p MyProj --s MyProjFactory
Run Code Online (Sandbox Code Playgroud)
最后一行返回错误:
Could …Run Code Online (Sandbox Code Playgroud) package.json
{
"scripts": {
"test": "jest"
}
}
Run Code Online (Sandbox Code Playgroud)
{
"scripts": {
"test": "jest"
}
}
Run Code Online (Sandbox Code Playgroud)
当我在 GitHub 中合并提交时,我想创建一个GitHub 操作来运行我的测试。该节点启动工作流运行测试与NPM。但我想用 Yarn 运行它们。
如何创建操作来运行我的测试?
I would like to declare some environment variables in a top level env section in my main.yml whose values use some pre-defined environment variables such as those documented in the GitHub Actions documentation. However, it appears I cannot use those pre-defined variables in the right hand side of my env section. For example:
env:
resourceGroup: ${GITHUB_RUN_ID}${GITHUB_RUN_NUMBER}
Run Code Online (Sandbox Code Playgroud)
Is there a way to make it so any step that needs ${resourceGroup} can get it without having to manually define it within …
因此,我创建了一个 GitHub 操作,该操作应该在发生推送时构建 docker 映像并将其推送到 docker hub。所以这是我的 GitHub 操作:(第一次创建 GitHub 操作)
name: Some name
on:
push:
jobs:
build_frontend:
runs-on: ubuntu-latest
steps:
- name: Build frontend image
run: docker image build -t image .
- name: Push frontend image
uses: elgohr/Publish-Docker-Github-Action@2.14
with:
name: image
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
Run Code Online (Sandbox Code Playgroud)
但是每次运行时我都会收到此错误:
无法准备上下文:无法评估 Dockerfile 路径中的符号链接:lstat /home/runner/work/project/project/Dockerfile:没有此类文件或目录 [错误] 进程已完成,退出代码为 1。
我试着摆弄路径,但后来我只得到了没有这样的文件或目录。所以这是我最接近工作的东西。
谢谢你的帮助
正如这里所讨论的,在 GitHub Actions 中有一种使用关键字引用job其他jobs 中的 s的好方法need,例如
name: Share data between jobs
on: [push]
jobs:
job_1:
name: Add 3 and 7
runs-on: ubuntu-latest
steps:
# Steps
job_2:
name: Multiply by 9
needs: job_1
# The rest of the job
Run Code Online (Sandbox Code Playgroud)
我在文档中找不到答案的问题是:有没有办法job在其他工作流中引用/共享s?(即单独的yml文件)。
我的项目由几个单独的工作流组成,每个工作流都需要执行相同的初始steps。我试图避免在不同的workflows 中复制粘贴相同的步骤。
continuous-integration github continuous-deployment devops github-actions
我已经设置了一个 Github Action 来运行我的 Rails 应用程序的测试,但我一直收到这个错误:
Run bundle exec rails db:prepare
rails aborted!
PG::ConnectionBad: fe_sendauth: no password supplied
Run Code Online (Sandbox Code Playgroud)
这是工作流 yml 文件:
name: CI
on: [push]
jobs:
test:
runs-on: ubuntu-latest
services:
db:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_DB: bb_test
POSTGRES_PASSWORD: postgres
ports: ['5432:5432']
redis:
image: redis
ports: ['6379:6379']
options: --entrypoint redis-server
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install missing libs
run: sudo apt-get -yqq install libpq-dev
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install …Run Code Online (Sandbox Code Playgroud) github-actions ×10
github ×5
docker ×3
node.js ×2
asp.net-core ×1
devops ×1
dockerfile ×1
ef-core-3.0 ×1
jestjs ×1
powershell ×1
yarnpkg ×1