Move to GitHub Actions and Azure App Service (#119)

* configure reverse proxy to initializr service with uri/host being set by env vars
This commit is contained in:
Tim Hess 2024-02-09 09:32:57 -06:00 коммит произвёл GitHub
Родитель 5d16762775
Коммит 567e6ecb40
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
34 изменённых файлов: 124 добавлений и 772 удалений

76
.github/workflows/build-deploy.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,76 @@
name: Build and deploy
on:
pull_request:
branches:
- main
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: 'read'
pull-requests: 'write'
env:
IMAGE_TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || github.run_id }}
jobs:
build-push-deploy:
name: Build and push image
environment:
name: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || vars.STAGING_SLOT_NAME }}
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
env:
SLOT_NAME: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || vars.STAGING_SLOT_NAME }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Login to container registry
uses: azure/docker-login@v1
with:
login-server: "${{ vars.DOCKER_REGISTRY }}"
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"
- name: Build image
run: docker build . --file "Dockerfile" -t ${{ vars.DOCKER_REGISTRY }}/initializr-web:${{ env.IMAGE_TAG }}
- name: Push image
run: docker push ${{ vars.DOCKER_REGISTRY }}/initializr-web:${{ env.IMAGE_TAG }}
- name: If PR, create a new staging slot
if: ${{ github.event_name == 'pull_request' }}
run: az webapp deployment slot create --resource-group ${{ vars.AZURE_RESOURCE_GROUP }} --name ${{ vars.AZURE_WEBAPP_NAME}} --slot ${{ env.SLOT_NAME }} --configuration-source staging
- name: Deploy to staging slot
uses: azure/webapps-deploy@v3
id: deploy-to-webapp
with:
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
images: ${{ vars.DOCKER_REGISTRY }}/initializr-web:${{ env.IMAGE_TAG }}
slot-name: ${{ env.SLOT_NAME }}
- name: If PR, comment with the preview link
if: ${{ github.event_name == 'pull_request' }}
uses: mshick/add-pr-comment@v2
with:
message: |
## Preview link: https://${{ vars.AZURE_WEBAPP_NAME }}-${{ env.SLOT_NAME }}.azurewebsites.net
- Your changes have been deployed to the preview site. The preview site will update as you add more commits to this branch.
- The preview link is shareable, but will be deleted when the pull request is merged or closed.
> *This is an automated message.*
repo-token: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore поставляемый
Просмотреть файл

@ -39,3 +39,4 @@ target
.DS_Store
/tools/
.vscode/settings.json

2
.mvn/wrapper/maven-wrapper.properties поставляемый
Просмотреть файл

@ -1,2 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.2/apache-maven-3.9.2-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.2/apache-maven-3.9.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

Просмотреть файл

@ -17,6 +17,16 @@ RUN yarn build
FROM phusion/passenger-nodejs:3.0.1
COPY --from=build /usr/src /usr/share/initializr/www
RUN chown -R app:app /usr/share/initializr/www
RUN apt-get update && apt-get install -y gettext-base
RUN rm /etc/nginx/sites-enabled/default
RUN rm -f /etc/service/nginx/down
COPY deploy/docker/initializr-web.conf /etc/nginx/sites-enabled/
RUN sed -i "s|daemon off;|#daemon off; |g" /etc/nginx/nginx.conf
RUN echo "env INITIALIZR_SERVICE_HOST;" >> /etc/nginx/main.d/default.conf
RUN echo "env INITIALIZR_SERVICE_URI;" >> /etc/nginx/main.d/default.conf
COPY deploy/docker/initializr-web.conf.template /etc/nginx/templates/
COPY deploy/docker/docker-entrypoint.sh ./
RUN chmod +x docker-entrypoint.sh
ENTRYPOINT [ "./docker-entrypoint.sh" ]
CMD ["nginx", "-g", "daemon off;"]
# cat /etc/nginx/sites-enabled/initializr.conf

Просмотреть файл

@ -2,8 +2,6 @@
Steeltoe Initializr UI reference implementation
[![Build Status](https://dev.azure.com/SteeltoeOSS/Steeltoe/_apis/build/status/Initializr/SteeltoeOSS.InitializrWeb?branchName=main)](https://dev.azure.com/SteeltoeOSS/Steeltoe/_build/latest?definitionId=32&branchName=main)
## About
This implementation largely steals from the [Spring Initializr Client](https://github.com/spring-io/start.spring.io).
@ -14,9 +12,10 @@ Domain metadata include metadata differences such as "Java version" vs ".NET Fra
## Deploying
There are 2 endpoints that the Web UI uses to 1) populate its UI, and 2) generate projects:
* `/api/config/projectMetadata`
* `/api/project`
For local development, these endpoints are implemented in the development webpack configuration in [start-client/webpack.dev.js](start-client/webpack.dev.js).
In a remote deployment, those endpoints are implemented by the [Initializr API](https://github.com/SteeltoeOSS/InitializrApi).

Просмотреть файл

@ -1,65 +0,0 @@
trigger:
- main
variables:
- name: major
value: 1
- name: minor
value: 2
- name: patch
value: 0
name: $(major).$(minor).$(patch)-$(Rev:r)
stages:
- stage: Deploy
displayName: Deploy
condition:
not(eq(variables['build.reason'], 'PullRequest'))
jobs:
- job: deploy
displayName: Deploy Docker Image
pool:
vmImage: ubuntu-latest
steps:
- task: Bash@3
displayName: Configure Version
inputs:
targetType: inline
script: |
echo '{ "label" : "'$LABEL'" }' > start-client/BuildVersion.json
env:
LABEL: $(Build.BuildNumber)
- task: Docker@2
displayName: Build and Push Docker Image
inputs:
command: buildAndPush
containerRegistry: SteeltoeContainerRegistry
repository: initializr-web
tags: |
$(Build.BuildId)
latest
- task: ShellScript@2
displayName: Generate Staging Manifest
inputs:
scriptPath: ./yttw.sh
args: >
-f kubernetes
-v image_tag=$(Build.BuildId)
-v hostname=start-staging.steeltoe.io
--output-files manifests/staging
- task: ShellScript@2
displayName: Generate Production Manifest
inputs:
scriptPath: ./yttw.sh
args: >
-f kubernetes
-v image_tag=$(Build.BuildId)
-v replica_count=2
-v hostname=start.steeltoe.io
--output-files manifests/production
- task: PublishPipelineArtifact@1
displayName: Publish Manifests
inputs:
targetPath: manifests
artifactName: manifests

Просмотреть файл

@ -1,18 +0,0 @@
== Concourse pipeline
Ensure that you've setup the target and can login
[source]
----
$ fly -t initializr login -n initializr -c https://ci.spring.io
----
The pipeline can be deployed using the following command:
[source]
----
$ fly -t initializr set-pipeline -p start-site -c ci/pipeline.yml -l ci/parameters.yml
----
NOTE: This assumes that you have credhub integration configured with the appropriate
secrets.

Просмотреть файл

@ -1,45 +0,0 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: default
name: start-deployment
spec:
replicas: 2
selector:
matchLabels:
app: start
template:
metadata:
labels:
app: start
spec:
containers:
- name: start-app
image: gcr.io/cf-spring-boot/initializr-k8s-image@sha256:fc7ea9a906686b7d0e2d4ae27bdc1ab08700e732184d54b1dfa73c35e1b2db6f
lifecycle:
preStop:
exec:
command: ["sh", "-c", "sleep 10"]
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: 8080
initialDelaySeconds: 5
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8080
volumeMounts:
- name: elastic
mountPath: "/etc/config/initializr/stats/elastic"
readOnly: true
env:
- name: SERVER_SHUTDOWN
value: graceful
- name: SPRING_CONFIG_IMPORT
value: configtree:/etc/config/
volumes:
- name: elastic
secret:
secretName: elastic

Просмотреть файл

@ -1,3 +0,0 @@
#@data/values
---
uri: ""

Просмотреть файл

@ -1,9 +0,0 @@
kind: Config
current-context: spring-initializr
contexts: [{name: spring-initializr, context: {cluster: spring-initializr, user: user-1}}]
users: [{name: user-1, user: {auth-provider: {name: gcp}}}]
clusters:
- name: spring-initializr
cluster:
server: "https://35.245.127.30"
certificate-authority-data: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURERENDQWZTZ0F3SUJBZ0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mlLNlp3Y0txaXBsUytUNDdoRjRPdGU0WG1ZLzZVNnEKak8xUk5TaFBqdzJvYi9WZTE0cHpXWTh0SUxoTFlhd2w1Z1ZKbGgxaHhmZkJFamNoTW8vbnZqVHZrQjFxVUt5YwoxRmkyRHZCejZDREZtckJUVmR1SXJKM2dYYkZ5VWNsMGk4YXo5RkNpMGJBa2hoL0gwbUpEUUZ4aWFlZjlGdzdZCkNLbGdnZGEzTHppTmw3YUlKaEhRbGpLTXMybFFzNktlYXMwaHgzbitNaFg0S0FGdFVjQXduWVBZZjZHRVN2VTMKTm1sVVlUUGlJL1RhWldSWmoxOFJUQT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K"

Просмотреть файл

@ -1,7 +0,0 @@
#@ load("@ytt:data", "data")
apiVersion: v1
kind: Secret
metadata:
name: elastic
data:
uri: #@ data.values.uri

Просмотреть файл

@ -1,21 +0,0 @@
== CI Images
These images are used by CI to run the actual builds.
To build the image locally run the following from this directory:
----
$ docker build --no-cache -f <image-folder>/Dockerfile .
----
For example
----
$ docker build --no-cache -f ci-image/Dockerfile .
----
To test run:
----
$ docker run -it --entrypoint /bin/bash <SHA>
----

Просмотреть файл

@ -1,25 +0,0 @@
#!/bin/bash
set -ex
###########################################################
# UTILS
###########################################################
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install --no-install-recommends -y tzdata ca-certificates curl git node-gyp
ln -fs /usr/share/zoneinfo/UTC /etc/localtime
dpkg-reconfigure --frontend noninteractive tzdata
curl https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.2/concourse-java.sh > /opt/concourse-java.sh
###########################################################
# JAVA
###########################################################
mkdir -p /opt/openjdk
cd /opt/openjdk
curl -L https://github.com/bell-sw/Liberica/releases/download/17.0.7+7/bellsoft-jdk17.0.7+7-linux-amd64.tar.gz | tar zx --strip-components=1
test -f /opt/openjdk/bin/java
test -f /opt/openjdk/bin/javac

Просмотреть файл

@ -1,21 +0,0 @@
FROM ubuntu:jammy-20230425
ADD setup.sh /setup.sh
RUN ./setup.sh
ENV JAVA_HOME /opt/openjdk
ENV PATH $JAVA_HOME/bin:$PATH
RUN apt-get update && \
apt-get install -y wget && \
wget https://github.com/k14s/ytt/releases/download/v0.27.2/ytt-linux-amd64 && \
mv ytt-linux-amd64 /usr/local/bin/ytt && \
chmod +x /usr/local/bin/ytt
RUN apt-get update && \
apt-get install -y apt-transport-https gnupg2 && \
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list && \
apt-get update && \
apt-get install -y kubectl=1.25.10-00

Просмотреть файл

@ -1,22 +0,0 @@
github-repo: "https://github.com/spring-io/start.spring.io.git"
github-repo-name: "spring-io/start.spring.io"
branch: main
artifactory-server: "https://repo.spring.io"
artifactory-repo: "initializr-ci-local"
docker-hub-organization: "springci"
build-name: "start-site"
pipeline-name: "start-site"
concourse-url: "https://ci.spring.io"
task-timeout: 1h00m
shipyard-kubeconfig: |
apiVersion: v1
kind: Config
current-context: my-cluster
contexts: [{name: my-cluster, context: {cluster: cluster-1, user: user-1}}]
users: [{name: user-1, user: {auth-provider: {name: gcp}}}]
clusters:
- name: cluster-1
cluster:
server: "https://34.71.146.206"
certificate-authority-data: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURLekNDQWhPZ0F3SUJBZ0lSQU8vWktkbC92aS93OHoyMFIrSFM0OWN3RFFZSktvWklodmNOQVFFTEJRQXcKTHpFdE1Dc0dBMVVFQXhNa05UTmpPVGhsWlRFdE16WXhPUzAwWXpJMUxUbGhNRGd0TXpVM01qRmtOR00xTWpJdwpNQjRYRFRJd01Ea3dNakUwTkRjek9Wb1hEVEkxTURrd01URTFORGN6T1Zvd0x6RXRNQ3NHQTFVRUF4TWtOVE5qCk9UaGxaVEV0TXpZeE9TMDBZekkxTFRsaE1EZ3RNelUzTWpGa05HTTFNakl3TUl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hTSlFSRENjdjkKeEVWVUZTSDU4eU8zY3FlanVtU09ScHRkajZicHNxaWhTT3lUM20rcXVsZ1REZUkxakRsNnZRL0RGMzhvaGFzPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg=="
google-tagmanager-id: "GTM-KZM7GF6"

Просмотреть файл

@ -1,274 +0,0 @@
anchors:
docker-resource-source: &docker-resource-source
username: ((docker-hub-username))
password: ((docker-hub-password))
resource_types:
- name: artifactory-resource
type: registry-image
source:
<<: *docker-resource-source
repository: springio/artifactory-resource
tag: 0.0.17
- name: github-status-resource
type: registry-image
source:
<<: *docker-resource-source
repository: dpb587/github-status-resource
tag: master
- name: kpack-image
type: registry-image
source:
repository: gcr.io/cf-build-service-public/concourse-kpack-resource
tag: "1.0"
username:
password:
- name: slack-notification
type: registry-image
source:
<<: *docker-resource-source
repository: cfcommunity/slack-notification-resource
tag: latest
resources:
- name: artifactory-repo
type: artifactory-resource
icon: package-variant
source:
uri: ((artifactory-server))
username: ((artifactory-username))
password: ((artifactory-password))
build_name: ((build-name))
- name: build-source
type: git
icon: github-circle
source:
uri: ((github-repo))
branch: ((branch))
ignore_paths:
- ci/config/deployment.yml
- name: build-status
type: github-status-resource
icon: check
source:
repository: spring-io/start.spring.io
access_token: ((github-ci-status-token))
branch: ((branch))
context: build
- name: ci-images
type: git
icon: github-circle
source:
uri: ((github-repo))
branch: ((branch))
paths:
- ci/images/*
- name: daily
type: time
icon: clock-outline
source:
interval: 24h
- name: deploy-source
type: git
icon: github-circle
source:
uri: ((github-repo))
branch: ((branch))
paths:
- ci/config/deployment.yml
- name: kpack
type: kpack-image
icon: docker
source:
image: initializr-k8s-image
namespace: spring-initializr
gke:
json_key: ((kpack-resource-account-key))
kubeconfig: ((shipyard-kubeconfig))
- name: script-source
type: git
icon: github-circle
source:
uri: ((github-repo))
username: ((github-username))
password: ((github-ci-release-token))
branch: ((branch))
- name: slack-alert
type: slack-notification
icon: slack
source:
url: ((slack-webhook-url))
- name: start-site-ci-image
type: docker-image
icon: docker
source:
repository: springci/start-site-ci-image
username: ((docker-hub-username))
password: ((docker-hub-password))
tag: ((branch))
groups:
- name: site
jobs:
- build
- deploy
- update-deployment
- update-image
- verify
- name: ci-images
jobs:
- build-start-site-ci-image
jobs:
- name: build
plan:
- in_parallel:
- get: git-repo
resource: build-source
trigger: true
- get: start-site-ci-image
- put: build-status
params:
commit: git-repo
state: pending
- task: build
image: start-site-ci-image
file: git-repo/ci/tasks/build-service.yml
timeout: ((task-timeout))
params:
GOOGLE_TAGMANAGER_ID: ((google-tagmanager-id))
on_success:
put: build-status
params:
commit: git-repo
state: success
on_failure:
in_parallel:
- put: build-status
params:
commit: git-repo
state: failure
- put: slack-alert
params:
text: ":concourse-failed: <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|failure: ${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME}>"
silent: true
icon_emoji: ":concourse:"
username: concourse-ci
- put: artifactory-repo
params:
repo: ((artifactory-repo))
folder: distribution-repository
build_uri: "https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}"
build_number: "${BUILD_PIPELINE_NAME}-${BUILD_JOB_NAME}-${BUILD_NAME}"
disable_checksum_uploads: true
- name: deploy
plan:
- in_parallel:
- get: deploy-git-repo
resource: deploy-source
trigger: true
- get: git-repo
resource: script-source
- get: start-site-ci-image
- task: deploy
image: start-site-ci-image
file: git-repo/ci/tasks/deploy.yml
params:
KEY: ((developer-account-key))
ELASTIC_uri: ((elastic-uri))
- put: slack-alert
params:
text: ":concourse-succeeded: <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|sucess: ${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME}>"
silent: true
icon_emoji: ":concourse:"
username: concourse-ci
- name: build-start-site-ci-image
plan:
- get: source
resource: ci-images
trigger: true
- put: start-site-ci-image
params:
build: source/ci/images
dockerfile: source/ci/images/start-site-ci-image/Dockerfile
- name: update-deployment
plan:
- in_parallel:
- get: git-repo
resource: script-source
- get: kpack
trigger: true
- get: start-site-ci-image
- task: update-deployment
image: start-site-ci-image
file: git-repo/ci/tasks/update-deployment.yml
- put: git-repo
resource: script-source
params:
repository: updated-git-repo
- name: update-image
plan:
- in_parallel:
- get: git-repo
resource: script-source
- get: artifactory-repo
trigger: true
- get: start-site-ci-image
- task: get-blob-url
image: start-site-ci-image
file: git-repo/ci/tasks/get-blob-url.yml
params:
<<: *docker-resource-source
ARTIFACTORY_SERVER: ((artifactory-server))
ARTIFACTORY_REPO: ((artifactory-repo))
- put: kpack
params:
blob_url_file: blob-url/url
- name: verify
serial: true
public: true
plan:
- in_parallel:
- get: daily
trigger: true
- get: git-repo
resource: script-source
trigger: true
- get: start-site-ci-image
- task: verify-service.yml
image: start-site-ci-image
file: git-repo/ci/tasks/verify-service.yml
on_success:
put: slack-alert
params:
text: ":concourse-succeeded: <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|sucess: ${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME}>"
silent: true
icon_emoji: ":concourse:"
username: concourse-ci
on_failure:
put: slack-alert
params:
text: ":concourse-failed: <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|failure: ${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME}>"
silent: true
icon_emoji: ":concourse:"
username: concourse-ci

Просмотреть файл

@ -1,9 +0,0 @@
#!/bin/bash
set -e
source $(dirname $0)/common.sh
repository=$(pwd)/distribution-repository
pushd git-repo
./mvnw clean deploy -U -DaltDeploymentRepository=distribution::default::file://${repository}
popd

Просмотреть файл

@ -1,4 +0,0 @@
source /opt/concourse-java.sh
setup_symlinks
cleanup_maven_repo "io.spring.start"

Просмотреть файл

@ -1,10 +0,0 @@
#!/bin/bash
set -e
CONFIG_DIR=git-repo/ci/config
echo $KEY > key.json
export GOOGLE_APPLICATION_CREDENTIALS=key.json
export KUBECONFIG=${CONFIG_DIR}/kubeconfig.yml
export ENCODED_uri=$(echo -n $ELASTIC_uri | base64)
ytt -f ${CONFIG_DIR}/secret.yml -f ${CONFIG_DIR}/elastic.yml --data-values-env ENCODED | kubectl apply -f-
kubectl apply -f ${CONFIG_DIR}/deployment.yml

Просмотреть файл

@ -1,12 +0,0 @@
#!/bin/bash
set -e
pushd git-repo
snapshotVersion=0.0.1-SNAPSHOT
popd
pushd artifactory-repo/io/spring/start/start-site/$snapshotVersion
path=$( find . -type f -iname "*-exec.jar" )
name=${path#"./"}
popd
echo $name
echo "${ARTIFACTORY_SERVER}/${ARTIFACTORY_REPO}/io/spring/start/start-site/${snapshotVersion}/$name" > blob-url/url

Просмотреть файл

@ -1,17 +0,0 @@
#!/bin/bash
set -e
IMAGE=$( cat kpack/image )
git clone git-repo updated-git-repo > /dev/null
pushd updated-git-repo > /dev/null
CONFIG_DIR=ci/config
sed -i -e "s|image: .*|image: ${IMAGE}|" ${CONFIG_DIR}/deployment.yml
git config user.name "Spring Builds" > /dev/null
git config user.email "spring-builds@users.noreply.github.com" > /dev/null
git add ${CONFIG_DIR}/deployment.yml > /dev/null
git commit -m"Update image digest in deployment.yml" > /dev/null
popd > /dev/null

Просмотреть файл

@ -1,8 +0,0 @@
#!/bin/bash
set -e
source $(dirname $0)/common.sh
pushd git-repo > /dev/null
./mvnw -Pverification -U -f pom.xml clean verify
popd > /dev/null

Просмотреть файл

@ -1,12 +0,0 @@
---
platform: linux
inputs:
- name: git-repo
outputs:
- name: distribution-repository
caches:
- path: maven
params:
GOOGLE_TAGMANAGER_ID:
run:
path: git-repo/ci/scripts/build-service.sh

Просмотреть файл

@ -1,9 +0,0 @@
---
platform: linux
inputs:
- name: git-repo
params:
KEY:
ELASTIC_uri:
run:
path: git-repo/ci/scripts/deploy.sh

Просмотреть файл

@ -1,19 +0,0 @@
---
platform: linux
image_resource:
type: registry-image
source:
repository: springci/start-site-ci-image
tag: main
username: ((docker-hub-username))
password: ((docker-hub-password))
inputs:
- name: artifactory-repo
- name: git-repo
outputs:
- name: blob-url
params:
ARTIFACTORY_SERVER:
ARTIFACTORY_REPO:
run:
path: git-repo/ci/scripts/get-blob-url.sh

Просмотреть файл

@ -1,9 +0,0 @@
---
platform: linux
inputs:
- name: git-repo
- name: kpack
outputs:
- name: updated-git-repo
run:
path: git-repo/ci/scripts/update-deployment.sh

Просмотреть файл

@ -1,8 +0,0 @@
---
platform: linux
inputs:
- name: git-repo
caches:
- path: maven
run:
path: git-repo/ci/scripts/verify-service.sh

Просмотреть файл

@ -0,0 +1,10 @@
#!/usr/bin/env sh
set -eu
echo "Starting up with these env variables... host: $INITIALIZR_SERVICE_HOST, uri: $INITIALIZR_SERVICE_URI"
envsubst '$INITIALIZR_SERVICE_HOST $INITIALIZR_SERVICE_URI' < /etc/nginx/templates/initializr-web.conf.template > /etc/nginx/sites-enabled/initializr.conf
# cat /etc/nginx/sites-enabled/initializr.conf
exec "$@"

Просмотреть файл

@ -1,10 +0,0 @@
server {
listen 80;
root /usr/share/initializr/www/public;
passenger_enabled on;
passenger_user app;
passenger_app_type node;
passenger_startup_file src/App.js;
}
# vim: ft=nginx

Просмотреть файл

@ -0,0 +1,23 @@
server {
listen 80;
root /usr/share/initializr/www/public;
passenger_enabled on;
passenger_user app;
passenger_app_type node;
passenger_startup_file src/App.js;
location /api {
proxy_ssl_protocols TLSv1.2;
proxy_pass $INITIALIZR_SERVICE_URI;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $INITIALIZR_SERVICE_HOST;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $server_name;
}
}
# vim: ft=nginx

Просмотреть файл

@ -1,15 +0,0 @@
#@data/values-schema
#@schema/type any=True
---
name: initializr-web
namespace: initializr
image_name: steeltoe.azurecr.io/initializr-web
image_tag: latest
container_port: 80
service_port: 80
replica_count: 1
args: ""
hostname: ""
tls_secret: initializr-web-tls
backend_name: initializr-service
backend_port: 80

Просмотреть файл

@ -1,84 +0,0 @@
#@ load("@ytt:data", "data")
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: #@ data.values.name
namespace: #@ data.values.namespace
spec:
selector:
matchLabels:
app: #@ data.values.name
template:
metadata:
labels:
app: #@ data.values.name
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: #@ data.values.name
image: #@ "{}:{}".format(data.values.image_name, data.values.image_tag)
ports:
- containerPort: #@ int(data.values.container_port)
replicas: #@ int(data.values.replica_count)
---
apiVersion: v1
kind: Service
metadata:
name: #@ data.values.name
namespace: #@ data.values.namespace
spec:
ports:
- port: #@ int(data.values.service_port)
targetPort: #@ int(data.values.container_port)
selector:
app: #@ data.values.name
#@ if/end data.values.hostname:
---
apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
name: #@ data.values.name
namespace: #@ data.values.namespace
spec:
virtualhost:
fqdn: #@ data.values.hostname
tls:
secretName: #@ data.values.tls_secret
routes:
- conditions:
- prefix: /
services:
- name: #@ data.values.name
port: #@ int(data.values.service_port)
- conditions:
- prefix: /api
services:
- name: #@ data.values.backend_name
port: #@ int(data.values.backend_port)
- conditions:
- prefix: /
header:
name: user-agent
contains: curl
pathRewritePolicy:
replacePrefix:
- replacement: /api
services:
- name: #@ data.values.backend_name
port: #@ int(data.values.backend_port)
- conditions:
- prefix: /
header:
name: user-agent
contains: HTTPie
pathRewritePolicy:
replacePrefix:
- replacement: /api
services:
- name: #@ data.values.backend_name
port: #@ int(data.values.backend_port)

Просмотреть файл

@ -1,2 +0,0 @@
ytt_version=v0.36.0
ytt_mirror=https://github.com/vmware-tanzu/carvel-ytt/releases/download

29
yttw.sh
Просмотреть файл

@ -1,29 +0,0 @@
#!/usr/bin/env bash
set -e
# =========================================================================== #
# wrapper for ytt #
# =========================================================================== #
base_dir=$(dirname $0)
ytt=$base_dir/tools/ytt
if [ ! -x $ytt ]; then
ytt_version=$(grep '^ytt_version=' $base_dir/tool.properties | cut -d= -f2)
ytt_mirror=$(grep '^ytt_mirror=' $base_dir/tool.properties | cut -d= -f2)
case $(uname -s) in
Darwin) platform=darwin ;;
Linux) platform=linux ;;
*)
echo "unsupported platform: $(uname -s)"
exit 1
;;
esac
ytt_url=$ytt_mirror/$ytt_version/ytt-$platform-amd64
mkdir -p $(dirname $ytt)
wget $ytt_url -O $ytt
chmod +x $ytt
fi
exec $ytt $*