- Default variables are taken from
ci/build.envfile if no input is provided. ci/version.txtstores the image version tag. Change the file to change the output tag. It can be overridden by job inputs.
Check the .gitlab-ci.yml file.
Input Variables
CI_REGISTRY, set it to the container registry url. (compatible with docker hub)CI_PROJECT_NAMESPACE, set it to the group name on gitlabCI_PROJECT_NAME, set it to the project name on gitlabIMAGE_NAME, set it to image name without the tag. defaultregistry.gitlab.com/castlecraft/cepl-erpnext-images/appsCI_REGISTRY_USER, set it to the container registry userCI_JOB_TOKEN, set it to the container registry passwordCONTAINERFILE, set it to the Dockerfile path in kaniko contextBUILD_CONTEXT, set it to the kaniko build context, default:git://github.com/frappe/frappe_dockerFRAPPE_PATH, set it to the frappe repo url, defaulthttps://github.com/frappe/frappeFRAPPE_BRANCH, set it to the frappe repo branch, defaultv14.23.0PYTHON_VERSION, set it to python version to be used, default3.10.5NODE_VERSION, set it to nodejs version to be used, default16.18.0APPS_JSON_BASE64, set it to base64 encoded apps.json, default apps.json from repo will be used.VERSION, set it for the tag version of image to be built and pushed, default reads from version.txt file from repo.
Trigger using ReST API
curl -X POST \
--fail \
-F token=$TOKEN \
-F "ref=$REF_NAME" \
-F "variables[VERSION]=nightly" \
-F "variables[IMAGE_NAME]=apps" \
-F "variables[APPS_JSON_BASE64]=W3sidXJsIjoiaHR0cHM6Ly9naXRodWIuY29tL2ZyYXBwZS9wYXltZW50cyIsImJyYW5jaCI6ImRldmVsb3AifV0=" \
https://gitlab.com/api/v4/projects/$PROJECT_ID/trigger/pipelineCheck the .github/workflows/build.yaml. Run the workflow on main or your repos default branch. It is set to build branch in example file.
Job Inputs
image: Image nameversion: Image version tagfrappe-repo: Frappe repofrappe-version: Frappe branchpy-version: Python versionnodejs-version: NodeJS versionapps-json-base64: base64 encoded string of apps.jsoncontext: kaniko contextdockerfile: dockerfile path from contextregistry-user: registry username
Trigger using ReST API
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${OWNER}/${REPO}/actions/workflows/${WORKFLOW_ID}/dispatches \
-d '{
"ref": "topic-branch",
"inputs": {
"image": "apps",
"apps-json-base64": "W3sidXJsIjoiaHR0cHM6Ly9naXRodWIuY29tL2ZyYXBwZS9wYXltZW50cyIsImJyYW5jaCI6ImRldmVsb3AifV0="
}
}'apps.jsonmay contain repo tokens for git https basic auth. You may commit them on private repos and make sure they are never made public.- another alternative is to generate
apps.jsonwith CI secrets and then passing it to build arg. It can be done withecho, environment variables and shell pipes. Check how config.json is generated. It can be done as a step in job if it needs complex tools.