Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_container.sh for ARM64 and fixed issue #43 #44

Merged
merged 123 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 122 commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
aace70f
first actions
vpomuran May 24, 2024
03362b1
testing push actions
vpomuran May 24, 2024
bf51af8
adding linter action
vpomuran Jun 4, 2024
b9fe9b4
added manual workflow
vpomuran Jun 5, 2024
9b60fe6
upload security results to security tab
vpomuran Jun 5, 2024
434fd0d
changed versions
vpomuran Jun 5, 2024
0810077
Update NOTICES.txt
vpomuran Jun 12, 2024
5f8fedc
Merge pull request #1 from vpomuran/vpomuran-patch-1
vpomuran Jun 12, 2024
1f555be
Pull workflow
vpomuran Jun 12, 2024
a2c3c6d
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd into main
vpomuran Jun 12, 2024
9c15f17
Update pull_workflow.yml
vpomuran Jun 12, 2024
15c87e6
Changed upload-sarif version to v3
vpomuran Jun 12, 2024
049e7fa
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd into main
vpomuran Jun 12, 2024
daafe8f
Branch workflow added
vpomuran Jun 13, 2024
a87556e
Added a script setting release version based on a branch name
vpomuran Jun 14, 2024
d4a2956
added set version step
vpomuran Jun 14, 2024
9425ef0
change workdir before running update_version.sh
vpomuran Jun 14, 2024
fde9a70
added echo
vpomuran Jun 14, 2024
1cd5065
test
vpomuran Jun 14, 2024
8ca171f
run script with bash
vpomuran Jun 14, 2024
35635e8
test
vpomuran Jun 14, 2024
bcbd9d0
fixed typo in directory name
vpomuran Jun 14, 2024
12d9fc8
release workflow
vpomuran Jun 21, 2024
93613c4
test
vpomuran Jun 21, 2024
612f2c3
anotehr attempt
vpomuran Jun 21, 2024
58b71a1
another attempt
vpomuran Jun 21, 2024
3cf8bce
test
vpomuran Jun 21, 2024
491a000
test
vpomuran Jun 21, 2024
40a13b6
Release workflow
github-actions[bot] Jun 21, 2024
32d6451
changin logic
vpomuran Jun 21, 2024
e8b7c89
merge
vpomuran Jun 21, 2024
927623a
test
vpomuran Jun 21, 2024
5bce385
tst
vpomuran Jun 21, 2024
c95d2c3
Release workflow
github-actions[bot] Jun 21, 2024
2373af7
fix
vpomuran Jun 21, 2024
22a6305
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd into main
vpomuran Jun 21, 2024
4e8ce5c
Release workflow
github-actions[bot] Jun 21, 2024
dc4c341
swthc to main branch
vpomuran Jun 21, 2024
cc2384f
ee
vpomuran Jun 21, 2024
1ea5ac0
switch to main
vpomuran Jun 21, 2024
c761bbf
Release workflow
github-actions[bot] Jun 21, 2024
9280cd9
www
vpomuran Jun 21, 2024
2d506d9
Release workflow
github-actions[bot] Jun 21, 2024
4e6cb0a
remove tag commit
vpomuran Jun 21, 2024
e3938f2
OMerge branch 'main' of github.com:vpomuran/nita-webapp_cicd into main
vpomuran Jun 21, 2024
1a33886
Release workflow
github-actions[bot] Jun 21, 2024
799b2f7
first depency commit
vpomuran Jul 1, 2024
94193a5
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd into main
vpomuran Jul 1, 2024
94bd943
Release workflow
github-actions[bot] Jul 1, 2024
d68c337
changde to MS sbom action
vpomuran Jul 1, 2024
0df4c1b
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd into main
vpomuran Jul 1, 2024
721cd93
MS SBOM
vpomuran Jul 1, 2024
8d9f064
MS SBOM
vpomuran Jul 1, 2024
58911ae
Release workflow
github-actions[bot] Jul 1, 2024
155ae06
SBOM
vpomuran Jul 1, 2024
07f41ab
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd into main
vpomuran Jul 1, 2024
0e16972
Release workflow
github-actions[bot] Jul 1, 2024
a619e42
SBOM
vpomuran Jul 1, 2024
6a04980
Delete _manifest directory
vpomuran Jul 1, 2024
888b362
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd into main
vpomuran Jul 1, 2024
23bc09c
SBOM
vpomuran Jul 1, 2024
ae1070e
Release workflow
github-actions[bot] Jul 1, 2024
4168699
SBOM
vpomuran Jul 1, 2024
749a139
Release workflow
github-actions[bot] Jul 1, 2024
0150c2f
Delete spdx-285b8894-0a88-4a4f-b52f-dd85b6ebd660.spdx.json
vpomuran Jul 1, 2024
13f4d9b
SBOM
vpomuran Jul 1, 2024
40a8fa9
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd into main
vpomuran Jul 1, 2024
4051243
SBOM
vpomuran Jul 1, 2024
942055a
Release workflow
github-actions[bot] Jul 1, 2024
6afdec9
SBOM
vpomuran Jul 1, 2024
08b0420
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd into main
vpomuran Jul 1, 2024
9c42b9b
Release workflow
github-actions[bot] Jul 1, 2024
e36627e
SBOM
vpomuran Jul 2, 2024
65bee9e
SBOM
vpomuran Jul 2, 2024
9270947
SBOM
vpomuran Jul 2, 2024
82c027a
SBON
vpomuran Jul 2, 2024
3b0980f
SBOM
vpomuran Jul 2, 2024
46ba612
SBOM
vpomuran Jul 2, 2024
0e99808
Release workflow
github-actions[bot] Jul 2, 2024
f98f368
SBOM
vpomuran Jul 2, 2024
5cc1915
SBOM
vpomuran Jul 2, 2024
805f3df
SBOM
vpomuran Jul 2, 2024
193055e
SBOM
vpomuran Jul 2, 2024
6f9972c
Release workflow
github-actions[bot] Jul 2, 2024
13e3839
SBOM
vpomuran Jul 2, 2024
299c62f
Release workflow
github-actions[bot] Jul 2, 2024
862f7a2
moved LICENSE.txt to templates directory
vpomuran Jul 8, 2024
d11b9ca
o
vpomuran Jul 8, 2024
8b003d5
added LICENSE.txt generation
vpomuran Jul 8, 2024
487b5b2
fixed bug
vpomuran Jul 8, 2024
9496573
Release workflow
github-actions[bot] Jul 8, 2024
85165d4
README generation
vpomuran Jul 8, 2024
3a4510a
Release workflow
github-actions[bot] Jul 8, 2024
295ebd2
added templates for branch and readme variables
vpomuran Jul 8, 2024
7a04832
Release workflow
github-actions[bot] Jul 8, 2024
06f795d
merge two SPNX files into NOTICES.spdx.json
vpomuran Jul 25, 2024
5231e07
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd into main
vpomuran Jul 25, 2024
079c4fe
fixed typo
vpomuran Jul 25, 2024
258e87a
escape $ signes in HEREDOC
vpomuran Jul 25, 2024
6e26a74
fixed spdx file paths
vpomuran Jul 25, 2024
a8969bc
Release workflow
github-actions[bot] Jul 25, 2024
2184221
removed artifact addition for SBOM files
vpomuran Jul 25, 2024
49a18d1
Release workflow
github-actions[bot] Jul 25, 2024
0ea28ea
set meaningfull calues to some sbom-tool parameters
vpomuran Jul 25, 2024
4cb4e77
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd into main
vpomuran Jul 25, 2024
363d8ab
added quotes
vpomuran Jul 25, 2024
d12cf10
fixed unmatche quote
vpomuran Jul 25, 2024
8a8ae3a
Release workflow
github-actions[bot] Jul 25, 2024
bc50201
added manual release
vpomuran Aug 27, 2024
b0ba7b6
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd into main
vpomuran Aug 27, 2024
3cf3d8f
Release workflow
github-actions[bot] Aug 27, 2024
e36fe12
Release workflow
github-actions[bot] Sep 11, 2024
6df9257
Release workflow
github-actions[bot] Sep 11, 2024
5e73af1
Cleaning workflows directory. Addint README.md
vpomuran Sep 19, 2024
418badf
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd
vpomuran Sep 19, 2024
e534977
Release workflow
github-actions[bot] Sep 19, 2024
6ebb7c6
added missing GITHUB tocken
vpomuran Sep 19, 2024
6f44255
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd
vpomuran Sep 19, 2024
491e64d
Release workflow
github-actions[bot] Sep 19, 2024
4b08b05
Merge branch 'main' of github.com:vpomuran/nita-webapp_cicd
vpomuran Oct 17, 2024
1cfbc4b
Fixed crumbs issue : Add Network Fails in Webapp After Period o…
vpomuran Oct 17, 2024
ac68119
Changed comment
vpomuran Oct 17, 2024
9af14e0
Removed release_manual.yml becasue it prevents pull reques to go through
vpomuran Oct 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# GitHub Workflows

This folder contains the workflow files for GitHub Actions. To run these workflows, simply go to the "Actions" link above.

## Creating a New Release

This is the GitHub Action ``Create Release Manually`` and is used to create (i.e. tag) a new NITA release. When you run this action, it requests a value that will be used as the Release Name and Tag Name, with the following input dialogue:

![Input dialogue box](images/run-workflow.jpg)

The same value will be used for both the Release and the Tag. Enter a number such as "24.09" for example. The workflow asks for it twice here, to help avoid the mistake of mistyping.

The workflow steps are defined in the file ``release_manual.yml`` and are described here:
- Verify that both entries from the initial dialogue are the same. in case of any discrepancy teh workflow stops.
- Checkout code from gitub repository
- Take the tag and writes it to the file ``VERSION.txt``
- Check the Software Bill of Materials (SBOM) for all Python code and generated docker container, and write the copyright details for each dependency to a file called ``NOTICES.spdx.json``
- Generate ``LICENSE.txt`` and ``README.md`` by updatings the copyright message with the correct year, using files in build-templates directory as templates
- Commit changes and push them back to github repository
- Create a release artifact based on the given tag

122 changes: 122 additions & 0 deletions .github/workflows/release_manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Create release manually
on:
workflow_dispatch:
inputs:
release_name:
description: 'Release name and tag name'
required: true
confirm_release_name:
description: 'Release name and tag name to confirm its value'
required: true


permissions:
contents: write
Fixed Show fixed Hide fixed

jobs:
release:
name: Release
runs-on: ubuntu-22.04
steps:

- name: Verify release name
shell: bash
run: |
if [ ${{ github.event.inputs.release_name }} != ${{ github.event.inputs.confirm_release_name }} ] ; then
echo "Discrepancy between release name and confirmation release name!"
exit 1
fi
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Switch to main branch
run: |
git switch main

- name: Set VERSION.txt
env:
tag: ${{ github.event.inputs.release_name }}
shell: bash
run: echo "${tag}" > VERSION.txt


- name: Generate SBOM
env:
CompanyName: "Juniper Networks"
PackageName: "nita-webapp"
NSB: "https://juniper.net"
run: |
curl -Lo $RUNNER_TEMP/sbom-tool https://github.com/microsoft/sbom-tool/releases/latest/download/sbom-tool-linux-x64
chmod +x $RUNNER_TEMP/sbom-tool
export SBOM_OUTPUT="/var/tmp/sbom_output"
rm -rf "${SBOM_OUTPUT}_python"
mkdir "${SBOM_OUTPUT}_python"
$RUNNER_TEMP/sbom-tool generate -m ${SBOM_OUTPUT}_python -li true -pm true -b build-and-test-webapp -bc . -pn "${PackageName}" -pv 1.0.0 -ps "${CompanyName}" -nsb "${NSB}" -V Verbose
dck_cmd=`grep 'docker build' build_container.sh`
echo "DCK_CMD == ${dck_cmd}"
img=`echo ${dck_cmd} | awk '{print $4}'`
${dck_cmd}
echo "IMG = ${img}"
rm -rf "${SBOM_OUTPUT}_docker"
mkdir "${SBOM_OUTPUT}_docker"
$RUNNER_TEMP/sbom-tool generate -m ${SBOM_OUTPUT}_docker -li true -pm true -b . -pn "${PackageName}" -pv 1.0.0 -ps "${CompanyName}" -nsb "${NSB}" -V Verbose -di "${img}"
echo "Merge two SPDX files into NOTICES.spdx.json"
cat << ENDJQ > merge_spdx.sh
#!/bin/bash
#
# Merges two json files together
#
# Usage:
# merge-sbom.sh file1 file2 > merged-file
# original is here: https://edgebit.io/blog/merge-two-sboms/

jq -s 'def deepmerge(a;b):
reduce b[] as \$item (a;
reduce (\$item | keys_unsorted[]) as \$key (.;
\$item[\$key] as \$val | (\$val | type) as \$type | .[\$key] = if (\$type == "object") then
deepmerge({}; [if .[\$key] == null then {} else .[\$key] end, \$val])
elif (\$type == "array") then
(.[\$key] + \$val | unique)
else
\$val
end)
);
deepmerge({}; .)' \$1 \$2
ENDJQ
bash ./merge_spdx.sh ${SBOM_OUTPUT}_python/_manifest/spdx_2.2/manifest.spdx.json ${SBOM_OUTPUT}_docker/_manifest/spdx_2.2/manifest.spdx.json > NOTICES.spdx.json

- name: Generate License and README
env:
tag: ${{ github.event.inputs.release_name }}
run: |
export DDATE=`date "+%Y"`
export VERSION=${tag}
sed "s/Copyright \[yyyy\] \[name of copyright owner\]/Copyright $DDATE, Juniper Networks,Inc/"< build-templates/LICENSE.txt > LICENSE.txt
sed "s/Copyright \[yyyy\], \[name of copyright owner\]/Copyright $DDATE, Juniper Networks,Inc/"< build-templates/README.md > /var/tmp/README.tmp
sed "s/\[version_template\]/$VERSION/" < /var/tmp/README.tmp > README.md


- name: Commit and push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "Release workflow"
git push
export ver=`cat VERSION.txt`
echo "VER=$ver TAG=$ver"
git tag "$ver"
git push origin "$ver"


- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export tag=`cat VERSION.txt`
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${tag}" \
--generate-notes
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2024, Juniper Networks,Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Loading
Loading