@razee/mustachetemplate
Version:
Razee: component to use the Mustache template processor on kubernetes resource configurations.
74 lines (66 loc) • 2.58 kB
YAML
language: node_js
dist: focal
node_js:
- 22
services:
- docker
env:
global:
- WS_APIKEY=${WS_APIKEY}
- WS_USERKEY=${WS_USERKEY}
- WS_PRODUCTNAME=${WS_PRODUCTNAME}
- WS_PROJECTNAME=MustacheTemplate
- WS_WSS_URL=https://ibmets.whitesourcesoftware.com/agent
before_install:
- ./build/download-kubelint.sh
script:
# Audit npm packages. Fail build whan a PR audit fails, otherwise report the vulnerability and proceed.
- if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then npx audit-ci --config audit-ci.json; else npx audit-ci --config audit-ci.json || true; fi
- npm run lint
- npm test
- docker build --rm -t "quay.io/razee/mustachetemplate:${TRAVIS_COMMIT}" .
- if [ -n "${TRAVIS_TAG}" ]; then docker tag quay.io/razee/mustachetemplate:${TRAVIS_COMMIT} quay.io/razee/mustachetemplate:${TRAVIS_TAG}; fi
- docker images
- ./build/process-template.sh kubernetes/MustacheTemplate/resource.yaml >/tmp/resource.yaml
- kubelint /tmp/resource.yaml
- if [[ "${TRAVIS_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then npm version --no-git-tag-version "${TRAVIS_TAG}"; fi
# Perform UA scan on non-PR builds
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then curl -LJO https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar; java -jar wss-unified-agent.jar -d . || echo "UA Scan Error occurred"; fi
before_deploy:
- export GITHUB_TOKEN="${GITHUB_TOKEN20250116}"
- export NPMJS_API_KEY="${NPMJS_API_KEY_20250116}"
- export QUAY_ID="${QUAY_ID_20250106}"
- export QUAY_TOKEN="${QUAY_TOKEN_20250106}"
- docker login -u="${QUAY_ID}" -p="${QUAY_TOKEN}" quay.io
# Use npm v9 for deployments (v10 has problems with authentication with api_key)
- npm install -g npm@9
deploy:
# Deploy alpha builds
- provider: script
script: docker push "quay.io/razee/mustachetemplate:${TRAVIS_TAG}"
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+_[0-9]{3}$
# Deploy released builds
- provider: script
script: docker push "quay.io/razee/mustachetemplate:${TRAVIS_TAG}"
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$
- provider: releases
file: /tmp/resource.yaml
skip_cleanup: true
api_key: "${GITHUB_TOKEN}"
name: "${TRAVIS_TAG}"
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$
- provider: npm
email: "${NPMJS_EMAIL}"
api_key: "${NPMJS_API_KEY}"
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$