我从 GitHub 工作流程调用了 Terraform,其中的步骤之一是 RDS 更新。状态的后端是 S3 存储桶。Terraform 正确反映了更新的状态(请参阅下面的日志),但根本没有反映对 RDS 数据库实例的更改。
以下是 terraform apply 操作的输出 -
我还注意到状态文件没有更新回 S3。有趣的是,如果我更改实例的名称(强制销毁并重新创建),terraform 就会按预期工作。
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# aws_db_instance.app_db will be updated in-place
~ resource "aws_db_instance" "app_db" {
id = "app-tf-rds"
~ instance_class = "db.t3.medium" -> "db.t3.small"
name = "myappdb"
# (57 unchanged attributes hidden)
}
Plan: 0 to add, …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 GitHub Pages 网站中使用的 JS 文件中使用 GitHub Secrets,我试图用它来隐藏 API 密钥,但是,我已经做了很多研究,但我无法找到或理解任何可以帮助我的东西...不要评判我,我是 GitHub 的新手!无论如何,这是我正在使用的代码:
document.getElementById("submit").addEventListener("click", function() {
...
if (...) {
var request = new XMLHttpRequest();
request.open("GET", `https://script.google.com/macros/s/${process.env.API_KEY}/exec?...`, false);
...
}
});
Run Code Online (Sandbox Code Playgroud)
有没有办法可以做到这一点?谢谢!
在通过 Workload Identity Federation 从 Github 操作设置身份验证时,我们是否需要将workload_identity_provider和保密?service_account
我的 Next.js React 应用程序测试在本地通过,但在 Github Actions 中失败。
有next.config.js这个导出来了解svg导入:
module.exports = {
webpack(config) {
config.module.rules.push({
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: ['@svgr/webpack'],
});
return config;
},
};
Run Code Online (Sandbox Code Playgroud)
然后我得到了一些 SVG 图标,并将它们导入到应用程序中,如下所示:
import StatusMessageErrorIcon from '../../../public/icons/Status-message-error.svg';
<StatusMessageErrorIcon fill="red" width="18" height="18" />
Run Code Online (Sandbox Code Playgroud)
一切正常,图标显示。
然后我进行了一个测试,用该图标呈现页面,render(<Create />);
测试在本地运行,一切通过。
但在 Github Action 中运行测试失败,并显示:
Test suite failed to run
src/MyForm.tsx:11:36 - error TS2307: Cannot find module '../../../public/icons/Status-message-error.svg' or its corresponding type declarations.
11 import StatusMessageErrorIcon from '../../../public/icons/Status-message-error.svg';
Run Code Online (Sandbox Code Playgroud)
Github Action 非常基本:
steps:
- uses: actions/checkout@v3 …Run Code Online (Sandbox Code Playgroud) 我创建了一个 docusaurus 项目。一切正常。我在登陆页面添加了材质 ui 搜索栏。我正在使用 github actions 来部署项目(CI/CD)。现在,当我推送代码时,我收到此错误。
[ERROR] TypeError: dep.getModuleEvaluationSideEffectsState is not a function
at NormalModule.getSideEffectsConnectionState (/github/workspace/website/node_modules/webpack/lib/NormalModule.js:1126:23)
at /github/workspace/website/node_modules/webpack/lib/optimize/SideEffectsFlagPlugin.js:244:19
at Hook.eval [as call] (eval at create (/github/workspace/website/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:12:16)
at Hook.CALL_DELEGATE [as _call] (/github/workspace/website/node_modules/tapable/lib/Hook.js:14:14)
at Compilation.seal (/github/workspace/website/node_modules/webpack/lib/Compilation.js:2804:42)
at /github/workspace/website/node_modules/webpack/lib/Compiler.js:1187:20
at /github/workspace/website/node_modules/webpack/lib/Compilation.js:2757:4
at _next2 (eval at create (/github/workspace/website/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:35:1)
at eval (eval at create (/github/workspace/website/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:71:1)
at /github/workspace/website/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:385:11
Run Code Online (Sandbox Code Playgroud)
我不知道如何解决这个问题。我还附加了 package.json 文件。
[ERROR] TypeError: dep.getModuleEvaluationSideEffectsState is not a function
at NormalModule.getSideEffectsConnectionState (/github/workspace/website/node_modules/webpack/lib/NormalModule.js:1126:23)
at /github/workspace/website/node_modules/webpack/lib/optimize/SideEffectsFlagPlugin.js:244:19
at Hook.eval [as call] (eval at create (/github/workspace/website/node_modules/tapable/lib/HookCodeFactory.js:19:10), …Run Code Online (Sandbox Code Playgroud)我有一个 GitHub Action 工作流程,其中我需要访问 Azure Key Vault 机密并使用它们。Azure Key Vault Action ( https://learn.microsoft.com/en-us/azure/developer/github/github-key-vault ) 允许您访问机密,然后在下一步中使用,部分代码如下,
- uses: Azure/get-keyvault-secrets@v1
with:
keyvault: "containervault"
secrets: 'containerPassword, containerUsername'
id: myGetSecretAction
- uses: azure/docker-login@v1
with:
login-server: myregistry.azurecr.io
username: ${{ steps.myGetSecretAction.outputs.containerUsername }}
password: ${{ steps.myGetSecretAction.outputs.containerPassword }}
Run Code Online (Sandbox Code Playgroud)
完整的 YML 可以在上面的链接中看到。
但是,此操作似乎已被弃用,取而代之的是 Azure CLI 操作 ( https://github.com/Azure/cli )。我可以使用该操作来访问密钥保管库,如下所示,
- name: Azure CLI script
uses: azure/CLI@v1
with:
inlineScript: |
az keyvault secret show --vault-name MyVaultName --name MySecret --query value
Run Code Online (Sandbox Code Playgroud)
但是,我不确定如何将上述返回的值传递到工作流程中的下一步。这里的任何帮助都会有所帮助。
预先感谢苏希尔
我目前正在为 GitHub 项目做出贡献。
\n为此,我在 GitHub Action 中编写了一个 GitHub 工作流程,用于测试 JavaDoc 文件的创建。
\n此工作流程应使用act运行。
\n当我想添加此 GitHub 工作流时 GitHub Action 的项目:https://github.com/MathieuSoysal/Javadoc-publisher.yml
问题是,当我使用 act 执行 GitHub 工作流程时,出现此错误。
\n[Test Actions/Test with Java 11] Start image=catthehacker/ubuntu:act-latest\n[Test Actions/Test with Java 11] docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=false\n[Test Actions/Test with Java 11] docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]\n[Test Actions/Test with Java 11] docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]\n[Test Actions/Test with Java 11] \xe2\x98\x81 git clone …Run Code Online (Sandbox Code Playgroud) 我按照这些资源设置了 GitHub Actions 工作流程来构建、测试 dotnet 库并将其发布到 GitHub 包:
这些文章确实很有帮助,但是我遇到了一个他们都没有讨论的问题:
将 MagicLibrary.0.1.3.nupkg 推送到“https://nuget.pkg.github.com/vivere-dally”... PUT https://nuget.pkg.github.com/vivere-dally/ warn :您的请求无法通过 GitHub Packages 服务进行身份验证。请确保您的访问令牌有效并且配置了适当的范围。禁止https://nuget.pkg.github.com/vivere-dally/ 218ms 错误:响应状态代码不表示成功:403(禁止)。
这是我的工作流程文件:
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Verify commit exists in origin/main
run: |
git fetch --no-tags --prune --depth=1 …Run Code Online (Sandbox Code Playgroud) 我试图在作业之间传递 JWT 令牌,但有些东西阻止它正确传递。根据文档,如果我想在作业之间传递变量,我需要outputs按照此处的说明使用。我正在做的事情如下:
name: CI
on:
pull_request:
branches:
- main
jobs:
get-service-url:
...does something not interesting to us...
get-auth-token:
runs-on: ubuntu-latest
outputs:
API_TOKEN: ${{ steps.getauthtoken.outputs.API_TOKEN }}
steps:
- name: Get Token
id: getauthtoken
run: |
API_TOKEN:<there is a full JWT token here>
echo -n "API_TOKEN=$API_TOKEN" >> $GITHUB_OUTPUT
use-token:
runs-on: ubuntu-latest
needs: [get-service-url,get-auth-token]
name: Run Tests
steps:
- uses: actions/checkout@v3
- name: Run tests
run: |
newman run ${{ github.workspace }}/tests/collections/my_collection.json --env-var "service_url=${{needs.get-service-url.outputs.service_URL}}" --env-var "auth_token=${{needs.get-auth-token.outputs.API_TOKEN}}"
Run Code Online (Sandbox Code Playgroud)
因此,在运行期间,在我的输出中我看到:
Run …Run Code Online (Sandbox Code Playgroud) 我有以下 github 工作流程:
name: TS Service Build
permissions:
packages: write
on:
workflow_dispatch:
inputs:
...
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Docker Login
run: |
export CR_PAT=${{ secrets.DOCKER_TOKEN }}
echo $CR_PAT | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build & Push
run: |
docker build -t ghcr.io/vli20/${{ inputs.name }}:${{ inputs.image_tag }} . --build-arg path=${{ inputs.path }} --build-arg module=${{ inputs.module }}
docker push ghcr.io/vli20/${{ inputs.name }}:${{ inputs.image_tag }} …Run Code Online (Sandbox Code Playgroud) continuous-integration github docker github-actions github-packages
github-actions ×10
github ×7
javascript ×2
reactjs ×2
bash ×1
c# ×1
docker ×1
docusaurus ×1
github-pages ×1
google-iam ×1
java ×1
jwt ×1
next.js ×1
nuget ×1
terraform ×1