Okteto github action

Hi,
I followed the guide

but I got his error on the build step

Run okteto/actions/build@v3.1
/usr/bin/docker run --name d558139da6372d19a4a5c8e6b14c5ea1516b7_fc283a --label 8d5581 --workdir /github/workspace --rm -e “IMAGE_TAG” -e “IMAGE_NAME” -e “INPUT_TOKEN” -e “INPUT_TAG” -e “INPUT_FILE” -e “INPUT_PATH” -e “INPUT_BUILDARGS” -e “HOME” -e “GITHUB_JOB” -e “GITHUB_REF” -e “GITHUB_SHA” -e “GITHUB_REPOSITORY” -e “GITHUB_REPOSITORY_OWNER” -e “GITHUB_RUN_ID” -e “GITHUB_RUN_NUMBER” -e “GITHUB_RETENTION_DAYS” -e “GITHUB_RUN_ATTEMPT” -e “GITHUB_ACTOR” -e “GITHUB_TRIGGERING_ACTOR” -e “GITHUB_WORKFLOW” -e “GITHUB_HEAD_REF” -e “GITHUB_BASE_REF” -e “GITHUB_EVENT_NAME” -e “GITHUB_SERVER_URL” -e “GITHUB_API_URL” -e “GITHUB_GRAPHQL_URL” -e “GITHUB_REF_NAME” -e “GITHUB_REF_PROTECTED” -e “GITHUB_REF_TYPE” -e “GITHUB_WORKSPACE” -e “GITHUB_ACTION” -e “GITHUB_EVENT_PATH” -e “GITHUB_ACTION_REPOSITORY” -e “GITHUB_ACTION_REF” -e “GITHUB_PATH” -e “GITHUB_ENV” -e “GITHUB_STEP_SUMMARY” -e “GITHUB_STATE” -e “GITHUB_OUTPUT” -e “RUNNER_OS” -e “RUNNER_ARCH” -e “RUNNER_NAME” -e “RUNNER_TOOL_CACHE” -e “RUNNER_TEMP” -e “RUNNER_WORKSPACE” -e “ACTIONS_RUNTIME_URL” -e “ACTIONS_RUNTIME_TOKEN” -e “ACTIONS_CACHE_URL” -e GITHUB_ACTIONS=true -e CI=true -v “/var/run/docker.sock”:“/var/run/docker.sock” -v “/home/runner/work/_temp/_github_home”:“/github/home” -v “/home/runner/work/_temp/_github_workflow”:“/github/workflow” -v “/home/runner/work/_temp/_runner_file_commands”:“/github/file_commands” -v “/home/runner/work/curto/curto”:“/github/workspace” 8d5581:39da6372d19a4a5c8e6b14c5ea1516b7 “" "/curto:478db246abdb49ee4f2d61e290ec56980fa8da87” “Dockerfile” “.” “”
✓ Logged in as ***
Run okteto namespace to switch your context and download your Kubernetes credentials.
-t ***/curto:478db246abdb49ee4f2d61e290ec56980fa8da87 -f Dockerfile .
i Running your build in Okteto Cloud…
x failed to create temporary build folder: open Dockerfile: no such file or directory

the Dockerfile is in the root of the repository. Any help?

Thanks,
Mario.

1 Like

Can you share the file with the github action definition?

PS welcome to our community @mfvitale !

Thank you.

Sure this is the definition

name: CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:

  • name: Login
    uses: actions-hub/docker/login@master
    env:
    DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
    DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
  • name: Build
    uses: okteto/actions/build@v3.1
    with:
    token: ${{ secrets.OKTETO_TOKEN }}
    tag: ${{ secrets.DOCKER_USERNAME }}/curto:${{ github.sha }}
  • name: Get Kubeconfig
    uses: okteto/actions/namespace@v3.1
    id: url-shortner-mfvitale
    with:
    token: ${{ secrets.OKTETO_TOKEN }}
    namespace: url-shortner-mfvitale
  • name: Deploy and Wait
    uses: okteto/actions/deploy@v3.1
    env:
    KUBECONFIG: ${{ steps.namespace.outputs.kubeconfig }}
    with:
    namespace: url-shortner-mfvitale
    manifest: deploy/k8s.yml
    tag: ${{ secrets.DOCKER_USERNAME }}/curto:${{ github.sha }}
    waitOn: deployment/curto
  • name: Verify
    uses: srt32/uptime@master
    with:
    url-to-hit: “https://curto-mfvitale.cloud.okteto.net
    expected-statuses: “200”

Ah, your action is missing the checkout command to get your source code. Try adding the following as the first step:

- name: checkout
   uses: actions/checkout@master

BTW, if your repository has a okteto.yml file, or a docker-compose.yaml, you check out the deploy pipeline action, it’ll automatically do most of the steps that you have in your file.

This doc has an end to end example, in case it helps.

Worked! Thank you so much.

@ramiro Is there a way to use secrets (with kustomize) and the deploy action I used?

Which is the best way?

Thanks,
Mario

Would you mind posting a separate question for that topic?