Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ChandonPierre committed Jan 19, 2024
1 parent 45fb576 commit 3f2d08a
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 101 deletions.
99 changes: 0 additions & 99 deletions .github/workflows/master-latest.yaml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/mirror.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Mirror to Gitlab

on: [push]

jobs:
mirror:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: yesolutions/mirror-action@v0.6.0
with:
REMOTE: 'https://gitlab.com/${{ github.repository }}'
GIT_USERNAME: ${{ secrets.ORG_GITLAB_SYNC_UN }}
GIT_PASSWORD: ${{ secrets.ORG_GITLAB_SYNC_PW }}
147 changes: 147 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
default:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
tags:
- ord1-tenant

workflow:
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_COMMIT_BRANCH
when: always

stages:
- build
- release

build-standard:
stage: build
variables:
REF_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
FIXED_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
DOCKERFILE: ${CI_PROJECT_DIR}/Dockerfile
REGPROXY_URI: ${REGPROXY_URI}
DEBUG_IMAGE: "0"
before_script:
- export HTTP_PROXY=${REGPROXY_URI}
- export HTTPS_PROXY=${REGPROXY_URI}
- mkdir -p /etc/ssl/certs/ && cat /etc/gitlab-runner/certs/proxy-ca.crt >> /etc/ssl/certs/ca-certificates.crt
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
script: |-
/kaniko/executor \
$KANIKO_ADDTL_ARGS \
--context ${CI_PROJECT_DIR} \
--build-arg DEBUG_IMAGE=${DEBUG_IMAGE} \
--dockerfile $DOCKERFILE \
--destination $REF_IMAGE \
--destination $FIXED_IMAGE
only:
changes:
- Dockerfile
- nginx.vh.default.conf
- nginx.conf

build-debug:
stage: build
variables:
REF_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-debug
FIXED_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA-debug
DOCKERFILE: ${CI_PROJECT_DIR}/Dockerfile
REGPROXY_URI: ${REGPROXY_URI}
DEBUG_IMAGE: "1"
before_script:
- export HTTP_PROXY=${REGPROXY_URI}
- export HTTPS_PROXY=${REGPROXY_URI}
- mkdir -p /etc/ssl/certs/ && cat /etc/gitlab-runner/certs/proxy-ca.crt >> /etc/ssl/certs/ca-certificates.crt
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
script: |-
/kaniko/executor \
$KANIKO_ADDTL_ARGS \
--context ${CI_PROJECT_DIR} \
--build-arg DEBUG_IMAGE=${DEBUG_IMAGE} \
--dockerfile $DOCKERFILE \
--destination $REF_IMAGE \
--destination $FIXED_IMAGE
only:
changes:
- Dockerfile
- nginx.vh.default.conf
- nginx.conf

build:release:
stage: build
image: node:lts-alpine3.15
only:
refs:
- coreweave
artifacts:
paths:
- artifacts.env
expire_in: 1 day
before_script:
- apk --no-cache add git
script:
- npm install
- npx semantic-release

release-standard:
stage: release
only:
refs:
- coreweave
dependencies:
- build:release
variables:
DOCKERFILE: $CI_PROJECT_DIR/Dockerfile
LATEST_IMAGE: $CI_REGISTRY_IMAGE:latest
REGPROXY_URI: ${REGPROXY_URI}
DEBUG_IMAGE: "0"
before_script:
- export HTTP_PROXY=${REGPROXY_URI}
- export HTTPS_PROXY=${REGPROXY_URI}
- mkdir -p /etc/ssl/certs/ && cat /etc/gitlab-runner/certs/proxy-ca.crt >> /etc/ssl/certs/ca-certificates.crt
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- export $(cat artifacts.env | xargs)
- export RELEASE_IMAGE=$CI_REGISTRY_IMAGE:$BUILD_VERSION
script: |-
/kaniko/executor \
$KANIKO_ADDTL_ARGS \
--context . \
--dockerfile $DOCKERFILE \
--build-arg DEBUG_IMAGE=${DEBUG_IMAGE} \
--destination $RELEASE_IMAGE \
--destination $LATEST_IMAGE
release-debug:
stage: release
only:
refs:
- coreweave
dependencies:
- build:release
variables:
DOCKERFILE: $CI_PROJECT_DIR/Dockerfile
LATEST_IMAGE: $CI_REGISTRY_IMAGE:latest-debug
REGPROXY_URI: ${REGPROXY_URI}
DEBUG_IMAGE: "1"
before_script:
- export HTTP_PROXY=${REGPROXY_URI}
- export HTTPS_PROXY=${REGPROXY_URI}
- mkdir -p /etc/ssl/certs/ && cat /etc/gitlab-runner/certs/proxy-ca.crt >> /etc/ssl/certs/ca-certificates.crt
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- export $(cat artifacts.env | xargs)
- export RELEASE_IMAGE=$CI_REGISTRY_IMAGE:$BUILD_VERSION-debug
script: |-
/kaniko/executor \
$KANIKO_ADDTL_ARGS \
--context . \
--dockerfile $DOCKERFILE \
--build-arg DEBUG_IMAGE=${DEBUG_IMAGE} \
--destination $RELEASE_IMAGE \
--destination $LATEST_IMAGE
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ RUN apk upgrade --no-cache --update
RUN apk add --no-cache --update tzdata pcre zlib libssl3

# If set to 1, enables building debug version of nginx, which is super-useful, but also heavy to build.
ARG DEBUG_BUILD="1"
ENV DO_DEBUG_BUILD="$DEBUG_BUILD"
ARG DO_DEBUG_BUILD="${DEBUG_IMAGE:-"0"}"

ENV NGINX_VERSION 1.25.3

Expand Down

0 comments on commit 3f2d08a

Please sign in to comment.