Skip to content

Commit

Permalink
build: first version
Browse files Browse the repository at this point in the history
  • Loading branch information
thebaptiste committed Aug 28, 2023
1 parent c97d612 commit ea18675
Show file tree
Hide file tree
Showing 20 changed files with 825 additions and 1 deletion.
1 change: 1 addition & 0 deletions .build_os
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
centos8
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
push:
branches:
- master
- integration
- experimental*
- release_*
repository_dispatch:
types:
- metwork-trigger*

env:
WORKFLOW_SCRIPTS_DIR: .github/workflows
DOCKER_WORKFLOW_SCRIPTS_DIR: /src/.github/workflows
PAYLOAD_BRANCH: ${{ github.event.client_payload.branch}}
PAYLOAD_OS: ${{ github.event.client_payload.os}}

jobs:
ci_build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.client_payload.branch || github.ref }}
- name: set variables
id: SetVariables
run: |
${WORKFLOW_SCRIPTS_DIR}/set_variables.sh
- name: debug env
run: |
env
echo "Dockerfile"
cat ./Dockerfile
- name: docker build and push
id: DockerStep
env:
BRANCH: ${{ steps.SetVariables.outputs.branch }}
CACHEBUST: ${{ github.run_number }}
TAG_BRANCH: ${{ steps.SetVariables.outputs.tag_branch }}
TAG_LATEST: ${{ steps.SetVariables.outputs.tag_latest }}
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
${WORKFLOW_SCRIPTS_DIR}/docker_build.sh
19 changes: 19 additions & 0 deletions .github/workflows/docker_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

#set -eu
set -x

docker pull $TAG_BRANCH 2>/dev/null
HASH_BEFORE=`docker images -q $TAG_BRANCH`
if [ "$BRANCH" != "master" ]; then
docker build -t $TAG_BRANCH --build-arg BRANCH=$BRANCH --build-arg CACHEBUST=$CACHEBUST .
else
docker build -t $TAG_BRANCH -t $TAG_LATEST --build-arg BRANCH=$BRANCH --build-arg CACHEBUST=$CACHEBUST .
fi
HASH_AFTER=`docker images -q $TAG_BRANCH`
if [ "${HASH_BEFORE}" != "${HASH_AFTER}" ]; then
docker push $TAG_BRANCH
if [ "$BRANCH" == "master" ]; then
docker push $TAG_LATEST
fi
fi
44 changes: 44 additions & 0 deletions .github/workflows/set_variables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash





#set -eu
set -x

case "${GITHUB_EVENT_NAME}" in
repository_dispatch)
BRANCH=${PAYLOAD_BRANCH}
if [ -f .build_os ]; then
OS_VERSION=`cat .build_os`
else
OS_VERSION=${PAYLOAD_OS}
fi;;
push)
if [ -f .build_os ]; then
OS_VERSION=`cat .build_os`
else
OS_VERSION=centos6
fi
case "${GITHUB_REF}" in
refs/heads/*)
BRANCH=${GITHUB_REF#refs/heads/};;
*)
BRANCH=null;
esac;;
esac
if [ -z ${BRANCH} ]; then
BRANCH=null
fi
TAG_LATEST=""

TAG_BRANCH="metwork/mfservplugins-rocky9-image:${BRANCH}"
if test "${BRANCH}" = "master"; then
TAG_LATEST="metwork/mfservplugins-rocky9-image:latest"
fi

echo "branch=${BRANCH}" >> ${GITHUB_OUTPUT}
echo "os=${OS_VERSION}" >> ${GITHUB_OUTPUT}
echo "tag_branch=${TAG_BRANCH}" >> ${GITHUB_OUTPUT}
echo "tag_latest=${TAG_LATEST}" >> ${GITHUB_OUTPUT}
269 changes: 269 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
# automatically generated from https://github.com/metwork-framework/github_organization_management/blob/master/common_files/mergify.yml)

pull_request_rules:

- name: backports
conditions:
- "title~=^.*\\(bp #[0-9][0-9]*\\)$"
- -merged
- -closed
actions:
label:
add: ["Type: Backport"]
- name: backport to 0.5
conditions:
- base=integration
- label=backport-to-0.5
actions:
backport:
branches:
- release_0.5
- name: backport to 0.6
conditions:
- base=integration
- label=backport-to-0.6
actions:
backport:
branches:
- release_0.6
- name: backport to 0.7
conditions:
- base=integration
- label=backport-to-0.7
actions:
backport:
branches:
- release_0.7
- name: backport to 0.8
conditions:
- base=integration
- label=backport-to-0.8
actions:
backport:
branches:
- release_0.8
- name: backport to 0.9
conditions:
- base=integration
- label=backport-to-0.9
actions:
backport:
branches:
- release_0.9
- name: backport to 1.0
conditions:
- base=integration
- label=backport-to-1.0
actions:
backport:
branches:
- release_1.0
- name: backport to 1.1
conditions:
- base=integration
- label=backport-to-1.1
actions:
backport:
branches:
- release_1.1
- name: backport to 1.2
conditions:
- base=integration
- label=backport-to-1.2
actions:
backport:
branches:
- release_1.2
- name: backport to 2.0
conditions:
- base=integration
- label=backport-to-2.0
actions:
backport:
branches:
- release_2.0
- name: backport to 2.1
conditions:
- base=integration
- label=backport-to-2.1
actions:
backport:
branches:
- release_2.1

- name: approved merges
actions:
merge:
method: squash
#strict: true
#commit_message: title+body
commit_message_template: |-
{{ title }} (#{{ number }})
{{ body }}
delete_head_branch: {}
conditions:

- base!=master

- -merged
- -closed
- "#approved-reviews-by>=1"
- -title~=(WIP|wip)
- "label!=Status: Blocked"
- "title~=^(build|chore|ci|docs|style|refactor|perf|test|fix|feat|fix|feat|feat!|fix!)(\\([a-z]+\\))?: .*$"

- status-success=license/cla

#- status-success=continuous-integration/drone/pr


- name: change title
actions:
comment:
message: |
For mergify to merge automatically this PR,
=> you have to change the PR title to match conventional commit specification:
```
regex: ^(build|chore|ci|docs|style|refactor|perf|test|fix|feat|fix|feat|feat!|fix!)(\([a-z]+\))?: .*$
```
As the title will be used for the commit message (and so for changelog entry if `feat:` or `fix:`).
conditions:

- base!=master

- -merged
- -closed
- "#approved-reviews-by>=1"
- -title~=(WIP|wip)
- "label!=Status: Blocked"
- "-title~=^(build|chore|ci|docs|style|refactor|perf|test|fix|feat|fix|feat|feat!|fix!)(\\([a-z]+\\))?: .*$"

- status-success=license/cla

#- status-success=continuous-integration/drone/pr


- name: buildbot auto merges
actions:
review:
type: APPROVE
message: "automatic approve because author=metworkbot"
conditions:

- base!=master

- -merged
- -closed
- author=metworkbot
- -title~=(WIP|wip)
- "label!=Status: Blocked"
- name: mergenow auto merges
actions:
review:
type: APPROVE
message: "automatic approve because label=Status: Merge Now"
conditions:

- base!=master

- -merged
- -closed
- -title~=(WIP|wip)
- "label=Status: Merge Now"
- name: wip
actions:
label:
add: ["Status: In Progress"]
remove: ["Status: Revision Needed", "Status: Pending", "Status: Review Needed", "Status: Accepted", "Status: Blocked", "Status: NotReproduced", "Status: Merged", "Status: Merge Now"]
conditions:

- base!=master

- -merged
- -closed
- title~=(WIP|wip)
- "label!=Status: Blocked"
- name: review needed
actions:
label:
add: ["Status: Review Needed"]
remove: ["Status: Revision Needed", "Status: Pending", "Status: In Progress", "Status: Accepted", "Status: Blocked", "Status: NotReproduced", "Status: Merged", "Status: Merge Now"]
conditions:

- base!=master

- -merged
- -closed
- -title~=(WIP|wip)
- "label!=Status: Blocked"
- "label!=Status: Merge Now"
- "#approved-reviews-by=0"
- "author!=metworkbot"
- name: revision needed1
actions:
label:
add: ["Status: Revision Needed"]
remove: ["Status: In Progress", "Status: Pending", "Status: Review Needed", "Status: Accepted", "Status: Blocked", "Status: NotReproduced", "Status: Merged", "Status: Merge Now"]
conditions:

- base!=master

- -merged
- -closed
- "#changes-requested-reviews-by>=1"
- "label!=Status: Blocked"
- name: revision needed2
actions:
label:
add: ["Status: Revision Needed"]
remove: ["Status: In Progress", "Status: Pending", "Status: Review Needed", "Status: Accepted", "Status: Blocked", "Status: NotReproduced", "Status: Merged", "Status: Merge Now"]
conditions:

- base!=master

- -merged
- -closed
- conflict
- "label!=Status: Blocked"

- name: master branch
actions:
comment:
message: |
Thank you for contributing to this project.
But we don't accept pull requests on `master` branch as said in our
contributing guide.
=> You have to change the base branch of your pull request to
`integration` branch.
It's very easy to do that by following this [github guide](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-base-branch-of-a-pull-request).
Many thanks!
label:
add: ["Status: Revision Needed"]
remove: ["Status: Pending", "Status: Review Needed", "Status: Accepted", "Status: Blocked", "Status: Closed", "Status: In Progress", "Status: NotReproduced", "Status: Merge Now"]
conditions:
- base=master
- -closed

- name: closed
actions:
label:
add: ["Status: Closed"]
remove: ["Status: Revision Needed", "Status: Pending", "Status: Merged", "Status: Review Needed", "Status: Accepted", "Status: Blocked", "Status: In Progress", "Status: NotReproduced", "Status: Merge Now"]
conditions:
- closed
- -merged
- name: merged
actions:
label:
add: ["Status: Merged"]
remove: ["Status: Revision Needed", "Status: Pending", "Status: Closed", "Status: Review Needed", "Status: Accepted", "Status: Blocked", "Status: In Progress", "Status: NotReproduced", "Status: Merge Now"]
conditions:
- merged
3 changes: 3 additions & 0 deletions CHANGELOG-0.9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# release_0.9 CHANGELOG


3 changes: 3 additions & 0 deletions CHANGELOG-1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# release_1.0 CHANGELOG


Loading

0 comments on commit ea18675

Please sign in to comment.