We have GitHubActions and we run it in an Centos Server. We have set the root's .bashrc as export GOROOT=/opt/go export PATH=$PATH:$GOROOT/bin
In the Github Actions we have the file:
setup:
needs: cleanup
name: Setup
runs-on: [self-hosted, Linux, X64, CentOS-Linux-7.9]
services:
postgres:
image: postgres:latest
- name: Set up Go 1.17
uses: actions/setup-go#v2
with:
go-version: 1.17
# id: Go
- run: go version
- name: Checkout code into go module directory
uses: actions/checkout#v2
When Github Actions runs this , it throws the error:
0s
Run actions/setup-go#v2
with:
go-version: 1.17
stable: true
token: ***
...
Setup go stable version spec 1.17
Found in cache # /opt/actions-runner/_work/_tool/go/1.17.11/x64
Added go to the path
missing $GOPATH
Error: Command failed: go env GOPATH
missing $GOPATH
Can someone please help with this error?
The Go installation is working and on the Linux box as root 'go version' works.
That looks like actions/setup-go issue 116 which includes:
I believe the reason of issue is missing $HOME variable on the self-hosted runners.
The missing HOME variable makes it so that Go is not able to make default folders for GOPATH and GOCACHE and such.
So double-check what echo $HOME displays in your runner.
The OP AwsGeek confirms in the comments:
First as suggested I did an echo $HOME and it was empty and under the env: I added the value for home env: HOME: "/home/xxxx-account"
Related
When I run skaffold in a github workflow like this
skaffold build
it calls the gradle jib correctly, creates an image and pushes it to the ghcr successfully. Grdale finishes successfully as can be seen in the log. Nevertheless, something happens afterwards that fails. It seems someone tries to access the just built image but is not authorized. This does not happen, if I execute it locally. And it does not fail in the github workflow if I call gradlew jib directly without skaffold being involved.
Built and pushed image as ghcr.io/tobias-neubert/motd-service:453f4c4-dirty
BUILD SUCCESSFUL in 11s
4 actionable tasks: 4 executed
time="2023-02-15T12:07:09Z" level=error msg="No matching credentials were found for \"ghcr.io\""
time="2023-02-15T12:07:09Z" level=error msg="No matching credentials were found for \"ghcr.io\""
getting image: GET https://ghcr.io/token?scope=repository%3Atobias-neubert%2Fmotd-service%3Apull&service=ghcr.io: UNAUTHORIZED: authentication required
Error: Process completed with exit code 1.
The github workflow:
name: Build and push motd-service
on:
push:
permissions:
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout#v3
- name: Set up Java
uses: actions/setup-java#v2
with:
java-version: 17
distribution: temurin
- name: Setup Gradle
uses: gradle/gradle-build-action#v2
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Install skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && \
sudo install skaffold /usr/local/bin/
- name: Deactivate collecting skaffold metrics
run: skaffold config set --global collect-metrics false
- name: Build the motd image
env:
GH_PASSWORD: '${{ secrets.GITHUB_TOKEN }}'
run: skaffold build
Does anybody know what happens here?
It tries to fetch the digest of the new image, which it needs to render the k8s resources. Pushing the image was made by gradle. The jib plugin is configured to use environment variables for authenticating against ghcr.io. But skaffold does not know about those. So it fails to authenticate. A docker login does the trick, although it is not safe in a CI. So now I have to search for a better way to tell skaffold to authenticate against the registry
for testing purposes, is it possible to run GUI applications on GitHub-hosted runners?
I tried to run Windows Calculator (Microsoft.WindowsCalculator_8wekyb3d8bbwe!App) on "windows-2022" via WinAppDriver and it fails with "WebDriverException: Package was not found".
Any suggestion(s)?
TIA,
Adrian.
P.S. here is my GitHub Actions workflow for the above:
# ISSUE fails with WebDriverException: Package was not found
# see https://github.com/QA-Automation-Starter/qa-automation/actions/runs/3234841483/jobs/5298454871
build-and-test-on-windows:
name: windows build&test
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: windows-2022
environment: development
steps:
- uses: actions/checkout#v2
- uses: actions/setup-java#v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
settings-path: ${{ github.workspace }}
# ISSUE somehow should run WinAppDriver
# see https://github.com/microsoft/WinAppDriver/issues/1722
# and https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md
# TODO maybe, should re-publish the site from here (?)
- run: |
choco install -y autologon
autologon %USERNAME% $USERDOMAIN%
start cmd /c "C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe"
cd qa-testing-example
mvn install ^
-s %GITHUB_WORKSPACE%\settings.xml ^
-Pmode-build-fast,mode-build-quiet,environment-default,testing-windows,device-windows
shell: cmd
I have enabled Github actions to create Tech docs after a commit. Below is the workflow file written to create Md files. But "techdocs-cli generate --no-docker --verbose" command fails with the below error. Can someone please help with the issue?
Failed to generate docs from /home/runner/work/myapp3/myapp3 into /home/runner/work/myapp3/myapp3/site; caused by unknown error 'Command mkdocs failed, exit code: 1'
workflow file:
name: Publish TechDocs Site
on:
push:
branches: master
jobs:
publish-techdocs-site:
runs-on: ubuntu-latest
env:
TECHDOCS_S3_BUCKET_NAME: XXX
AWS_ACCESS_KEY_ID: XXX
AWS_SECRET_ACCESS_KEY: XXX
AWS_REGION: XXX
ENTITY_NAMESPACE: 'default'
ENTITY_KIND: 'Component'
ENTITY_NAME: ‘XXX’
steps:
- name: Checkout code
uses: actions/checkout#v2
- uses: actions/setup-node#v2
- uses: actions/setup-python#v2
- name: Install techdocs-cli
run: sudo npm install -g #techdocs/cli
- name: Install mkdocs and mkdocs plugins
run: python -m pip install mkdocs-techdocs-core==1.*
- name: Generate docs site
run: techdocs-cli generate --no-docker --verbose
- name: Publish docs site
run: techdocs-cli publish --publisher-type awsS3 --storage-name $TECHDOCS_S3_BUCKET_NAME --entity $ENTITY_NAMESPACE/$ENTITY_KIND/$ENTITY_NAME
I had the same issue and it was resolved once you had the right folder structure where you have the mkdocs.yml file.
As long as you have a docs folder in the same root structure with the .md file that needs to be published.
The same .md file needs to be configured in the navigation section of the mkdocs.yml file as well
Trying to troubleshoot my terraform init step, but I'm getting Error: No such file or directory
Even if I add the pwd as step 2 shown below, still getting Error: No such file or directory. This is working in other pipelines, but none of the new pipelines are working with the same commands.
Was there an update to GHA? I know they updated Helm, but did something else change that would adjust the behavior?
update-terraform-env:
name: "Create or Update Terraform Environment"
needs: build
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.TERRAFORM_WORKING_DIR }}
steps:
- name: Checkout Source
uses: actions/checkout#v2
- name: Get directory
run: pwd
- name: Setup Terraform
uses: hashicorp/setup-terraform#v1.2.1
with:
terraform_version: 0.13.0
- name: Terraform Init
id: tf-init
run: terraform init
The env.TERRAFORM_WORKING_DIR was initialized to a path that didn't exist. (development which didn't exist, instead of develop which did).
The error of Error: No such file or directory was misleading as it seemed that the step command is failing, when it's actually the working directory for the entire job.
I'm using a GitHub action to SSH into my staging server to pull the latest from the repo (which succeeds) then install node modules: yarn (which fails), build the app: yarn build:app (which fails), then restart the app: pm2 restart all (which fails). From what I've read from researching, the commands aren't found because the SSH into the server is a non-interactive session and many things aren't added to $PATH. I have tried adding export PATH="$PATH:/home/***/.nvm/versions/node/v14.5.0/bin/pm2:/home/***/.nvm/versions/node/v14.5.0/bin/pm2" to my script to no avail. I'm still getting command not found.
name: Test Deployment
on:
push:
branches:
- staging
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy Staging
if: github.ref == 'refs/heads/staging'
uses: appleboy/ssh-action#master
with:
host: ${{ secrets.STAGING_SSH_HOST }}
username: ${{ secrets.STAGING_SSH_USERNAME }}
key: ${{ secrets.STAGING_SSH_KEY }}
passphrase: ${{ secrets.STAGING_SSH_PASSPHRASE }}
port: ${{ secrets.STAGING_SSH_PORT }}
script: |
export PATH="$PATH:/home/***/.nvm/versions/node/v14.5.0/bin/pm2:/home/***/.nvm/versions/node/v14.5.0/bin/pm2"
cd ~/***
git pull origin staging
yarn
yarn build:app
pm2 restart all
Receiving errors:
======CMD======
export PATH="$PATH:/home/***/.nvm/versions/node/v14.5.0/bin/pm2:/home/***/.nvm/versions/node/v14.5.0/bin/pm2"
cd ~/***
git pull origin staging
yarn
yarn build:app
pm2 restart all
======END======
err: From github.com:***/***
err: * branch staging -> FETCH_HEAD
err: *** staging -> origin/staging
out: Merge made by the 'recursive' strategy.
2021/04/16 21:28:17 Process exited with status 127
out: .github/workflows/main.yml | 2 +-
out: 1 file changed, 1 insertion(+), 1 deletion(-)
err: bash: line 3: yarn: command not found
err: bash: line 4: yarn: command not found
err: bash: line 5: pm2: command not found
Instead of
export path='$PATH:/home/***/.nvm/versions/node/v14.5.0/bin/pm2:/home/***/.nvm/versions/node/v14.5.0/bin/pm2'
you should try
export PATH="$PATH:/home/***/.nvm/versions/node/v14.5.0/bin/pm2:/home/***/.nvm/versions/node/v14.5.0/bin/pm2"
Notice:
PATH - uppercase
Use double quote instead of single quote to expand the previous value of PATH variable