在工作中,我们现在使用 GitHub 以及 GitHub 流程。我对GitHub流程的理解是有master分支和feature分支。与 git flow 不同,它没有开发分支。
这对于我们已经完成的项目非常有效,并且简化了事情。
但是对于我们的产品来说,我们有一个开发和生产环境。对于生产环境,我们使用master分支,而对于开发环境,我们不知道该怎么做?
我能想到的唯一想法是:
目前,对于需要开发环境的项目,我们基本上使用 git flow(功能 -> 开发 -> 主控)。
您认为我的想法合理吗?如果不合理,您有何建议?
编辑:
只是为了澄清一下,我问的是使用GitHub Flow而不是git flow实现开发的最佳方法。
github branching-and-merging git-flow github-actions github-flow
我在 GitHub Actions 中遇到了最奇怪的错误,我已经尝试解决这个错误好几个小时了,但我完全没有想法。
我目前使用一个非常简单的 GitHub Action。最终目标是在其他工作流程中通过 ssh 运行特定的 bash 命令。
Dockerfile:
FROM ubuntu:latest
COPY entrypoint.sh /entrypoint.sh
RUN apt update && apt install openssh-client -y
RUN chmod +x entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
Run Code Online (Sandbox Code Playgroud)
入口点.sh:
FROM ubuntu:latest
COPY entrypoint.sh /entrypoint.sh
RUN apt update && apt install openssh-client -y
RUN chmod +x entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
Run Code Online (Sandbox Code Playgroud)
动作.yml
name: "SSH Runner"
description: "Runs bash commands in remote server via SSH"
inputs:
ssh_key:
description: 'SSH Key'
known_hosts:
description: 'Known Hosts'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- …Run Code Online (Sandbox Code Playgroud) ssh continuous-integration continuous-deployment docker github-actions
我正在尝试下载 github 中特定工作流程的日志。我已经参考了以下链接。但是我收到 302 作为响应代码。不确定这里的问题是什么。它没有按预期下载日志
curl -v -u username:$token -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/ORGANIZATION/REPOSITORY/actions/runs/319282523477/logs
.
.
< HTTP/1.1 302 Found
< Date: Wed, 21 Oct 2020 07:47:13 GMT
< Content-Type: text/html;charset=utf-8
.
Run Code Online (Sandbox Code Playgroud) 我有两个工作流程:CI(用于持续集成)和 CD(用于持续交付)。两者单独工作都很好。我的目标是仅在以下情况下运行 CD 工作流程:
为了实现我的目标,我正在使用workflow_run事件。这些是我的工作流程文件的片段:
ci.yml:
name: CI
on:
push:
tags: v[1-9]+.[0-9]+.[0-9]+
pull_request:
branches: [develop, hotfix*]
Run Code Online (Sandbox Code Playgroud)
cd.yml
name: CD
on:
workflow_run:
workflows: [CI]
branches: [master]
types:
- completed
Run Code Online (Sandbox Code Playgroud)
当前的行为是:在主分支中创建标签时,仅运行 CI 工作流程。我试过tags: v[1-9]+.[0-9]+.[0-9]+放入workflow_run行为是相同的。
我的问题是:我怎样才能实现我的目标?是否可以?
continuous-integration github continuous-delivery github-actions
在我的一个存储库(存储库 A)中,有一个脚本可以获取另一个存储库(存储库 B,不是我的存储库)上的文件内容。因此,我想在每次推送存储库 B 时触发存储库 A 上的 GitHub 操作。我在 GitHub 操作触发文档 上没有看到这种情况,这可能吗?
我该如何if github.event.action in ['foo', 'bar']使用 GitHub Actions?我想限制https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#release中的一些操作,并且可能值的列表很长。
使用||会使整个构造变得庞大,特别是如果您已经需要将其与其他条件结合起来。
使用 Github Actions 进行某些 CI/CD。
目前,我遇到了奇怪的行为,尽管满足了条件,但我的工作却被跳过。deploy-api有两个条件,如果代码被推送到 master 并且test-api成功。但即使我们满足了这些条件,它仍然被跳过。
jobs:
test-api:
name: Run tests on API
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Get dependencies
run: npm install
working-directory: ./api
- name: Run tests
run: npm run test
working-directory: ./api
deploy-api:
needs: test-api # other job must finish
if: github.ref == 'refs/heads/master' && needs.test-api.status == 'success' #only run if it's a commit to master AND previous success
Run Code Online (Sandbox Code Playgroud)
如图所示,尽管推送在主分支上(如顶部所示)并且前一个作业成功,但第二个作业被跳过。
我在代码中遗漏了什么吗?有谁知道可以使用的解决方法?
如果 UI 告诉用户为什么它被跳过,那就太好了!
我正在尝试调用可重用的工作流程。
https://github.com/dhis2-sre/gha-workflows/blob/master/.github/workflows/instance-manager.yaml
调用者如下所示
name: Tests, build and deploy
on:
push:
branches:
- master
- feature/**
tags:
- v*.*.*
pull_request:
workflow_dispatch:
jobs:
call-workflow:
uses: dhis2-sre/gha-workflows/.github/workflows/instance-manager.yaml@v0.2.0
with:
DOCKER_IMAGE_NAME: dhis2/instance-manager-api
PROCESS_NAME: dhis2-instance-manager
DOCKER_USERNAME: "${{ secrets.DOCKER_USERNAME }}"
DOCKER_PASSWORD: "${{ secrets.DOCKER_PASSWORD }}"
SOPS_KMS_ARN: "${{ secrets.SOPS_KMS_ARN }}"
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
KUBECONFIG: "${{ secrets.KUBECONFIG }}"
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
Invalid workflow file
The workflow is not valid. .github/workflows/cicd.yaml (Line: 21, Col: 24): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DOCKER_USERNAME .github/workflows/cicd.yaml (Line: 22, …Run Code Online (Sandbox Code Playgroud) 字符“|”的含义是什么 在 github 操作的 yml 文件中的“run:”之后?\ni需要理解这一点。谢谢\n这里是代码段:
\n名称: npm install\n运行: |\nnpm install\nenv:\nCI: true
\n# \xe8\xbf\x90\xe8\xa1\x8c\xe8\x84\x9a\xe6\x9c\xac\n- name: \xe8\xbf\x90\xe8\xa1\x8c\xe8\x84\x9a\xe6\x9c\xac\n run: |\n COOKIE='${{ secrets.COOKIE }}' DINGTALK_WEBHOOK='${{ secrets.DINGTALK_WEBHOOK }}' DINGTALK_SECRET='${{ secrets.DINGTALK_SECRET }}' ALL_IN='${{ secrets.ALL_IN }}' WX_COMPANY_ID='${{ secrets.WX_COMPANY_ID }}' WX_APP_ID='${{ secrets.WX_APP_ID }}' WX_APP_SECRET='${{ secrets.WX_APP_SECRET }}' FEISHU_WEBHOOK='${{ secrets.FEISHU_WEBHOOK }}' FEISHU_SECRET='${{ secrets.FEISHU_SECRET }}' npm start\n env:\n CI: true\nRun Code Online (Sandbox Code Playgroud)\n我正在使用 github actions 实现 android 的应用程序分发,一切似乎都很好,但我收到错误:
* What went wrong:
Execution failed for task ':app:appDistributionUploadQaRelease'.
> Missing app id. Please check that it was passed in and try again
Run Code Online (Sandbox Code Playgroud)
我正在使用 google play 插件,因此它应该自动获取应用程序 ID。
appId -- 您应用的 Firebase 应用 ID。仅当您未安装 Google Services Gradle 插件时才需要。
google-services.json我的应用程序模块中有文件,
在root build.gradle:
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-appdistribution-gradle:3.0.0'
Run Code Online (Sandbox Code Playgroud)
在app的build.gradle:
plugins {
....
id 'com.google.gms.google-services'
id 'com.google.firebase.appdistribution'
}
Run Code Online (Sandbox Code Playgroud)
味道qa:
productFlavors {
....
qa {
applicationId "custom.package.for.qa"
....
firebaseAppDistribution …Run Code Online (Sandbox Code Playgroud) android gradle firebase github-actions firebase-app-distribution
github-actions ×10
github ×5
android ×1
docker ×1
firebase ×1
git-flow ×1
github-api ×1
github-flow ×1
gradle ×1
ssh ×1
yaml ×1