When I try to use external version.txt to manage the image version, I am getting this :
ERROR: invalid tag “ghcr.io/cgsourav/frappe_essentials_v2/clapgrow_v2:”: invalid reference format
Error: buildx failed with: ERROR: invalid tag “ghcr.io/cgsourav/frappe_essentials_v2/clapgrow_v2:”: invalid reference format
Blockquote
So I put the VERSION in the build.env and the ci ran fine. Why is this happening and how can I solve it ?
There’s is no tag after the :
. Make sure you specify a tag to push to registry.
Share more details like steps, yaml, commands
ci.yml:
name: Build Image
permissions:
packages: write
contents: read
on:
push:
branches:
- main
workflow_dispatch:
inputs:
image:
description: Image name
type: string
version:
description: Image version tag
type: string
frappe-repo:
description: Frappe repo
type: string
frappe-version:
description: Frappe branch
type: string
py-version:
description: Python version
type: string
nodejs-version:
description: NodeJS version
type: string
apps-json-base64:
description: base64 encoded string of apps.json
type: string
context:
description: kaniko context
type: string
dockerfile:
description: dockerfile path from context
type: string
registry-user:
description: registry username
required: false
secrets:
REGISTRY_PASSWORD:
description: registry password
required: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
### Set up QEMU and Buildx for cross-platform builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Inject GITHUB_TOKEN into apps.json and Encode
run: |
# Replace the {{PAT}} placeholder with the actual GitHub token in apps.json
sed -i "s|{{PAT}}|${{ secrets.GH_TOKEN }}|g" ./ci/apps.json
# Encode the modified apps.json as base64 and store it in GITHUB_ENV
echo "APPS_JSON_BASE64=$(base64 -w 0 ./ci/apps.json)" >> $GITHUB_ENV
- name: Source Build Env
id: source-build-env
run: |
# Load environment variables from build.env
cat ./ci/build.env >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ inputs.registry || env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME || env.PROJECT_NAMESPACE }}
password: ${{ secrets.GH_TOKEN }}
### Using docker build to build and push the image
- uses: actions/checkout@v4
with:
repository: frappe/frappe_docker
path: builds
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
context: builds
file: builds/${{ inputs.dockerfile || env.DOCKERFILE }}
tags: |
ghcr.io/${{ env.PROJECT_NAMESPACE || github.repository }}/${{ env.PROJECT_NAME }}/${{ inputs.image || env.IMAGE }}:${{ inputs.version || env.VERSION }}
ghcr.io/${{ env.PROJECT_NAMESPACE || github.repository }}/${{ env.PROJECT_NAME }}/${{ inputs.image || env.IMAGE }}:latest
build-args: |
"FRAPPE_PATH=${{ inputs.frappe-repo || env.FRAPPE_REPO }}"
"FRAPPE_BRANCH=${{ inputs.frappe-version || env.FRAPPE_VERSION }}"
"PYTHON_VERSION=${{ inputs.py-version || env.PY_VERSION }}"
"NODE_VERSION=${{ inputs.nodejs-version || env.NODEJS_VERSION }}"
"APPS_JSON_BASE64=${{ inputs.apps-json-base64 || env.APPS_JSON_BASE64 }}"
Share full repo with other files. Or make sure all files exists.
version.txt should exist.
Must read this Formatting posts using markdown, BBCode, and HTML - Using Discourse - Discourse Meta
If you share full information it’ll eliminate guesswork and follow up questions. It’ll save a lot of time.
Another informative post How to create a Minimal, Reproducible Example - Help Center - Stack Overflow